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:47:36 +00:00
parent 42e0f52d98
commit e5956294d2
3 changed files with 21 additions and 20 deletions

View File

@ -92,8 +92,16 @@ static void ExitCleanup()
void ExitApp() void ExitApp()
{ {
SavePrefs(SILENT);
if (romLoaded && !ConfigRequested && GCSettings.AutoSave == 1)
SaveRAMAuto(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
{ {
@ -140,18 +148,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
@ -348,6 +350,11 @@ int main(int argc, char *argv[])
ResetVideo_Menu(); ResetVideo_Menu();
break; break;
} }
#ifdef HW_RVL
if(ShutdownRequested)
ExitApp();
#endif
} // emulation loop } // emulation loop
} // main loop } // main loop
} }

View File

@ -533,6 +533,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

@ -287,13 +287,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);
@ -462,6 +456,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
@ -490,6 +487,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
@ -1939,7 +1939,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);
@ -1959,9 +1958,6 @@ static int MenuGameSettings()
} }
} }
if(menu == MENU_GAME)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
@ -3175,9 +3171,6 @@ static int MenuSettings()
} }
} }
if(menu == MENU_GAMESELECTION)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
return menu; return menu;