mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-24 03:29:22 +01:00
Fix a crash when selecting Cancel after removing an SD/USB device and re-opening the app (#1034)
This commit is contained in:
parent
fb4165fb96
commit
3f4f475f01
@ -677,6 +677,8 @@ bool LoadPrefs()
|
|||||||
bool prefFound = false;
|
bool prefFound = false;
|
||||||
char filepath[5][MAXPATHLEN];
|
char filepath[5][MAXPATHLEN];
|
||||||
int numDevices;
|
int numDevices;
|
||||||
|
bool sdMounted = false;
|
||||||
|
bool usbMounted = false;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
numDevices = 5;
|
numDevices = 5;
|
||||||
@ -717,12 +719,14 @@ bool LoadPrefs()
|
|||||||
// rename snes9x to snes9xgx
|
// rename snes9x to snes9xgx
|
||||||
if(GCSettings.LoadMethod == DEVICE_SD)
|
if(GCSettings.LoadMethod == DEVICE_SD)
|
||||||
{
|
{
|
||||||
if(ChangeInterface(DEVICE_SD, NOTSILENT) && opendir("sd:/snes9x"))
|
sdMounted = ChangeInterface(DEVICE_SD, NOTSILENT);
|
||||||
|
if(sdMounted && opendir("sd:/snes9x"))
|
||||||
rename("sd:/snes9x", "sd:/snes9xgx");
|
rename("sd:/snes9x", "sd:/snes9xgx");
|
||||||
}
|
}
|
||||||
else if(GCSettings.LoadMethod == DEVICE_USB)
|
else if(GCSettings.LoadMethod == DEVICE_USB)
|
||||||
{
|
{
|
||||||
if(ChangeInterface(DEVICE_USB, NOTSILENT) && opendir("usb:/snes9x"))
|
usbMounted = ChangeInterface(DEVICE_USB, NOTSILENT);
|
||||||
|
if(usbMounted && opendir("usb:/snes9x"))
|
||||||
rename("usb:/snes9x", "usb:/snes9xgx");
|
rename("usb:/snes9x", "usb:/snes9xgx");
|
||||||
}
|
}
|
||||||
else if(GCSettings.LoadMethod == DEVICE_SMB)
|
else if(GCSettings.LoadMethod == DEVICE_SMB)
|
||||||
@ -751,7 +755,7 @@ bool LoadPrefs()
|
|||||||
sprintf(GCSettings.ArtworkFolder, "snes9xgx/artwork");
|
sprintf(GCSettings.ArtworkFolder, "snes9xgx/artwork");
|
||||||
|
|
||||||
// attempt to create directories if they don't exist
|
// attempt to create directories if they don't exist
|
||||||
if(GCSettings.LoadMethod == DEVICE_SD || GCSettings.LoadMethod == DEVICE_USB) {
|
if((GCSettings.LoadMethod == DEVICE_SD && sdMounted) || (GCSettings.LoadMethod == DEVICE_USB && usbMounted) ) {
|
||||||
char dirPath[MAXPATHLEN];
|
char dirPath[MAXPATHLEN];
|
||||||
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder);
|
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder);
|
||||||
CreateDirectory(dirPath);
|
CreateDirectory(dirPath);
|
||||||
@ -774,6 +778,5 @@ bool LoadPrefs()
|
|||||||
bg_music_size = bg_music_ogg_size;
|
bg_music_size = bg_music_ogg_size;
|
||||||
LoadBgMusic();
|
LoadBgMusic();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return prefFound;
|
return prefFound;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user