diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index de3bc38..7bf2e64 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -515,6 +515,7 @@ int BrowserChangeFolder(int method) return -1; CleanupPath(browser.dir); + strcpy(GCSettings.LoadFolder, browser.dir); switch (method) { diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 91032a0..9a72a07 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -284,13 +284,7 @@ UpdateGUI (void *arg) Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, i},1); Menu_Render(); } - - if(ExitRequested) - ExitApp(); - #ifdef HW_RVL - else if(ShutdownRequested) - ShutdownWii(); - #endif + ExitApp(); } } usleep(THREAD_SLEEP); @@ -458,6 +452,9 @@ CancelAction() void ShowProgress (const char *msg, int done, int total) { + if(!mainWindow) + return; + if(total < (256*1024)) return; else if(done > total) // this shouldn't happen @@ -486,6 +483,9 @@ ShowProgress (const char *msg, int done, int total) void ShowAction (const char *msg) { + if(!mainWindow) + return; + if(showProgress != 0) CancelAction(); // wait for previous progress window to finish @@ -1915,7 +1915,6 @@ static int MenuGameSettings() else if(closeBtn.GetState() == STATE_CLICKED) { menu = MENU_EXIT; - SavePrefs(NOTSILENT); exitSound->Play(); bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15); @@ -1935,9 +1934,6 @@ static int MenuGameSettings() } } - if(menu == MENU_GAME) - SavePrefs(NOTSILENT); - HaltGui(); mainWindow->Remove(&w); return menu; @@ -3048,9 +3044,6 @@ static int MenuSettings() } } - if(menu == MENU_GAMESELECTION) - SavePrefs(NOTSILENT); - HaltGui(); mainWindow->Remove(&w); return menu; @@ -4160,7 +4153,6 @@ static int MenuPalette() { menu = MENU_EXIT; SavePaletteAs(SILENT, RomTitle); - SavePrefs(NOTSILENT); exitSound->Play(); bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15); @@ -4181,9 +4173,6 @@ static int MenuPalette() } } - if(menu == MENU_GAME) - SavePrefs(NOTSILENT); - HaltGui(); mainWindow->Remove(&w); return menu; diff --git a/source/ngc/vba.cpp b/source/ngc/vba.cpp index 99264d9..805cf46 100644 --- a/source/ngc/vba.cpp +++ b/source/ngc/vba.cpp @@ -82,8 +82,16 @@ static void ExitCleanup() void ExitApp() { + SavePrefs(SILENT); + + if (ROMLoaded && !ConfigRequested && GCSettings.AutoSave == 1) + SaveSRAMAuto(GCSettings.SaveMethod, SILENT); + ExitCleanup(); + if(ShutdownRequested) + SYS_ResetSystem(SYS_POWEROFF, 0, 0); + #ifdef HW_RVL if(GCSettings.ExitAction == 0) // Auto { @@ -130,18 +138,12 @@ void ExitApp() #ifdef HW_RVL void ShutdownCB() { - ConfigRequested = 1; ShutdownRequested = 1; } void ResetCB() { ResetRequested = 1; } -void ShutdownWii() -{ - ExitCleanup(); - SYS_ResetSystem(SYS_POWEROFF, 0, 0); -} #endif #ifdef HW_DOL @@ -265,11 +267,6 @@ int main(int argc, char *argv[]) while(1) // main loop { - #ifdef HW_RVL - if(ShutdownRequested) - ShutdownWii(); - #endif - // go back to checking if devices were inserted/removed // since we're entering the menu ResumeDeviceThread(); @@ -309,12 +306,15 @@ int main(int argc, char *argv[]) emulator.emuReset(); // reset game ResetRequested = 0; } - if(ConfigRequested) { ResetVideo_Menu(); break; // leave emulation loop } + #ifdef HW_RVL + if(ShutdownRequested) + ExitApp(); + #endif } // emulation loop } // main loop return 0;