add support for serial port 2 (SP2 / SD2SP2) on Gamecube

This commit is contained in:
Daryl Borth 2020-03-13 13:51:16 -06:00
parent af1ebd587c
commit 683fd17219
5 changed files with 40 additions and 7 deletions

View File

@ -65,6 +65,8 @@ int autoLoadMethod()
device = DEVICE_SD_SLOTA;
else if(ChangeInterface(DEVICE_SD_SLOTB, SILENT))
device = DEVICE_SD_SLOTB;
else if(ChangeInterface(DEVICE_SD_PORT2, SILENT))
device = DEVICE_SD_PORT2;
else if(ChangeInterface(DEVICE_DVD, SILENT))
device = DEVICE_DVD;
else if(ChangeInterface(DEVICE_SMB, SILENT))
@ -98,6 +100,8 @@ int autoSaveMethod(bool silent)
device = DEVICE_SD_SLOTA;
else if(ChangeInterface(DEVICE_SD_SLOTB, SILENT))
device = DEVICE_SD_SLOTB;
else if(ChangeInterface(DEVICE_SD_PORT2, SILENT))
device = DEVICE_SD_PORT2;
else if(ChangeInterface(DEVICE_SMB, SILENT))
device = DEVICE_SMB;
else if(!silent)
@ -167,7 +171,8 @@ bool IsDeviceRoot(char * path)
strcmp(path, "dvd:/") == 0 ||
strcmp(path, "smb:/") == 0 ||
strcmp(path, "carda:/") == 0 ||
strcmp(path, "cardb:/") == 0)
strcmp(path, "cardb:/") == 0 ||
strcmp(path, "port2:/") == 0)
{
return true;
}
@ -601,6 +606,14 @@ int BrowserChangeFolder()
browserList[i].isdir = 1;
browserList[i].icon = ICON_SD;
i++;
AddBrowserEntry();
sprintf(browserList[i].filename, "port2:/");
sprintf(browserList[i].displayname, "SD in SP2");
browserList[i].length = 0;
browserList[i].isdir = 1;
browserList[i].icon = ICON_SD;
i++;
#endif
AddBrowserEntry();
sprintf(browserList[i].filename, "smb:/");

View File

@ -44,8 +44,8 @@ unsigned char *savebuffer = NULL;
u8 *ext_font_ttf = NULL;
static mutex_t bufferLock = LWP_MUTEX_NULL;
FILE * file; // file pointer - the only one we should ever use!
bool unmountRequired[7] = { false, false, false, false, false, false, false };
bool isMounted[7] = { false, false, false, false, false, false, false };
bool unmountRequired[8] = { false, false, false, false, false, false, false, false };
bool isMounted[8] = { false, false, false, false, false, false, false, false };
#ifdef HW_RVL
const DISC_INTERFACE* sd = &__io_wiisd;
@ -54,6 +54,7 @@ bool isMounted[7] = { false, false, false, false, false, false, false };
#else
const DISC_INTERFACE* carda = &__io_gcsda;
const DISC_INTERFACE* cardb = &__io_gcsdb;
const DISC_INTERFACE* port2 = &__io_gcsd2;
const DISC_INTERFACE* dvd = &__io_gcdvd;
#endif
@ -206,6 +207,7 @@ void UnmountAllFAT()
#else
fatUnmount("carda:");
fatUnmount("cardb:");
fatUnmount("port2:");
#endif
}
@ -243,12 +245,16 @@ static bool MountFAT(int device, int silent)
sprintf(name2, "carda:");
disc = carda;
break;
case DEVICE_SD_SLOTB:
sprintf(name, "cardb");
sprintf(name2, "cardb:");
disc = cardb;
break;
case DEVICE_SD_PORT2:
sprintf(name, "port2");
sprintf(name2, "port2:");
disc = port2;
break;
#endif
default:
return false; // unknown device
@ -370,6 +376,11 @@ bool FindDevice(char * filepath, int * device)
*device = DEVICE_SD_SLOTB;
return true;
}
else if(strncmp(filepath, "port2:", 6) == 0)
{
*device = DEVICE_SD_PORT2;
return true;
}
else if(strncmp(filepath, "dvd:", 4) == 0)
{
*device = DEVICE_DVD;
@ -410,6 +421,7 @@ bool ChangeInterface(int device, bool silent)
#else
case DEVICE_SD_SLOTA:
case DEVICE_SD_SLOTB:
case DEVICE_SD_PORT2:
#endif
mounted = MountFAT(device, silent);
break;

View File

@ -3646,6 +3646,10 @@ static int MenuSettingsFile()
GCSettings.LoadMethod++;
if(GCSettings.SaveMethod == DEVICE_SD_SLOTB)
GCSettings.SaveMethod++;
if(GCSettings.LoadMethod == DEVICE_SD_PORT2)
GCSettings.LoadMethod++;
if(GCSettings.SaveMethod == DEVICE_SD_PORT2)
GCSettings.SaveMethod++;
#endif
// correct load/save methods out of bounds
@ -3661,6 +3665,7 @@ static int MenuSettingsFile()
else if (GCSettings.LoadMethod == DEVICE_SMB) sprintf (options.value[0],"Network");
else if (GCSettings.LoadMethod == DEVICE_SD_SLOTA) sprintf (options.value[0],"SD Gecko Slot A");
else if (GCSettings.LoadMethod == DEVICE_SD_SLOTB) sprintf (options.value[0],"SD Gecko Slot B");
else if (GCSettings.LoadMethod == DEVICE_SD_PORT2) sprintf (options.value[0],"SD in SP2");
if (GCSettings.SaveMethod == DEVICE_AUTO) sprintf (options.value[1],"Auto Detect");
else if (GCSettings.SaveMethod == DEVICE_SD) sprintf (options.value[1],"SD");
@ -3668,6 +3673,7 @@ static int MenuSettingsFile()
else if (GCSettings.SaveMethod == DEVICE_SMB) sprintf (options.value[1],"Network");
else if (GCSettings.SaveMethod == DEVICE_SD_SLOTA) sprintf (options.value[1],"SD Gecko Slot A");
else if (GCSettings.SaveMethod == DEVICE_SD_SLOTB) sprintf (options.value[1],"SD Gecko Slot B");
else if (GCSettings.SaveMethod == DEVICE_SD_PORT2) sprintf (options.value[1],"SD in SP2");
snprintf (options.value[2], 35, "%s", GCSettings.LoadFolder);
snprintf (options.value[3], 35, "%s", GCSettings.SaveFolder);

View File

@ -816,9 +816,10 @@ bool LoadPrefs()
sprintf(filepath[3], "sd:/%s", APPFOLDER);
sprintf(filepath[4], "usb:/%s", APPFOLDER);
#else
numDevices = 2;
numDevices = 3;
sprintf(filepath[0], "carda:/%s", APPFOLDER);
sprintf(filepath[1], "cardb:/%s", APPFOLDER);
sprintf(filepath[2], "port2:/%s", APPFOLDER);
#endif
for(int i=0; i<numDevices; i++)

View File

@ -26,7 +26,7 @@
#define SILENT 1
const char pathPrefix[9][8] =
{ "", "sd:/", "usb:/", "dvd:/", "smb:/", "carda:/", "cardb:/" };
{ "", "sd:/", "usb:/", "dvd:/", "smb:/", "carda:/", "cardb:/", "port2:/" };
enum
{
@ -36,7 +36,8 @@ enum
DEVICE_DVD,
DEVICE_SMB,
DEVICE_SD_SLOTA,
DEVICE_SD_SLOTB
DEVICE_SD_SLOTB,
DEVICE_SD_PORT2
};
enum