From c6b20d0bfaf47ca4c3c7e4204fbd31d892b4bc44 Mon Sep 17 00:00:00 2001 From: Extrems Date: Mon, 5 Jan 2026 21:49:12 -0500 Subject: [PATCH] Migrated GameCube port to libogc2 --- Makefiles/Makefile_gc | 8 ++--- src/config.c | 72 ++----------------------------------------- src/general.c | 2 +- 3 files changed, 7 insertions(+), 75 deletions(-) diff --git a/Makefiles/Makefile_gc b/Makefiles/Makefile_gc index 7e8d8c6..06dadeb 100644 --- a/Makefiles/Makefile_gc +++ b/Makefiles/Makefile_gc @@ -12,7 +12,7 @@ ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") endif -include $(DEVKITPPC)/gamecube_rules +include $(DEVKITPRO)/libogc2/gamecube_rules #--------------------------------------------------------------------------------- # TARGET is the name of the output @@ -31,7 +31,7 @@ INCLUDES := src src/fonts src/audio # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = `$(PREFIX)pkg-config --cflags sdl2 SDL2_ttf SDL2_mixer freetype2` -g -O2 -Wall $(MACHDEP) $(INCLUDE) -DGAMECUBE -DFORCE_DRAW_BG -DFORCE_DRAW_OVERLAY +CFLAGS = `$(PREFIX)pkg-config --cflags sdl2 SDL2_ttf SDL2_mixer` -g -O2 -Wall $(MACHDEP) $(INCLUDE) -DGAMECUBE -DFORCE_DRAW_BG -DFORCE_DRAW_OVERLAY CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map @@ -39,13 +39,13 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := `$(PREFIX)pkg-config --libs sdl2 SDL2_ttf SDL2_mixer freetype2` -lfat -logc -lm -lopus +LIBS := `$(PREFIX)pkg-config --libs sdl2 SDL2_ttf SDL2_mixer` -lfat -logc -lm #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := "$(DEVKITPRO)/portlibs/ppc" "$(DEVKITPRO)/portlibs/gamecube" +LIBDIRS := $(PORTLIBS) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional diff --git a/src/config.c b/src/config.c index e900816..129743e 100644 --- a/src/config.c +++ b/src/config.c @@ -3,7 +3,7 @@ #include #if defined(_WIN32) #include -#elif defined(LINUX) || defined(GAMECUBE) || defined(THREEDS) +#elif defined(LINUX) || defined(THREEDS) #include #endif #if defined(WII_U) @@ -75,63 +75,6 @@ char* getExeDirectory(void) { } } -#if defined(GAMECUBE) -#include -#include -#include -#include - -static bool directoryExists(const char *path) { - struct stat info; - if (stat(path, &info) != 0) { - // Path does not exist or cannot be accessed - return false; - } - return (info.st_mode & S_IFDIR) != 0; // Check if it's a directory -} - -#define DEV_GCSDA 1 -#define DEV_GCSDB 2 -#define DEV_GCSDC 3 - -static bool gc_initFAT(int device) { - switch (device) { - case DEV_GCSDA: - __io_gcsda.startup(); - if (!__io_gcsda.isInserted()) { - return false; - } - if (!fatMountSimple("sda", &__io_gcsda)) { - return false; - } - break; - case DEV_GCSDB: - __io_gcsdb.startup(); - if (!__io_gcsdb.isInserted()) { - return false; - } - if (!fatMountSimple("sdb", &__io_gcsdb)) { - return false; - } - break; - case DEV_GCSDC: - __io_gcsd2.startup(); - if (!__io_gcsd2.isInserted()) { - return false; - } - if (!fatMountSimple("sdc", &__io_gcsd2)) { - return false; - } - break; - default: - return false; - break; - } - - return true; -} -#endif - void initFilePaths() { #if defined(VITA) snprintf(rootDir, sizeof(rootDir), "ux0:data/BlockamokRemix/"); @@ -143,18 +86,7 @@ void initFilePaths() { #elif defined(WII) snprintf(rootDir, sizeof(rootDir), "sd:/apps/BlockamokRemix/"); #elif defined(GAMECUBE) - for (int i = 1; i < 4; i++) { - if (gc_initFAT(i)) { - break; - } - } - const char *devices[] = { "sda", "sdb", "sdc" }; - for (int i = 0; i < 3; i++) { - snprintf(rootDir, sizeof(rootDir), "%s:/BlockamokRemix/", devices[i]); - if (directoryExists(rootDir)) { - break; - } - } + snprintf(rootDir, sizeof(rootDir), "/BlockamokRemix/"); #elif defined(THREEDS) snprintf(rootDir, sizeof(rootDir), "sdmc:/3ds/BlockamokRemix/"); #elif defined(_WIN32) diff --git a/src/general.c b/src/general.c index 2839001..cb01fb1 100644 --- a/src/general.c +++ b/src/general.c @@ -9,7 +9,7 @@ void systemSpecificOpen() { #elif defined(SWITCH) /* Set SD Card mount path */ chdir("/switch/BlockamokRemix"); -#elif defined(WII) +#elif defined(WII) || defined(GAMECUBE) /* Initialize SD Card */ fatInitDefault(); /* Initialize Controller */