From 815f2abd2f0cee34fc674ae4c130a065260c73d7 Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 7 Jul 2009 04:49:59 +0000 Subject: [PATCH] preferences now only saved on exit, RAM auto-saved on power off from within a game, last browser folder is now remembered --- source/ngc/filebrowser.cpp | 1 + source/ngc/menu.cpp | 21 +++++++-------------- source/ngc/snes9xGX.cpp | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index 1b3ab43..60ea335 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -547,6 +547,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 ab5c798..3c6039e 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -302,13 +302,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); @@ -477,6 +471,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 @@ -505,6 +502,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 @@ -1950,7 +1950,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); @@ -1970,9 +1969,6 @@ static int MenuGameSettings() } } - if(menu == MENU_GAME) - SavePrefs(NOTSILENT); - HaltGui(); mainWindow->Remove(&w); return menu; @@ -3214,9 +3210,6 @@ static int MenuSettings() } } - if(menu == MENU_GAMESELECTION) - SavePrefs(NOTSILENT); - HaltGui(); mainWindow->Remove(&w); return menu; diff --git a/source/ngc/snes9xGX.cpp b/source/ngc/snes9xGX.cpp index 52c1171..72d14bf 100644 --- a/source/ngc/snes9xGX.cpp +++ b/source/ngc/snes9xGX.cpp @@ -94,8 +94,16 @@ void ExitCleanup() void ExitApp() { + SavePrefs(SILENT); + + if (SNESROMSize > 0 && !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 { @@ -142,18 +150,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 @@ -276,6 +278,10 @@ emulate () ResetVideo_Menu(); break; } + #ifdef HW_RVL + if(ShutdownRequested) + ExitApp(); + #endif } // emulation loop } // main loop }