mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-23 19:19: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;
|
||||
char filepath[5][MAXPATHLEN];
|
||||
int numDevices;
|
||||
bool sdMounted = false;
|
||||
bool usbMounted = false;
|
||||
|
||||
#ifdef HW_RVL
|
||||
numDevices = 5;
|
||||
@ -717,13 +719,15 @@ bool LoadPrefs()
|
||||
// rename snes9x to snes9xgx
|
||||
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");
|
||||
}
|
||||
else if(GCSettings.LoadMethod == DEVICE_USB)
|
||||
{
|
||||
if(ChangeInterface(DEVICE_USB, NOTSILENT) && opendir("usb:/snes9x"))
|
||||
rename("usb:/snes9x", "usb:/snes9xgx");
|
||||
usbMounted = ChangeInterface(DEVICE_USB, NOTSILENT);
|
||||
if(usbMounted && opendir("usb:/snes9x"))
|
||||
rename("usb:/snes9x", "usb:/snes9xgx");
|
||||
}
|
||||
else if(GCSettings.LoadMethod == DEVICE_SMB)
|
||||
{
|
||||
@ -751,7 +755,7 @@ bool LoadPrefs()
|
||||
sprintf(GCSettings.ArtworkFolder, "snes9xgx/artwork");
|
||||
|
||||
// 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];
|
||||
sprintf(dirPath, "%s%s", pathPrefix[GCSettings.LoadMethod], GCSettings.ScreenshotsFolder);
|
||||
CreateDirectory(dirPath);
|
||||
@ -774,6 +778,5 @@ bool LoadPrefs()
|
||||
bg_music_size = bg_music_ogg_size;
|
||||
LoadBgMusic();
|
||||
#endif
|
||||
|
||||
return prefFound;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user