minor menu optimizations

This commit is contained in:
Daryl Borth 2018-08-27 10:42:07 -06:00
parent b4757544c9
commit 23d89dd0d1

View File

@ -87,9 +87,6 @@ static int mapMenuCtrlSNES = 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;
@ -3972,13 +3969,12 @@ static int MenuSettingsNetwork()
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);
@ -4044,14 +4040,13 @@ MainMenu (int menu)
if(currentMenu == MENU_GAMESELECTION) if(currentMenu == MENU_GAMESELECTION)
ResumeGui(); ResumeGui();
// Load preferences if(firstRun) {
if(!LoadPrefs()) if(!LoadPrefs())
SavePrefs(SILENT); SavePrefs(SILENT);
}
#ifdef HW_RVL #ifdef HW_RVL
static bool checkIOS = true; if(firstRun)
if(checkIOS)
{ {
u32 ios = IOS_GetVersion(); u32 ios = IOS_GetVersion();
@ -4060,11 +4055,10 @@ 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
#ifndef NO_SOUND #ifndef NO_SOUND
if(firstRun) {
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG); bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG);
bgMusic->SetVolume(GCSettings.MusicVolume); bgMusic->SetVolume(GCSettings.MusicVolume);
bgMusic->SetLoop(true); bgMusic->SetLoop(true);
@ -4072,9 +4066,14 @@ MainMenu (int menu)
enterSound->SetVolume(GCSettings.SFXVolume); enterSound->SetVolume(GCSettings.SFXVolume);
exitSound = new GuiSound(exit_ogg, exit_ogg_size, SOUND_OGG); exitSound = new GuiSound(exit_ogg, exit_ogg_size, SOUND_OGG);
exitSound->SetVolume(GCSettings.SFXVolume); exitSound->SetVolume(GCSettings.SFXVolume);
if(currentMenu == MENU_GAMESELECTION) bgMusic->Play(); // startup music }
if(currentMenu == MENU_GAMESELECTION)
bgMusic->Play(); // startup music
#endif #endif
firstRun = false;
while(currentMenu != MENU_EXIT || SNESROMSize <= 0) while(currentMenu != MENU_EXIT || SNESROMSize <= 0)
{ {
switch (currentMenu) switch (currentMenu)
@ -4139,17 +4138,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;