Merge pull request #19 from GRRLIB/gamecube

Fix GameCube support
This commit is contained in:
Crayon 2021-07-07 00:44:20 -04:00 committed by GitHub
commit 9aa8be58e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 109 additions and 94 deletions

View file

@ -19,7 +19,7 @@ jobs:
run: | run: |
(cd GRRLIB && make clean all install) (cd GRRLIB && make clean all install)
(cd examples && make) (cd examples && make)
(cd GRRLIB && make PLATFORM=cube clean all) (cd GRRLIB/GRRLIB && make PLATFORM=cube clean all install)
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:

View file

@ -66,7 +66,8 @@ int GRRLIB_Init (void) {
VIDEO_SetBlack(true); // Disable video output during initialisation VIDEO_SetBlack(true); // Disable video output during initialisation
// Grab a pointer to the video mode attributes // Grab a pointer to the video mode attributes
if ( !(rmode = VIDEO_GetPreferredMode(NULL)) ) { rmode = VIDEO_GetPreferredMode(NULL);
if (rmode == NULL) {
return -1; return -1;
} }
@ -76,21 +77,24 @@ int GRRLIB_Init (void) {
//rmode = &TVPal574IntDfScale; //rmode = &TVPal574IntDfScale;
rmode = &TVPal528IntDf; // BC ...this is still wrong, but "less bad" for now rmode = &TVPal528IntDf; // BC ...this is still wrong, but "less bad" for now
break; break;
default:
#ifdef HW_DOL
if(VIDEO_HaveComponentCable()) {
rmode = &TVNtsc480Prog;
}
#endif
break;
} }
#if defined(HW_RVL) #if defined(HW_RVL)
// 16:9 and 4:3 Screen Adjustment for Wii // 16:9 and 4:3 Screen Adjustment for Wii
if (CONF_GetAspectRatio() == CONF_ASPECT_16_9) { if (CONF_GetAspectRatio() == CONF_ASPECT_16_9) {
rmode->viWidth = 678; rmode->viWidth = 678;
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 678) / 2; // This probably needs to consider PAL
} else { // 4:3 } else { // 4:3
rmode->viWidth = 672; rmode->viWidth = 672;
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 672) / 2;
} }
#else // This probably needs to consider PAL
// GameCube rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - rmode->viWidth) / 2;
rmode->viWidth = 672;
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 672) / 2;
#endif #endif
#if defined(HW_RVL) #if defined(HW_RVL)

View file

@ -12,16 +12,23 @@ endif
ifeq ($(PLATFORM),cube) ifeq ($(PLATFORM),cube)
include $(DEVKITPPC)/gamecube_rules include $(DEVKITPPC)/gamecube_rules
MACHDEP += -DHW_DOL
INSTALL_INC := $(DEVKITPRO)/portlibs/gamecube/include
INSTALL_LIB := $(DEVKITPRO)/portlibs/gamecube/lib
else else
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
MACHDEP += -DHW_RVL
INSTALL_INC := $(DEVKITPRO)/portlibs/wii/include
INSTALL_LIB := $(DEVKITPRO)/portlibs/wii/lib
endif endif
NULLSTR := NULLSTR :=
PWD := $(subst $(NULLSTR) ,\ ,$(shell pwd)) PWD := $(subst $(NULLSTR) ,\ ,$(shell pwd))
INSTALL_INC := $(DEVKITPRO)/portlibs/ppc/include
INSTALL_LIB := $(DEVKITPRO)/portlibs/ppc/lib
INCLUDE := -I../lib/pngu -I$(PWD) -I$(LIBOGC_INC) -I$(DEVKITPRO)/portlibs/ppc/include -I$(DEVKITPRO)/portlibs/ppc/include/freetype2 INCLUDE := -I../lib/pngu -I$(PWD) -I$(LIBOGC_INC) -I$(DEVKITPRO)/portlibs/ppc/include -I$(DEVKITPRO)/portlibs/ppc/include/freetype2
CFLAGS := -O2 -Wall $(MACHDEP) $(INCLUDE) CFLAGS := -O2 -Wall $(MACHDEP) $(INCLUDE)

View file

@ -10,16 +10,13 @@ ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif endif
ifeq ($(PLATFORM),cube) include $(DEVKITPPC)/base_rules
include $(DEVKITPPC)/gamecube_rules MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
else
include $(DEVKITPPC)/wii_rules
endif
INSTALL_INC := $(DEVKITPRO)/portlibs/ppc/include INSTALL_INC := $(DEVKITPRO)/portlibs/ppc/include
INSTALL_LIB := $(DEVKITPRO)/portlibs/ppc/lib INSTALL_LIB := $(DEVKITPRO)/portlibs/ppc/lib
INCLUDE := -I$(LIBOGC_INC) -I$(DEVKITPRO)/portlibs/ppc/include INCLUDE := -I$(DEVKITPRO)/portlibs/ppc/include
CFLAGS := -O2 -Wall $(MACHDEP) $(INCLUDE) CFLAGS := -O2 -Wall $(MACHDEP) $(INCLUDE)
LIB := pngu LIB := pngu

View file

@ -172,4 +172,3 @@ int PNGU_EncodeFromEFB (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 st
#endif #endif
#endif #endif

View file

@ -102,20 +102,27 @@ libfreetype and libjpeg with there dependencies in a single command:
Each library could also be installed individually: Each library could also be installed individually:
To install libpngu To install libpngu:
```bash ```bash
c: c:
cd \grr\GRRLIB\lib\pngu cd \grr\GRRLIB\lib\pngu
make clean all install make clean all install
``` ```
To install libgrrlib: To install libgrrlib for Wii:
```bash ```bash
c: c:
cd \grr\GRRLIB\GRRLIB cd \grr\GRRLIB\GRRLIB
make clean all install make clean all install
``` ```
To install libgrrlib for GameCube:
```bash
c:
cd \grr\GRRLIB\GRRLIB
make PLATFORM=cube clean all install
```
## Using GRRLIB ## Using GRRLIB
After everything is installed, simply put After everything is installed, simply put

View file

@ -4,6 +4,7 @@
#include <grrlib.h> #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <ogc/lwp_watchdog.h> // Needed for gettime and ticks_to_millisecs #include <ogc/lwp_watchdog.h> // Needed for gettime and ticks_to_millisecs