* autoLoadMethod() * Auto-determines and sets the load device * Returns device set ****************************************************************************/
| 54 | * Returns device set |
| 55 | ****************************************************************************/ |
| 56 | int autoLoadMethod(bool silent) |
| 57 | { |
| 58 | if(GCSettings.LoadMethod > DEVICE_AUTO) { |
| 59 | return GCSettings.LoadMethod; |
| 60 | } |
| 61 | |
| 62 | char defaultFolderPath[MAXPATHLEN]; |
| 63 | char fullPath[MAXPATHLEN]; |
| 64 | int device = DEVICE_AUTO; |
| 65 | |
| 66 | GetDefaultFolderPath(defaultFolderPath, loadFolder[LOADFOLDER_ROMS].name); |
| 67 | |
| 68 | if(!silent) |
| 69 | ShowAction ("Attempting to determine load device..."); |
| 70 | |
| 71 | #ifdef HW_RVL |
| 72 | int deviceCount = 4; |
| 73 | int devices[deviceCount] = { DEVICE_SD, DEVICE_USB, DEVICE_DVD, DEVICE_SMB }; |
| 74 | #else |
| 75 | int deviceCount = 6; |
| 76 | int devices[deviceCount] = { DEVICE_SD_SLOTA, DEVICE_SD_SLOTB, DEVICE_SD_PORT2, DEVICE_SD_GCLOADER, DEVICE_DVD, DEVICE_SMB }; |
| 77 | #endif |
| 78 | |
| 79 | // look for default roms folder first |
| 80 | for (int i = 0; i < deviceCount; i++) { |
| 81 | if (ChangeInterface(devices[i], SILENT)) { |
| 82 | MakeFilePathForFolderPath(fullPath, devices[i], defaultFolderPath); |
| 83 | |
| 84 | if(DirExists(fullPath)) { |
| 85 | device = devices[i]; |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // set to first connected device instead |
| 92 | if(device == DEVICE_AUTO) { |
| 93 | for (int i = 0; i < deviceCount; i++) { |
| 94 | if (ChangeInterface(devices[i], SILENT)) { |
| 95 | device = devices[i]; |
| 96 | break; |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | GCSettings.LoadMethod = device; // load device found for later use |
| 102 | CancelAction(); |
| 103 | return device; |
| 104 | } |
| 105 | |
| 106 | /**************************************************************************** |
| 107 | * autoSaveMethod() |
no test coverage detected