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:48:37 +00:00
parent 10c705dc23
commit 014505c37c
3 changed files with 20 additions and 30 deletions

View File

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

@ -284,13 +284,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);
@ -458,6 +452,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
@ -486,6 +483,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
@ -1915,7 +1915,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);
@ -1935,9 +1934,6 @@ static int MenuGameSettings()
} }
} }
if(menu == MENU_GAME)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
return menu; return menu;
@ -3048,9 +3044,6 @@ static int MenuSettings()
} }
} }
if(menu == MENU_GAMESELECTION)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
return menu; return menu;
@ -4160,7 +4153,6 @@ static int MenuPalette()
{ {
menu = MENU_EXIT; menu = MENU_EXIT;
SavePaletteAs(SILENT, RomTitle); SavePaletteAs(SILENT, RomTitle);
SavePrefs(NOTSILENT);
exitSound->Play(); exitSound->Play();
bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15); bgTopImg->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 15);
@ -4181,9 +4173,6 @@ static int MenuPalette()
} }
} }
if(menu == MENU_GAME)
SavePrefs(NOTSILENT);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
return menu; return menu;

View File

@ -82,8 +82,16 @@ static void ExitCleanup()
void ExitApp() void ExitApp()
{ {
SavePrefs(SILENT);
if (ROMLoaded && !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
{ {
@ -130,18 +138,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
@ -265,11 +267,6 @@ int main(int argc, char *argv[])
while(1) // main loop while(1) // main loop
{ {
#ifdef HW_RVL
if(ShutdownRequested)
ShutdownWii();
#endif
// go back to checking if devices were inserted/removed // go back to checking if devices were inserted/removed
// since we're entering the menu // since we're entering the menu
ResumeDeviceThread(); ResumeDeviceThread();
@ -309,12 +306,15 @@ int main(int argc, char *argv[])
emulator.emuReset(); // reset game emulator.emuReset(); // reset game
ResetRequested = 0; ResetRequested = 0;
} }
if(ConfigRequested) if(ConfigRequested)
{ {
ResetVideo_Menu(); ResetVideo_Menu();
break; // leave emulation loop break; // leave emulation loop
} }
#ifdef HW_RVL
if(ShutdownRequested)
ExitApp();
#endif
} // emulation loop } // emulation loop
} // main loop } // main loop
return 0; return 0;