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: |
(cd GRRLIB && make clean all install)
(cd examples && make)
(cd GRRLIB && make PLATFORM=cube clean all)
(cd GRRLIB/GRRLIB && make PLATFORM=cube clean all install)
- uses: actions/upload-artifact@master
with:

View file

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

View file

@ -12,16 +12,23 @@ endif
ifeq ($(PLATFORM),cube)
include $(DEVKITPPC)/gamecube_rules
MACHDEP += -DHW_DOL
INSTALL_INC := $(DEVKITPRO)/portlibs/gamecube/include
INSTALL_LIB := $(DEVKITPRO)/portlibs/gamecube/lib
else
include $(DEVKITPPC)/wii_rules
MACHDEP += -DHW_RVL
INSTALL_INC := $(DEVKITPRO)/portlibs/wii/include
INSTALL_LIB := $(DEVKITPRO)/portlibs/wii/lib
endif
NULLSTR :=
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
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)
endif
ifeq ($(PLATFORM),cube)
include $(DEVKITPPC)/gamecube_rules
else
include $(DEVKITPPC)/wii_rules
endif
include $(DEVKITPPC)/base_rules
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
INSTALL_INC := $(DEVKITPRO)/portlibs/ppc/include
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)
LIB := pngu

View file

@ -172,4 +172,3 @@ int PNGU_EncodeFromEFB (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 st
#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:
To install libpngu
To install libpngu:
```bash
c:
cd \grr\GRRLIB\lib\pngu
make clean all install
```
To install libgrrlib:
To install libgrrlib for Wii:
```bash
c:
cd \grr\GRRLIB\GRRLIB
make clean all install
```
To install libgrrlib for GameCube:
```bash
c:
cd \grr\GRRLIB\GRRLIB
make PLATFORM=cube clean all install
```
## Using GRRLIB
After everything is installed, simply put

View file

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