Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefiles/Makefile_gc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

include $(DEVKITPPC)/gamecube_rules
include $(DEVKITPRO)/libogc2/gamecube_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
Expand All @@ -31,21 +31,21 @@ 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

#---------------------------------------------------------------------------------
# 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
Expand Down
72 changes: 2 additions & 70 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string.h>
#if defined(_WIN32)
#include <windows.h>
#elif defined(LINUX) || defined(GAMECUBE) || defined(THREEDS)
#elif defined(LINUX) || defined(THREEDS)
#include <sys/stat.h>
#endif
#if defined(WII_U)
Expand Down Expand Up @@ -75,63 +75,6 @@ char* getExeDirectory(void) {
}
}

#if defined(GAMECUBE)
#include <gccore.h>
#include <dirent.h>
#include <fat.h>
#include <sdcard/gcsd.h>

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/");
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down