speed up returning to menu from in-game

This commit is contained in:
Daryl Borth 2018-08-27 10:40:21 -06:00
parent b861ecb77b
commit b738b86176

View File

@ -71,9 +71,6 @@ static int mapMenuCtrl = 0;
static lwp_t guithread = LWP_THREAD_NULL; static lwp_t guithread = LWP_THREAD_NULL;
static lwp_t progressthread = LWP_THREAD_NULL; static lwp_t progressthread = LWP_THREAD_NULL;
#ifdef HW_RVL
static lwp_t updatethread = LWP_THREAD_NULL;
#endif
static bool guiHalt = true; static bool guiHalt = true;
static int showProgress = 0; static int showProgress = 0;
@ -4590,13 +4587,12 @@ static int MenuPalette()
void void
MainMenu (int menu) MainMenu (int menu)
{ {
static bool init = false; static bool firstRun = true;
int currentMenu = menu; int currentMenu = menu;
lastMenu = MENU_NONE; lastMenu = MENU_NONE;
if(!init) if(firstRun)
{ {
init = true;
#ifdef HW_RVL #ifdef HW_RVL
pointer[0] = new GuiImageData(player1_point_png); pointer[0] = new GuiImageData(player1_point_png);
pointer[1] = new GuiImageData(player2_point_png); pointer[1] = new GuiImageData(player2_point_png);
@ -4662,14 +4658,14 @@ MainMenu (int menu)
if(currentMenu == MENU_GAMESELECTION) if(currentMenu == MENU_GAMESELECTION)
ResumeGui(); ResumeGui();
// Load preferences if(firstRun) {
if(!LoadPrefs()) // Load preferences
SavePrefs(SILENT); if(!LoadPrefs())
SavePrefs(SILENT);
}
#ifdef HW_RVL #ifdef HW_RVL
static bool checkIOS = true; if(firstRun)
if(checkIOS)
{ {
u32 ios = IOS_GetVersion(); u32 ios = IOS_GetVersion();
@ -4678,24 +4674,29 @@ MainMenu (int menu)
else if(!SaneIOS(ios)) else if(!SaneIOS(ios))
ErrorPrompt("The current IOS has been altered (fake-signed). Functionality and/or stability may be adversely affected."); ErrorPrompt("The current IOS has been altered (fake-signed). Functionality and/or stability may be adversely affected.");
} }
checkIOS = false;
#endif #endif
// Load palettes
LoadPalettes();
#ifndef NO_SOUND #ifndef NO_SOUND
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG); if(firstRun) {
bgMusic->SetVolume(GCSettings.MusicVolume); bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG);
bgMusic->SetLoop(true); bgMusic->SetVolume(GCSettings.MusicVolume);
enterSound = new GuiSound(enter_ogg, enter_ogg_size, SOUND_OGG); bgMusic->SetLoop(true);
enterSound->SetVolume(GCSettings.SFXVolume); enterSound = new GuiSound(enter_ogg, enter_ogg_size, SOUND_OGG);
exitSound = new GuiSound(exit_ogg, exit_ogg_size, SOUND_OGG); enterSound->SetVolume(GCSettings.SFXVolume);
exitSound->SetVolume(GCSettings.SFXVolume); exitSound = new GuiSound(exit_ogg, exit_ogg_size, SOUND_OGG);
if(currentMenu == MENU_GAMESELECTION) bgMusic->Play(); // startup music exitSound->SetVolume(GCSettings.SFXVolume);
}
if(currentMenu == MENU_GAMESELECTION)
bgMusic->Play(); // startup music
#endif #endif
if(firstRun) {
LoadPalettes();
}
firstRun = false;
while(currentMenu != MENU_EXIT || !ROMLoaded) while(currentMenu != MENU_EXIT || !ROMLoaded)
{ {
switch (currentMenu) switch (currentMenu)
@ -4760,17 +4761,6 @@ MainMenu (int menu)
CancelAction(); CancelAction();
HaltGui(); HaltGui();
#ifdef HW_RVL
if(updatethread != LWP_THREAD_NULL)
LWP_JoinThread(updatethread, NULL);
#endif
#ifndef NO_SOUND
delete bgMusic;
delete enterSound;
delete exitSound;
#endif
delete btnLogo; delete btnLogo;
delete gameScreenImg; delete gameScreenImg;
delete bgTopImg; delete bgTopImg;