diff --git a/source/filebrowser.cpp b/source/filebrowser.cpp index 362b6cf..d9f5151 100644 --- a/source/filebrowser.cpp +++ b/source/filebrowser.cpp @@ -56,6 +56,10 @@ int autoLoadMethod() device = DEVICE_SD; else if(ChangeInterface(DEVICE_USB, SILENT)) 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)) device = DEVICE_DVD; else if(ChangeInterface(DEVICE_SMB, SILENT)) @@ -85,6 +89,10 @@ int autoSaveMethod(bool silent) device = DEVICE_SD; else if(ChangeInterface(DEVICE_USB, SILENT)) 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)) device = DEVICE_SMB; else if(!silent) @@ -165,10 +173,12 @@ bool IsDeviceRoot(char * path) if(path == NULL || path[0] == 0) return false; - if(strcmp(path, "sd:/") == 0 || - strcmp(path, "usb:/") == 0 || - strcmp(path, "dvd:/") == 0 || - strcmp(path, "smb:/") == 0) + if( strcmp(path, "sd:/") == 0 || + strcmp(path, "usb:/") == 0 || + strcmp(path, "dvd:/") == 0 || + strcmp(path, "smb:/") == 0 || + strcmp(path, "carda:/") == 0 || + strcmp(path, "cardb:/") == 0) { return true; } @@ -489,8 +499,7 @@ int BrowserLoadFile() browser.selIndex = 0; BrowserChangeFolder(); } - - ErrorPrompt("Error loading ROM!"); + ErrorPrompt("Error loading game!"); } else { @@ -513,7 +522,7 @@ int BrowserChangeFolder() { int device = 0; FindDevice(browser.dir, &device); - + if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave { inSz = false; @@ -535,6 +544,7 @@ int BrowserChangeFolder() browser.dir[0] = 0; int i=0; +#ifdef HW_RVL AddBrowserEntry(); sprintf(browserList[i].filename, "sd:/"); sprintf(browserList[i].displayname, "SD Card"); @@ -553,7 +563,6 @@ int BrowserChangeFolder() browserList[i].icon = ICON_USB; i++; -#ifdef HW_RVL AddBrowserEntry(); sprintf(browserList[i].filename, "smb:/"); sprintf(browserList[i].displayname, "Network Share"); @@ -562,8 +571,25 @@ int BrowserChangeFolder() browserList[i].isdir = 1; browserList[i].icon = ICON_SMB; 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 - AddBrowserEntry(); sprintf(browserList[i].filename, "dvd:/"); sprintf(browserList[i].displayname, "Data DVD"); diff --git a/source/fileop.cpp b/source/fileop.cpp index fe983a2..e937b61 100644 --- a/source/fileop.cpp +++ b/source/fileop.cpp @@ -38,8 +38,8 @@ unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN(32); static mutex_t bufferLock = LWP_MUTEX_NULL; FILE * file; // file pointer - the only one we should ever use! -bool unmountRequired[9] = { false, false, false, false, false, false, false, false, false }; -bool isMounted[9] = { false, false, false, false, false, false, false, false, false }; +bool unmountRequired[7] = { false, false, false, false, false, false, false }; +bool isMounted[7] = { false, false, false, false, false, false, false }; #ifdef HW_RVL const DISC_INTERFACE* sd = &__io_wiisd; @@ -82,6 +82,7 @@ ResumeDeviceThread() void HaltDeviceThread() { +#ifdef HW_RVL deviceHalt = true; #ifdef HW_RVL @@ -92,6 +93,7 @@ HaltDeviceThread() // wait for thread to finish while(!LWP_ThreadIsSuspended(devicethread)) usleep(THREAD_SLEEP); +#endif } /**************************************************************************** @@ -108,12 +110,14 @@ HaltParseThread() usleep(THREAD_SLEEP); } + /**************************************************************************** * devicecallback * * This checks our devices for changes (SD/USB removed) and * initializes the network in the background ***************************************************************************/ +#ifdef HW_RVL static int devsleep = 1*1000*1000; static void * @@ -129,7 +133,6 @@ devicecallback (void *arg) while (1) { -#ifdef HW_RVL if(isMounted[DEVICE_SD]) { if(!sd->isInserted()) // check if the device was removed @@ -150,24 +153,7 @@ devicecallback (void *arg) UpdateCheck(); 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(!dvd->isInserted()) // check if the device was removed @@ -189,6 +175,7 @@ devicecallback (void *arg) } return NULL; } +#endif static void * parsecallback (void *arg) @@ -211,7 +198,9 @@ parsecallback (void *arg) void InitDeviceThread() { +#ifdef HW_RVL LWP_CreateThread (&devicethread, devicecallback, NULL, NULL, 0, 40); +#endif LWP_CreateThread (&parsethread, parsecallback, NULL, NULL, 0, 80); } @@ -291,10 +280,14 @@ static bool MountFAT(int device, int silent) if(mounted || silent) break; +#ifdef HW_RVL if(device == DEVICE_SD) retry = ErrorPromptRetry("SD card not found!"); else retry = ErrorPromptRetry("USB drive not found!"); +#else + retry = ErrorPromptRetry("SD card not found!"); +#endif } isMounted[device] = mounted; @@ -369,7 +362,7 @@ bool FindDevice(char * filepath, int * device) { if(!filepath || filepath[0] == 0) return false; - + if(strncmp(filepath, "sd:", 3) == 0) { *device = DEVICE_SD; @@ -380,26 +373,26 @@ bool FindDevice(char * filepath, int * device) *device = DEVICE_USB; return true; } - else if(strncmp(filepath, "dvd:", 4) == 0) - { - *device = DEVICE_DVD; - return true; - } else if(strncmp(filepath, "smb:", 4) == 0) { *device = DEVICE_SMB; return true; } - else if(strncmp(filepath, "carda:", 5) == 0) + else if(strncmp(filepath, "carda:", 6) == 0) { *device = DEVICE_SD_SLOTA; return true; } - else if(strncmp(filepath, "cardb:", 5) == 0) + else if(strncmp(filepath, "cardb:", 6) == 0) { *device = DEVICE_SD_SLOTB; return true; } + else if(strncmp(filepath, "dvd:", 4) == 0) + { + *device = DEVICE_DVD; + return true; + } return false; } @@ -429,16 +422,23 @@ bool ChangeInterface(int device, bool silent) switch(device) { +#ifdef HW_RVL case DEVICE_SD: case DEVICE_USB: +#else + case DEVICE_SD_SLOTA: + case DEVICE_SD_SLOTB: +#endif mounted = MountFAT(device, silent); break; case DEVICE_DVD: mounted = MountDVD(silent); break; +#ifdef HW_RVL case DEVICE_SMB: mounted = ConnectShare(silent); break; +#endif } return mounted; @@ -505,7 +505,7 @@ bool ParseDirEntries() i--; continue; } - + if(!AddBrowserEntry()) { i=0; @@ -542,7 +542,7 @@ bool ParseDirEntries() if(selectLoadedFile == 1 && res != 0 && loadedFile[0] != 0 && browser.dir[0] != 0) { int indexFound = -1; - + for(int j=1; j < browser.numEntries + i; j++) { if(strcmp(browserList[j].filename, loadedFile) == 0) @@ -602,14 +602,14 @@ ParseDirectory(bool waitParse) return -1; if(dirIter == NULL) - retry = ErrorPromptRetry("Error opening directory"); + retry = ErrorPromptRetry("Error opening directory!"); } // if we can't open the dir, try higher levels if (dirIter == NULL) { char * devEnd = strrchr(browser.dir, '/'); - + while(!IsDeviceRoot(browser.dir)) { devEnd[0] = 0; // strip slash @@ -641,12 +641,12 @@ ParseDirectory(bool waitParse) parseHalt = false; ParseDirEntries(); // index first 20 entries + LWP_ResumeThread(parsethread); // index remaining entries if(waitParse) // wait for complete parsing { - ShowAction("Loading..."); - + ShowAction("Loading..."); while(!LWP_ThreadIsSuspended(parsethread)) usleep(THREAD_SLEEP);