Skip to content

Commit

Permalink
Dynamically apply Serial Port 1 feature bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed May 24, 2024
1 parent 27e124f commit fa05d20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions gc/sdcard/gcsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

#define DEVICE_TYPE_GC_SD (('G'<<24)|('C'<<16)|('S'<<8)|'D')

extern const DISC_INTERFACE __io_gcsda;
extern const DISC_INTERFACE __io_gcsdb;
extern const DISC_INTERFACE __io_gcsd2;
extern DISC_INTERFACE __io_gcsda;
extern DISC_INTERFACE __io_gcsdb;
extern DISC_INTERFACE __io_gcsd2;

#endif
24 changes: 19 additions & 5 deletions libogc/gcsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,19 @@ static bool __gcsd_shutdown(int n)

static bool __gcsda_startup(void)
{
return __gcsd_startup(0);
bool ret;

ret = __gcsd_startup(0);

if(sdgecko_getDevice(0) == EXI_DEVICE_0) {
__io_gcsda.features |= FEATURE_GAMECUBE_SLOTA;
__io_gcsda.features &= ~FEATURE_GAMECUBE_PORT1;
} else {
__io_gcsda.features |= FEATURE_GAMECUBE_PORT1;
__io_gcsda.features &= ~FEATURE_GAMECUBE_SLOTA;
}

return ret;
}

static bool __gcsda_isInserted(void)
Expand Down Expand Up @@ -216,7 +228,7 @@ static bool __gcsd2_shutdown(void)
return __gcsd_shutdown(2);
}

const DISC_INTERFACE __io_gcsda = {
DISC_INTERFACE __io_gcsda = {
DEVICE_TYPE_GC_SD,
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_SLOTA,
__gcsda_startup,
Expand All @@ -226,7 +238,8 @@ const DISC_INTERFACE __io_gcsda = {
__gcsda_clearStatus,
__gcsda_shutdown
};
const DISC_INTERFACE __io_gcsdb = {

DISC_INTERFACE __io_gcsdb = {
DEVICE_TYPE_GC_SD,
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_SLOTB,
__gcsdb_startup,
Expand All @@ -236,7 +249,8 @@ const DISC_INTERFACE __io_gcsdb = {
__gcsdb_clearStatus,
__gcsdb_shutdown
};
const DISC_INTERFACE __io_gcsd2 = {

DISC_INTERFACE __io_gcsd2 = {
DEVICE_TYPE_GC_SD,
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_PORT2,
__gcsd2_startup,
Expand All @@ -245,4 +259,4 @@ const DISC_INTERFACE __io_gcsd2 = {
__gcsd2_writeSectors,
__gcsd2_clearStatus,
__gcsd2_shutdown
} ;
};

0 comments on commit fa05d20

Please sign in to comment.