mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-24 14:31:10 +01:00
changes for SD Gecko / DVD support on GameCube (thanks emukidid!)
This commit is contained in:
parent
ff72b9024f
commit
3823996f63
@ -56,6 +56,10 @@ int autoLoadMethod()
|
|||||||
device = DEVICE_SD;
|
device = DEVICE_SD;
|
||||||
else if(ChangeInterface(DEVICE_USB, SILENT))
|
else if(ChangeInterface(DEVICE_USB, SILENT))
|
||||||
device = DEVICE_USB;
|
device = DEVICE_USB;
|
||||||
|
else if(ChangeInterface(DEVICE_SD_SLOTA, SILENT))
|
||||||
|
device = DEVICE_SD_SLOTA;
|
||||||
|
else if(ChangeInterface(DEVICE_SD_SLOTB, SILENT))
|
||||||
|
device = DEVICE_SD_SLOTB;
|
||||||
else if(ChangeInterface(DEVICE_DVD, SILENT))
|
else if(ChangeInterface(DEVICE_DVD, SILENT))
|
||||||
device = DEVICE_DVD;
|
device = DEVICE_DVD;
|
||||||
else if(ChangeInterface(DEVICE_SMB, SILENT))
|
else if(ChangeInterface(DEVICE_SMB, SILENT))
|
||||||
@ -85,6 +89,10 @@ int autoSaveMethod(bool silent)
|
|||||||
device = DEVICE_SD;
|
device = DEVICE_SD;
|
||||||
else if(ChangeInterface(DEVICE_USB, SILENT))
|
else if(ChangeInterface(DEVICE_USB, SILENT))
|
||||||
device = DEVICE_USB;
|
device = DEVICE_USB;
|
||||||
|
else if(ChangeInterface(DEVICE_SD_SLOTA, SILENT))
|
||||||
|
device = DEVICE_SD_SLOTA;
|
||||||
|
else if(ChangeInterface(DEVICE_SD_SLOTB, SILENT))
|
||||||
|
device = DEVICE_SD_SLOTB;
|
||||||
else if(ChangeInterface(DEVICE_SMB, SILENT))
|
else if(ChangeInterface(DEVICE_SMB, SILENT))
|
||||||
device = DEVICE_SMB;
|
device = DEVICE_SMB;
|
||||||
else if(!silent)
|
else if(!silent)
|
||||||
@ -165,10 +173,12 @@ bool IsDeviceRoot(char * path)
|
|||||||
if(path == NULL || path[0] == 0)
|
if(path == NULL || path[0] == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(strcmp(path, "sd:/") == 0 ||
|
if( strcmp(path, "sd:/") == 0 ||
|
||||||
strcmp(path, "usb:/") == 0 ||
|
strcmp(path, "usb:/") == 0 ||
|
||||||
strcmp(path, "dvd:/") == 0 ||
|
strcmp(path, "dvd:/") == 0 ||
|
||||||
strcmp(path, "smb:/") == 0)
|
strcmp(path, "smb:/") == 0 ||
|
||||||
|
strcmp(path, "carda:/") == 0 ||
|
||||||
|
strcmp(path, "cardb:/") == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -536,7 +546,7 @@ int BrowserChangeFolder()
|
|||||||
{
|
{
|
||||||
int device = 0;
|
int device = 0;
|
||||||
FindDevice(browser.dir, &device);
|
FindDevice(browser.dir, &device);
|
||||||
|
|
||||||
if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave
|
if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave
|
||||||
{
|
{
|
||||||
inSz = false;
|
inSz = false;
|
||||||
@ -557,7 +567,8 @@ int BrowserChangeFolder()
|
|||||||
{
|
{
|
||||||
browser.dir[0] = 0;
|
browser.dir[0] = 0;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
AddBrowserEntry();
|
AddBrowserEntry();
|
||||||
sprintf(browserList[i].filename, "sd:/");
|
sprintf(browserList[i].filename, "sd:/");
|
||||||
sprintf(browserList[i].displayname, "SD Card");
|
sprintf(browserList[i].displayname, "SD Card");
|
||||||
@ -576,7 +587,6 @@ int BrowserChangeFolder()
|
|||||||
browserList[i].icon = ICON_USB;
|
browserList[i].icon = ICON_USB;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
|
||||||
AddBrowserEntry();
|
AddBrowserEntry();
|
||||||
sprintf(browserList[i].filename, "smb:/");
|
sprintf(browserList[i].filename, "smb:/");
|
||||||
sprintf(browserList[i].displayname, "Network Share");
|
sprintf(browserList[i].displayname, "Network Share");
|
||||||
@ -585,8 +595,25 @@ int BrowserChangeFolder()
|
|||||||
browserList[i].isdir = 1;
|
browserList[i].isdir = 1;
|
||||||
browserList[i].icon = ICON_SMB;
|
browserList[i].icon = ICON_SMB;
|
||||||
i++;
|
i++;
|
||||||
|
#else
|
||||||
|
AddBrowserEntry();
|
||||||
|
sprintf(browserList[i].filename, "carda:/");
|
||||||
|
sprintf(browserList[i].displayname, "SD Gecko Slot A");
|
||||||
|
browserList[i].length = 0;
|
||||||
|
browserList[i].mtime = 0;
|
||||||
|
browserList[i].isdir = 1;
|
||||||
|
browserList[i].icon = ICON_SD;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
AddBrowserEntry();
|
||||||
|
sprintf(browserList[i].filename, "cardb:/");
|
||||||
|
sprintf(browserList[i].displayname, "SD Gecko Slot B");
|
||||||
|
browserList[i].length = 0;
|
||||||
|
browserList[i].mtime = 0;
|
||||||
|
browserList[i].isdir = 1;
|
||||||
|
browserList[i].icon = ICON_SD;
|
||||||
|
i++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AddBrowserEntry();
|
AddBrowserEntry();
|
||||||
sprintf(browserList[i].filename, "dvd:/");
|
sprintf(browserList[i].filename, "dvd:/");
|
||||||
sprintf(browserList[i].displayname, "Data DVD");
|
sprintf(browserList[i].displayname, "Data DVD");
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN(32);
|
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN(32);
|
||||||
static mutex_t bufferLock = LWP_MUTEX_NULL;
|
static mutex_t bufferLock = LWP_MUTEX_NULL;
|
||||||
FILE * file; // file pointer - the only one we should ever use!
|
FILE * file; // file pointer - the only one we should ever use!
|
||||||
bool unmountRequired[9] = { false, false, false, false, false, false, false, false, false };
|
bool unmountRequired[7] = { false, false, false, false, false, false, false };
|
||||||
bool isMounted[9] = { false, false, false, false, false, false, false, false, false };
|
bool isMounted[7] = { false, false, false, false, false, false, false };
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
const DISC_INTERFACE* sd = &__io_wiisd;
|
const DISC_INTERFACE* sd = &__io_wiisd;
|
||||||
@ -83,6 +83,7 @@ ResumeDeviceThread()
|
|||||||
void
|
void
|
||||||
HaltDeviceThread()
|
HaltDeviceThread()
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
deviceHalt = true;
|
deviceHalt = true;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
@ -93,6 +94,7 @@ HaltDeviceThread()
|
|||||||
// wait for thread to finish
|
// wait for thread to finish
|
||||||
while(!LWP_ThreadIsSuspended(devicethread))
|
while(!LWP_ThreadIsSuspended(devicethread))
|
||||||
usleep(THREAD_SLEEP);
|
usleep(THREAD_SLEEP);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -109,12 +111,14 @@ HaltParseThread()
|
|||||||
usleep(THREAD_SLEEP);
|
usleep(THREAD_SLEEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* devicecallback
|
* devicecallback
|
||||||
*
|
*
|
||||||
* This checks our devices for changes (SD/USB removed) and
|
* This checks our devices for changes (SD/USB removed) and
|
||||||
* initializes the network in the background
|
* initializes the network in the background
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#ifdef HW_RVL
|
||||||
static int devsleep = 1*1000*1000;
|
static int devsleep = 1*1000*1000;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@ -130,7 +134,6 @@ devicecallback (void *arg)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
|
||||||
if(isMounted[DEVICE_SD])
|
if(isMounted[DEVICE_SD])
|
||||||
{
|
{
|
||||||
if(!sd->isInserted()) // check if the device was removed
|
if(!sd->isInserted()) // check if the device was removed
|
||||||
@ -151,24 +154,7 @@ devicecallback (void *arg)
|
|||||||
|
|
||||||
UpdateCheck();
|
UpdateCheck();
|
||||||
InitializeNetwork(SILENT);
|
InitializeNetwork(SILENT);
|
||||||
#else
|
|
||||||
if(isMounted[DEVICE_SD_SLOTA])
|
|
||||||
{
|
|
||||||
if(!carda->isInserted()) // check if the device was removed
|
|
||||||
{
|
|
||||||
unmountRequired[DEVICE_SD_SLOTA] = true;
|
|
||||||
isMounted[DEVICE_SD_SLOTA] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(isMounted[DEVICE_SD_SLOTB])
|
|
||||||
{
|
|
||||||
if(!cardb->isInserted()) // check if the device was removed
|
|
||||||
{
|
|
||||||
unmountRequired[DEVICE_SD_SLOTB] = true;
|
|
||||||
isMounted[DEVICE_SD_SLOTB] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(isMounted[DEVICE_DVD])
|
if(isMounted[DEVICE_DVD])
|
||||||
{
|
{
|
||||||
if(!dvd->isInserted()) // check if the device was removed
|
if(!dvd->isInserted()) // check if the device was removed
|
||||||
@ -190,6 +176,7 @@ devicecallback (void *arg)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
parsecallback (void *arg)
|
parsecallback (void *arg)
|
||||||
@ -212,7 +199,9 @@ parsecallback (void *arg)
|
|||||||
void
|
void
|
||||||
InitDeviceThread()
|
InitDeviceThread()
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
LWP_CreateThread (&devicethread, devicecallback, NULL, NULL, 0, 40);
|
LWP_CreateThread (&devicethread, devicecallback, NULL, NULL, 0, 40);
|
||||||
|
#endif
|
||||||
LWP_CreateThread (&parsethread, parsecallback, NULL, NULL, 0, 80);
|
LWP_CreateThread (&parsethread, parsecallback, NULL, NULL, 0, 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,10 +281,14 @@ static bool MountFAT(int device, int silent)
|
|||||||
if(mounted || silent)
|
if(mounted || silent)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
if(device == DEVICE_SD)
|
if(device == DEVICE_SD)
|
||||||
retry = ErrorPromptRetry("SD card not found!");
|
retry = ErrorPromptRetry("SD card not found!");
|
||||||
else
|
else
|
||||||
retry = ErrorPromptRetry("USB drive not found!");
|
retry = ErrorPromptRetry("USB drive not found!");
|
||||||
|
#else
|
||||||
|
retry = ErrorPromptRetry("SD card not found!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
isMounted[device] = mounted;
|
isMounted[device] = mounted;
|
||||||
@ -370,7 +363,7 @@ bool FindDevice(char * filepath, int * device)
|
|||||||
{
|
{
|
||||||
if(!filepath || filepath[0] == 0)
|
if(!filepath || filepath[0] == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(strncmp(filepath, "sd:", 3) == 0)
|
if(strncmp(filepath, "sd:", 3) == 0)
|
||||||
{
|
{
|
||||||
*device = DEVICE_SD;
|
*device = DEVICE_SD;
|
||||||
@ -381,26 +374,26 @@ bool FindDevice(char * filepath, int * device)
|
|||||||
*device = DEVICE_USB;
|
*device = DEVICE_USB;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(strncmp(filepath, "dvd:", 4) == 0)
|
|
||||||
{
|
|
||||||
*device = DEVICE_DVD;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if(strncmp(filepath, "smb:", 4) == 0)
|
else if(strncmp(filepath, "smb:", 4) == 0)
|
||||||
{
|
{
|
||||||
*device = DEVICE_SMB;
|
*device = DEVICE_SMB;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(strncmp(filepath, "carda:", 5) == 0)
|
else if(strncmp(filepath, "carda:", 6) == 0)
|
||||||
{
|
{
|
||||||
*device = DEVICE_SD_SLOTA;
|
*device = DEVICE_SD_SLOTA;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(strncmp(filepath, "cardb:", 5) == 0)
|
else if(strncmp(filepath, "cardb:", 6) == 0)
|
||||||
{
|
{
|
||||||
*device = DEVICE_SD_SLOTB;
|
*device = DEVICE_SD_SLOTB;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(strncmp(filepath, "dvd:", 4) == 0)
|
||||||
|
{
|
||||||
|
*device = DEVICE_DVD;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,16 +423,23 @@ bool ChangeInterface(int device, bool silent)
|
|||||||
|
|
||||||
switch(device)
|
switch(device)
|
||||||
{
|
{
|
||||||
|
#ifdef HW_RVL
|
||||||
case DEVICE_SD:
|
case DEVICE_SD:
|
||||||
case DEVICE_USB:
|
case DEVICE_USB:
|
||||||
|
#else
|
||||||
|
case DEVICE_SD_SLOTA:
|
||||||
|
case DEVICE_SD_SLOTB:
|
||||||
|
#endif
|
||||||
mounted = MountFAT(device, silent);
|
mounted = MountFAT(device, silent);
|
||||||
break;
|
break;
|
||||||
case DEVICE_DVD:
|
case DEVICE_DVD:
|
||||||
mounted = MountDVD(silent);
|
mounted = MountDVD(silent);
|
||||||
break;
|
break;
|
||||||
|
#ifdef HW_RVL
|
||||||
case DEVICE_SMB:
|
case DEVICE_SMB:
|
||||||
mounted = ConnectShare(silent);
|
mounted = ConnectShare(silent);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return mounted;
|
return mounted;
|
||||||
@ -459,7 +459,7 @@ void CreateAppPath(char * origpath)
|
|||||||
{
|
{
|
||||||
if(!origpath || origpath[0] == 0)
|
if(!origpath || origpath[0] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char * path = strdup(origpath); // make a copy so we don't mess up original
|
char * path = strdup(origpath); // make a copy so we don't mess up original
|
||||||
|
|
||||||
if(!path)
|
if(!path)
|
||||||
@ -506,7 +506,7 @@ bool ParseDirEntries()
|
|||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!AddBrowserEntry())
|
if(!AddBrowserEntry())
|
||||||
{
|
{
|
||||||
i=0;
|
i=0;
|
||||||
@ -538,12 +538,12 @@ bool ParseDirEntries()
|
|||||||
{
|
{
|
||||||
qsort(browserList, browser.numEntries+i, sizeof(BROWSERENTRY), FileSortCallback);
|
qsort(browserList, browser.numEntries+i, sizeof(BROWSERENTRY), FileSortCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to find and select the last loaded file
|
// try to find and select the last loaded file
|
||||||
if(selectLoadedFile == 1 && res != 0 && loadedFile[0] != 0 && browser.dir[0] != 0)
|
if(selectLoadedFile == 1 && res != 0 && loadedFile[0] != 0 && browser.dir[0] != 0)
|
||||||
{
|
{
|
||||||
int indexFound = -1;
|
int indexFound = -1;
|
||||||
|
|
||||||
for(int j=1; j < browser.numEntries + i; j++)
|
for(int j=1; j < browser.numEntries + i; j++)
|
||||||
{
|
{
|
||||||
if(strcmp(browserList[j].filename, loadedFile) == 0)
|
if(strcmp(browserList[j].filename, loadedFile) == 0)
|
||||||
@ -610,7 +610,7 @@ ParseDirectory(bool waitParse)
|
|||||||
if (dirIter == NULL)
|
if (dirIter == NULL)
|
||||||
{
|
{
|
||||||
char * devEnd = strrchr(browser.dir, '/');
|
char * devEnd = strrchr(browser.dir, '/');
|
||||||
|
|
||||||
while(!IsDeviceRoot(browser.dir))
|
while(!IsDeviceRoot(browser.dir))
|
||||||
{
|
{
|
||||||
devEnd[0] = 0; // strip slash
|
devEnd[0] = 0; // strip slash
|
||||||
@ -642,12 +642,12 @@ ParseDirectory(bool waitParse)
|
|||||||
|
|
||||||
parseHalt = false;
|
parseHalt = false;
|
||||||
ParseDirEntries(); // index first 20 entries
|
ParseDirEntries(); // index first 20 entries
|
||||||
|
|
||||||
LWP_ResumeThread(parsethread); // index remaining entries
|
LWP_ResumeThread(parsethread); // index remaining entries
|
||||||
|
|
||||||
if(waitParse) // wait for complete parsing
|
if(waitParse) // wait for complete parsing
|
||||||
{
|
{
|
||||||
ShowAction("Loading...");
|
ShowAction("Loading...");
|
||||||
|
|
||||||
while(!LWP_ThreadIsSuspended(parsethread))
|
while(!LWP_ThreadIsSuspended(parsethread))
|
||||||
usleep(THREAD_SLEEP);
|
usleep(THREAD_SLEEP);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user