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