MCPcopy Create free account
hub / github.com/dborth/fceugx / autoLoadMethod

Function autoLoadMethod

source/filebrowser.cpp:56–104  ·  view source on GitHub ↗

* autoLoadMethod() * Auto-determines and sets the load device * Returns device set ****************************************************************************/

Source from the content-addressed store, hash-verified

54* Returns device set
55****************************************************************************/
56int 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()

Callers 3

MenuSettingsFunction · 0.85
MenuSettingsFileFunction · 0.85
MainMenuFunction · 0.85

Calls 6

GetDefaultFolderPathFunction · 0.85
ShowActionFunction · 0.85
ChangeInterfaceFunction · 0.85
DirExistsFunction · 0.85
CancelActionFunction · 0.85

Tested by

no test coverage detected