preferences now only saved on exit, RAM auto-saved on power off from within a game, last browser folder is now remembered

This commit is contained in:
dborth 2009-07-07 04:49:59 +00:00
parent 98625560d4
commit 815f2abd2f
3 changed files with 20 additions and 20 deletions

View File

@ -547,6 +547,7 @@ int BrowserChangeFolder(int method)
return -1; return -1;
CleanupPath(browser.dir); CleanupPath(browser.dir);
strcpy(GCSettings.LoadFolder, browser.dir);
switch (method) switch (method)
{ {

View File

@ -302,13 +302,7 @@ UpdateGUI (void *arg)
Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, i},1); Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, i},1);
Menu_Render(); Menu_Render();
} }
ExitApp();
if(ExitRequested)
ExitApp();
#ifdef HW_RVL
else if(ShutdownRequested)
ShutdownWii();
#endif
} }
} }
usleep(THREAD_SLEEP); usleep(THREAD_SLEEP);
@ -477,6 +471,9 @@ CancelAction()
void void
ShowProgress (const char *msg, int done, int total) ShowProgress (const char *msg, int done, int total)
{ {
if(!mainWindow)
return;
if(total < (256*1024)) if(total < (256*1024))
return; return;
else if(done > total) // this shouldn't happen else if(done > total) // this shouldn't happen
@ -505,6 +502,9 @@ ShowProgress (const char *msg, int done, int total)
void void
ShowAction (const char *msg) ShowAction (const char *msg)
{ {
if(!mainWindow)
return;
if(showProgress != 0) if(showProgress != 0)
CancelAction(); // wait for previous progress window to finish CancelAction(); // wait for previous progress window to finish
@ -1950,7 +1950,6 @@ static int MenuGameSettings()
else if(closeBtn.GetState() == STATE_CLICKED) else if(closeBtn.GetState() == STATE_CLICKED)
{ {
menu = MENU_EXIT; menu = MENU_EXIT;
SavePrefs(NOTSILENT);
exitSound->Play(); exitSound->Play();
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15); bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
@ -1970,9 +1969,6 @@ static int MenuGameSettings()
} }
} }
if(menu == MENU_GAME)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
return menu; return menu;
@ -3214,9 +3210,6 @@ static int MenuSettings()
} }
} }
if(menu == MENU_GAMESELECTION)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
return menu; return menu;

View File

@ -94,8 +94,16 @@ void ExitCleanup()
void ExitApp() void ExitApp()
{ {
SavePrefs(SILENT);
if (SNESROMSize > 0 && !ConfigRequested && GCSettings.AutoSave == 1)
SaveSRAMAuto(GCSettings.SaveMethod, SILENT);
ExitCleanup(); ExitCleanup();
if(ShutdownRequested)
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
#ifdef HW_RVL #ifdef HW_RVL
if(GCSettings.ExitAction == 0) // Auto if(GCSettings.ExitAction == 0) // Auto
{ {
@ -142,18 +150,12 @@ void ExitApp()
#ifdef HW_RVL #ifdef HW_RVL
void ShutdownCB() void ShutdownCB()
{ {
ConfigRequested = 1;
ShutdownRequested = 1; ShutdownRequested = 1;
} }
void ResetCB() void ResetCB()
{ {
ResetRequested = 1; ResetRequested = 1;
} }
void ShutdownWii()
{
ExitCleanup();
SYS_ResetSystem(SYS_POWEROFF, 0, 0);
}
#endif #endif
#ifdef HW_DOL #ifdef HW_DOL
@ -276,6 +278,10 @@ emulate ()
ResetVideo_Menu(); ResetVideo_Menu();
break; break;
} }
#ifdef HW_RVL
if(ShutdownRequested)
ExitApp();
#endif
} // emulation loop } // emulation loop
} // main loop } // main loop
} }