-cleaned up that exit to code

This commit is contained in:
fix94.1 2012-09-09 18:35:15 +00:00
parent 13e2493b19
commit 4e345b651f
28 changed files with 142 additions and 215 deletions

View File

@ -1045,7 +1045,7 @@ extern "C" { extern s32 MagicPatches(s32); }
void Nand::Init_ISFS() void Nand::Init_ISFS()
{ {
gprintf("Init ISFS\n"); //gprintf("Init ISFS\n");
ISFS_Initialize(); ISFS_Initialize();
if(AHBRPOT_Patched()) if(AHBRPOT_Patched())
{ {
@ -1061,7 +1061,7 @@ void Nand::Init_ISFS()
void Nand::DeInit_ISFS(bool KeepPatches) void Nand::DeInit_ISFS(bool KeepPatches)
{ {
gprintf("Deinit ISFS\n"); //gprintf("Deinit ISFS\n");
if(AHBRPOT_Patched()) if(AHBRPOT_Patched())
{ {
// Disable memory protection // Disable memory protection

View File

@ -100,7 +100,7 @@ private:
float m_vpW; float m_vpW;
float m_vpH; float m_vpH;
float m_waitMessageDelay; float m_waitMessageDelay;
bool m_showWaitMessage; volatile bool m_showWaitMessage;
volatile bool m_showingWaitMessages; volatile bool m_showingWaitMessages;
vector<STexture> m_waitMessages; vector<STexture> m_waitMessages;
// //

View File

@ -52,7 +52,7 @@ void Close_Inputs(void)
u32 cnt; u32 cnt;
/* Disconnect Wiimotes */ /* Disconnect Wiimotes */
for (cnt = 0; cnt < 4; cnt++) for(cnt = 0; cnt < 4; cnt++)
WPAD_Disconnect(cnt); WPAD_Disconnect(cnt);
/* Shutdown Wiimote subsystem */ /* Shutdown Wiimote subsystem */
@ -68,22 +68,11 @@ void Sys_Shutdown(void)
{ {
/* via hollywood registers first */ /* via hollywood registers first */
*HW_GPIO_OUT |= (1<<1); *HW_GPIO_OUT |= (1<<1);
usleep(50000);
/* If it failed just do the libogc way */ /* If it failed just do the libogc way */
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
} }
void Sys_Test(void)
{
if(reset || shutdown)
{
Close_Inputs();
if(reset)
SYS_ResetSystem(SYS_RESTART, 0, 0);
else
Sys_Shutdown();
}
}
int Sys_GetExitTo(void) int Sys_GetExitTo(void)
{ {
return ExitOption; return ExitOption;
@ -129,8 +118,11 @@ void Sys_Exit(void)
WII_LaunchTitle(HBC_JODI); WII_LaunchTitle(HBC_JODI);
WII_LaunchTitle(HBC_HAXX); WII_LaunchTitle(HBC_HAXX);
} }
//else boot system menu else if(ExitOption == BUTTON_CALLBACK)
Sys_LoadMenu(); Sys_Shutdown();
/* else Return to Menu */
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
exit(1);
} }
void __Sys_ResetCallback(void) void __Sys_ResetCallback(void)
@ -150,12 +142,6 @@ void Sys_Init(void)
SYS_SetPowerCallback(__Sys_PowerCallback); SYS_SetPowerCallback(__Sys_PowerCallback);
} }
void Sys_LoadMenu(void)
{
/* Return to the Wii system menu */
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
bool AHBRPOT_Patched(void) bool AHBRPOT_Patched(void)
{ {
return (*HW_AHBPROT == 0xFFFFFFFF); return (*HW_AHBPROT == 0xFFFFFFFF);

View File

@ -23,13 +23,13 @@ enum
EXIT_TO_DISABLE, EXIT_TO_DISABLE,
EXIT_TO_BOOTMII, EXIT_TO_BOOTMII,
EXIT_TO_NEEK2O, EXIT_TO_NEEK2O,
BUTTON_CALLBACK,
}; };
/* Prototypes */ /* Prototypes */
void Sys_Init(void); void Sys_Init(void);
void Sys_LoadMenu(void); void Sys_Shutdown(void);
bool Sys_Exiting(void); bool Sys_Exiting(void);
void Sys_Test(void);
void Sys_Exit(void); void Sys_Exit(void);
void Sys_ExitTo(int); void Sys_ExitTo(int);
int Sys_GetExitTo(void); int Sys_GetExitTo(void);

View File

@ -131,6 +131,5 @@ int main(int argc, char **argv)
mainMenu->cleanup(); mainMenu->cleanup();
ShutdownBeforeExit(); ShutdownBeforeExit();
Sys_Exit(); Sys_Exit();
exit(1);
return 0; return 0;
} }

View File

@ -446,8 +446,6 @@ void CMenu::init(void)
m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true)); m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true));
int exit_to = m_cfg.getInt("GENERAL", "exit_to", 0); int exit_to = m_cfg.getInt("GENERAL", "exit_to", 0);
m_disable_exit = exit_to == EXIT_TO_DISABLE;
if(exit_to == EXIT_TO_BOOTMII && (!DeviceHandler::Instance()->IsInserted(SD) || if(exit_to == EXIT_TO_BOOTMII && (!DeviceHandler::Instance()->IsInserted(SD) ||
stat(fmt("%s:/bootmii/armboot.bin",DeviceName[SD]), &dummy) != 0 || stat(fmt("%s:/bootmii/armboot.bin",DeviceName[SD]), &dummy) != 0 ||
stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) != 0)) stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) != 0))
@ -1786,7 +1784,7 @@ void CMenu::_initCF(void)
m_cf.startCoverLoader(); m_cf.startCoverLoader();
} }
void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting) void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
{ {
if(withCF) if(withCF)
m_cf.tick(); m_cf.tick();
@ -1846,17 +1844,8 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
if(!m_vid.showingWaitMessage()) if(!m_vid.showingWaitMessage())
m_vid.render(); m_vid.render();
if(!blockReboot) if(Sys_Exiting())
{ exitHandler(BUTTON_CALLBACK);
if(withCF && Sys_Exiting())
m_cf.clear();
if(Sys_Exiting())
{
m_cat.save();
m_cfg.save();
}
Sys_Test();
}
if(withCF && m_gameSelected && m_gamesound_changed && (m_gameSoundHdr == NULL) && !m_gameSound.IsPlaying() && m_music.GetVolume() == 0) if(withCF && m_gameSelected && m_gamesound_changed && (m_gameSoundHdr == NULL) && !m_gameSound.IsPlaying() && m_music.GetVolume() == 0)
{ {

View File

@ -648,8 +648,6 @@ private:
bool m_show_zone_game; bool m_show_zone_game;
volatile bool m_exit; volatile bool m_exit;
volatile bool m_disable_exit;
volatile bool m_networkInit; volatile bool m_networkInit;
volatile bool m_thrdStop; volatile bool m_thrdStop;
volatile bool m_thrdWorking; volatile bool m_thrdWorking;
@ -968,7 +966,7 @@ private:
bool _Home(); bool _Home();
bool _ExitTo(); bool _ExitTo();
// //
void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false); void _mainLoopCommon(bool withCF = false, bool adjusting = false);
// //
vector<dir_discHdr> _searchGamesByID(const char *gameId); vector<dir_discHdr> _searchGamesByID(const char *gameId);
/* vector<dir_discHdr> _searchGamesByTitle(wchar_t letter); /* vector<dir_discHdr> _searchGamesByTitle(wchar_t letter);
@ -1097,7 +1095,7 @@ private:
static const SOption _GCLoader[3]; static const SOption _GCLoader[3];
static const SOption _vidModePatch[4]; static const SOption _vidModePatch[4];
static const SOption _hooktype[8]; static const SOption _hooktype[8];
static const SOption _exitTo[6]; static const SOption _exitTo[5];
static map<u8, u8> _installed_cios; static map<u8, u8> _installed_cios;
typedef map<u8, u8>::iterator CIOSItr; typedef map<u8, u8>::iterator CIOSItr;
static int _version[9]; static int _version[9];

View File

@ -32,15 +32,11 @@ void CMenu::_about(bool help)
SetupInput(); SetupInput();
_showAbout(); _showAbout();
while(1) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if(amount_of_skips == 0) // Check dimensions in the loop, because the animation can have an effect
if (amount_of_skips == 0)
{
// Check dimensions in the loop, because the animation can have an effect
m_btnMgr.getDimensions(m_aboutLblInfo, thanks_x, thanks_y, thanks_w, thanks_h); // Get original dimensions m_btnMgr.getDimensions(m_aboutLblInfo, thanks_x, thanks_y, thanks_w, thanks_h); // Get original dimensions
}
if(first) if(first)
{ {
m_btnMgr.moveBy(m_aboutLblInfo, 0, -1); m_btnMgr.moveBy(m_aboutLblInfo, 0, -1);

View File

@ -145,19 +145,17 @@ void CMenu::_CategorySettings(bool fromGameSet)
memset(&m_categories, '0', m_max_categories); memset(&m_categories, '0', m_max_categories);
memcpy(&m_categories, catSettings, m_max_categories); memcpy(&m_categories, catSettings, m_max_categories);
_showCategorySettings(); _showCategorySettings();
while(true) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
m_cf.tick(); m_cf.tick();
if(!m_btnMgr.selected(lastBtn)) if(!m_btnMgr.selected(lastBtn))
m_btnMgr.noHover(false); m_btnMgr.noHover(false);
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnBack))) if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnBack)))
{ {
char newCatSettings[m_max_categories + 1]; char newCatSettings[m_max_categories + 1];
memset(&newCatSettings, 0, sizeof(newCatSettings)); memset(&newCatSettings, 0, sizeof(newCatSettings));
memcpy(&newCatSettings, &m_categories, sizeof(m_categories)); memcpy(&newCatSettings, &m_categories, sizeof(m_categories));
if(!fromGameSet) if(!fromGameSet)
{ {
newCatSettings[0] = '1'; newCatSettings[0] = '1';
@ -173,7 +171,6 @@ void CMenu::_CategorySettings(bool fromGameSet)
} }
else else
m_cat.setString(_domainFromView(), id, newCatSettings); m_cat.setString(_domainFromView(), id, newCatSettings);
//m_cat.save(); //m_cat.save();
break; break;
} }

View File

@ -321,27 +321,27 @@ void CMenu::_cfTheme(void)
_showCFTheme(curParam, cfVersion, wide); _showCFTheme(curParam, cfVersion, wide);
_loadCFLayout(cfVersion, true, wide != m_vid.wide()); _loadCFLayout(cfVersion, true, wide != m_vid.wide());
m_cf.applySettings(); m_cf.applySettings();
while (true) while(!m_exit)
{ {
_mainLoopCommon(true, false, curParam == 5 || curParam == 6 || curParam == 7); _mainLoopCommon(true);
if (BTN_HOME_PRESSED) if(BTN_HOME_PRESSED)
{ {
m_theme.clear(); m_theme.clear();
m_theme.unload(); m_theme.unload();
m_theme.load(fmt("%s/%s.ini", m_themeDir.c_str(), m_cfg.getString("GENERAL", "theme", "default").c_str())); m_theme.load(fmt("%s/%s.ini", m_themeDir.c_str(), m_cfg.getString("GENERAL", "theme", "default").c_str()));
break; break;
} }
else if (BTN_UP_PRESSED) else if(BTN_UP_PRESSED)
m_btnMgr.up(); m_btnMgr.up();
else if (BTN_DOWN_PRESSED) else if(BTN_DOWN_PRESSED)
m_btnMgr.down(); m_btnMgr.down();
if (BTN_B_HELD && BTN_1_PRESSED) if(BTN_B_HELD && BTN_1_PRESSED)
{ {
copyVersion = cfVersion; copyVersion = cfVersion;
copySelected = m_cf.selected(); copySelected = m_cf.selected();
copyWide = wide; copyWide = wide;
} }
else if (copyVersion > 0 && BTN_B_HELD && BTN_2_PRESSED) else if(copyVersion > 0 && BTN_B_HELD && BTN_2_PRESSED)
{ {
string domSrc(sfmt(_cfDomain(copySelected), copyVersion)); string domSrc(sfmt(_cfDomain(copySelected), copyVersion));
string domDst(sfmt(_cfDomain(m_cf.selected()), cfVersion)); string domDst(sfmt(_cfDomain(m_cf.selected()), cfVersion));

View File

@ -92,10 +92,10 @@ void CMenu::_CheatSettings()
else else
m_btnMgr.setText(m_cheatLblTitle,L""); m_btnMgr.setText(m_cheatLblTitle,L"");
while (true) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED) if(BTN_HOME_PRESSED || BTN_B_PRESSED)
break; break;
else if (BTN_UP_PRESSED) else if (BTN_UP_PRESSED)
m_btnMgr.up(); m_btnMgr.up();
@ -185,9 +185,9 @@ void CMenu::_CheatSettings()
m_thrdWorking = true; m_thrdWorking = true;
lwp_t thread = LWP_THREAD_NULL; lwp_t thread = LWP_THREAD_NULL;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_downloadCheatFileAsync, (void *)this, 0, 8192, 40); LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_downloadCheatFileAsync, (void *)this, 0, 8192, 40);
while (m_thrdWorking) while(m_thrdWorking)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if ((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking) if ((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
break; break;
if (BTN_A_PRESSED && !(m_thrdWorking && m_thrdStop)) if (BTN_A_PRESSED && !(m_thrdWorking && m_thrdStop))

View File

@ -53,13 +53,12 @@ void CMenu::_code(void)
m_btnMgr.show(m_codeBtnAge); m_btnMgr.show(m_codeBtnAge);
m_btnMgr.show(m_codeBtnErase); m_btnMgr.show(m_codeBtnErase);
} }
while (true) while(!m_exit)
{ {
int c = -1; int c = -1;
_mainLoopCommon(); _mainLoopCommon();
if (BTN_HOME_PRESSED) if (BTN_HOME_PRESSED)
goBack = true; goBack = true;
if (WPadIR_ANY()) if (WPadIR_ANY())
{ {
if (BTN_B_PRESSED) if (BTN_B_PRESSED)

View File

@ -91,9 +91,9 @@ void CMenu::_config(int page)
m_curGameId = m_cf.getId(); m_curGameId = m_cf.getId();
m_cfNeedsUpdate = false; m_cfNeedsUpdate = false;
int change = CONFIG_PAGE_NO_CHANGE; int change = CONFIG_PAGE_NO_CHANGE;
while (true) while(!m_exit)
{ {
switch (page) switch(page)
{ {
case 1: case 1:
change = _config1(); change = _config1();
@ -114,9 +114,9 @@ void CMenu::_config(int page)
change = _configScreen(); change = _configScreen();
break; break;
} }
if (change == CONFIG_PAGE_BACK) if(change == CONFIG_PAGE_BACK)
break; break;
if (!m_locked) if(!m_locked)
{ {
// assumes change is in the range of CONFIG_PAGE_DEC to CONFIG_PAGE_INC // assumes change is in the range of CONFIG_PAGE_DEC to CONFIG_PAGE_INC
page += change; page += change;
@ -126,10 +126,10 @@ void CMenu::_config(int page)
page = _nbCfgPages; page = _nbCfgPages;
} }
} }
if (m_cfNeedsUpdate) if(m_cfNeedsUpdate)
{ {
m_cfg.save(); m_cfg.save();
_initCF(); _initCF();
} }
} }
@ -167,7 +167,7 @@ int CMenu::_config1(void)
_showConfig(); _showConfig();
_textConfig(); _textConfig();
while (true) while(!m_exit)
{ {
change = _configCommon(); change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE) if (change != CONFIG_PAGE_NO_CHANGE)

View File

@ -107,7 +107,7 @@ int CMenu::_config3(void)
int change = CONFIG_PAGE_NO_CHANGE; int change = CONFIG_PAGE_NO_CHANGE;
_showConfig3(); _showConfig3();
while (true) while(!m_exit)
{ {
change = _configCommon(); change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE) if (change != CONFIG_PAGE_NO_CHANGE)

View File

@ -20,12 +20,11 @@ int amountOfChannels = -1;
Channels m_channels; Channels m_channels;
const CMenu::SOption CMenu::_exitTo[6] = { const CMenu::SOption CMenu::_exitTo[5] = {
{ "def", L"Default" }, { "def", L"Default" },
{ "menu", L"System Menu" }, { "menu", L"System Menu" },
{ "hbc", L"HBC" }, { "hbc", L"HBC" },
{ "prii", L"Priiloader" }, { "prii", L"Priiloader" },
{ "disabled", L"Disabled" },
{ "bootmii", L"BootMii" } { "bootmii", L"BootMii" }
}; };
@ -110,7 +109,7 @@ int CMenu::_config4(void)
int change = CONFIG_PAGE_NO_CHANGE; int change = CONFIG_PAGE_NO_CHANGE;
_showConfig4(); _showConfig4();
while (true) while(!m_exit)
{ {
change = _configCommon(); change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE) if (change != CONFIG_PAGE_NO_CHANGE)
@ -122,7 +121,6 @@ int CMenu::_config4(void)
int exit_to = (int)loopNum((u32)m_cfg.getInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo)); int exit_to = (int)loopNum((u32)m_cfg.getInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo));
m_cfg.setInt("GENERAL", "exit_to", exit_to); m_cfg.setInt("GENERAL", "exit_to", exit_to);
Sys_ExitTo(exit_to); Sys_ExitTo(exit_to);
m_disable_exit = exit_to == EXIT_TO_DISABLE;
_showConfig4(); _showConfig4();
} }
else if (m_btnMgr.selected(m_config4BtnSaveFavMode)) else if (m_btnMgr.selected(m_config4BtnSaveFavMode))

View File

@ -107,7 +107,7 @@ int CMenu::_configAdv(void)
break; break;
} }
_showConfigAdv(); _showConfigAdv();
while (true) while(!m_exit)
{ {
change = _configCommon(); change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE) if (change != CONFIG_PAGE_NO_CHANGE)

View File

@ -475,16 +475,16 @@ void CMenu::_gameSettings(void)
m_gameSettingsPage = 1; m_gameSettingsPage = 1;
_showGameSettings(); _showGameSettings();
while (true) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED) if(BTN_HOME_PRESSED || BTN_B_PRESSED)
break; break;
else if (BTN_UP_PRESSED) else if(BTN_UP_PRESSED)
m_btnMgr.up(); m_btnMgr.up();
else if (BTN_DOWN_PRESSED) else if(BTN_DOWN_PRESSED)
m_btnMgr.down(); m_btnMgr.down();
if ((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_gameSettingsBtnPageM))) && !m_locked) if((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_gameSettingsBtnPageM))) && !m_locked)
{ {
if (m_gameSettingsPage == 1) if (m_gameSettingsPage == 1)
m_gameSettingsPage = g_numGCfPages; m_gameSettingsPage = g_numGCfPages;
@ -492,67 +492,69 @@ void CMenu::_gameSettings(void)
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageM); if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageM);
_showGameSettings(); _showGameSettings();
} }
else if ((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_gameSettingsBtnPageP))) && !m_locked) else if((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_gameSettingsBtnPageP))) && !m_locked)
{ {
if (m_gameSettingsPage == g_numGCfPages) if(m_gameSettingsPage == g_numGCfPages)
m_gameSettingsPage = 1; m_gameSettingsPage = 1;
else ++m_gameSettingsPage; else
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageP); ++m_gameSettingsPage;
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
m_btnMgr.click(m_gameSettingsBtnPageP);
_showGameSettings(); _showGameSettings();
} }
else if (BTN_A_PRESSED) else if(BTN_A_PRESSED)
{ {
if (m_btnMgr.selected(m_gameSettingsBtnBack)) if(m_btnMgr.selected(m_gameSettingsBtnBack))
break; break;
else if (m_btnMgr.selected(m_gameSettingsBtnOcarina)) else if(m_btnMgr.selected(m_gameSettingsBtnOcarina))
{ {
int intoption = loopNum(m_gcfg2.getBool(id, "cheat") + 1, 3); int intoption = loopNum(m_gcfg2.getBool(id, "cheat") + 1, 3);
if (intoption > 1) if(intoption > 1)
m_gcfg2.remove(id, "cheat"); m_gcfg2.remove(id, "cheat");
else else
m_gcfg2.setOptBool(id, "cheat", intoption); m_gcfg2.setOptBool(id, "cheat", intoption);
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnVipatch)) else if(m_btnMgr.selected(m_gameSettingsBtnVipatch))
{ {
bool booloption = m_gcfg2.getBool(id, "vipatch"); bool booloption = m_gcfg2.getBool(id, "vipatch");
if (booloption != false) if(booloption != false)
m_gcfg2.remove(id, "vipatch"); m_gcfg2.remove(id, "vipatch");
else else
m_gcfg2.setBool(id, "vipatch", true); m_gcfg2.setBool(id, "vipatch", true);
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnCountryPatch)) else if(m_btnMgr.selected(m_gameSettingsBtnCountryPatch))
{ {
bool booloption = m_gcfg2.getBool(id, "country_patch"); bool booloption = m_gcfg2.getBool(id, "country_patch");
if (booloption != false) if(booloption != false)
m_gcfg2.remove(id, "country_patch"); m_gcfg2.remove(id, "country_patch");
else else
m_gcfg2.setBool(id, "country_patch", true); m_gcfg2.setBool(id, "country_patch", true);
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnIOSreloadBlock)) else if(m_btnMgr.selected(m_gameSettingsBtnIOSreloadBlock))
{ {
bool booloption = m_gcfg2.getBool(id, "reload_block"); bool booloption = m_gcfg2.getBool(id, "reload_block");
if (booloption != false) if(booloption != false)
m_gcfg2.remove(id, "reload_block"); m_gcfg2.remove(id, "reload_block");
else else
m_gcfg2.setBool(id, "reload_block", true); m_gcfg2.setBool(id, "reload_block", true);
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnCustom)) else if(m_btnMgr.selected(m_gameSettingsBtnCustom))
{ {
bool booloption = m_gcfg2.getBool(id, "custom"); bool booloption = m_gcfg2.getBool(id, "custom");
if (booloption != false) if(booloption != false)
m_gcfg2.remove(id, "custom"); m_gcfg2.remove(id, "custom");
else else
m_gcfg2.setBool(id, "custom", true); m_gcfg2.setBool(id, "custom", true);
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnLaunchNK)) else if(m_btnMgr.selected(m_gameSettingsBtnLaunchNK))
{ {
bool booloption = m_gcfg2.getBool(id, "useneek"); bool booloption = m_gcfg2.getBool(id, "useneek");
if (booloption != false) if(booloption != false)
m_gcfg2.remove(id, "useneek"); m_gcfg2.remove(id, "useneek");
else else
m_gcfg2.setBool(id, "useneek", true); m_gcfg2.setBool(id, "useneek", true);
@ -576,43 +578,43 @@ void CMenu::_gameSettings(void)
m_gcfg2.setBool(id, "dm_widescreen", true); m_gcfg2.setBool(id, "dm_widescreen", true);
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnLanguageP) || m_btnMgr.selected(m_gameSettingsBtnLanguageM)) else if(m_btnMgr.selected(m_gameSettingsBtnLanguageP) || m_btnMgr.selected(m_gameSettingsBtnLanguageM))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnLanguageP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnLanguageP) ? 1 : -1;
m_gcfg2.setInt(id, "language", (int)loopNum((u32)m_gcfg2.getInt(id, "language", 0) + direction, ARRAY_SIZE(CMenu::_languages))); m_gcfg2.setInt(id, "language", (int)loopNum((u32)m_gcfg2.getInt(id, "language", 0) + direction, ARRAY_SIZE(CMenu::_languages)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnVideoP) || m_btnMgr.selected(m_gameSettingsBtnVideoM)) else if(m_btnMgr.selected(m_gameSettingsBtnVideoP) || m_btnMgr.selected(m_gameSettingsBtnVideoM))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnVideoP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnVideoP) ? 1 : -1;
m_gcfg2.setInt(id, "video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_VideoModes))); m_gcfg2.setInt(id, "video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "video_mode", 0) + direction, ARRAY_SIZE(CMenu::_VideoModes)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnDMLVideoP) || m_btnMgr.selected(m_gameSettingsBtnDMLVideoM)) else if(m_btnMgr.selected(m_gameSettingsBtnDMLVideoP) || m_btnMgr.selected(m_gameSettingsBtnDMLVideoM))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnDMLVideoP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnDMLVideoP) ? 1 : -1;
m_gcfg2.setInt(id, "dml_video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_video_mode", 0) + direction, ARRAY_SIZE(CMenu::_DMLvideoModes))); m_gcfg2.setInt(id, "dml_video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_video_mode", 0) + direction, ARRAY_SIZE(CMenu::_DMLvideoModes)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnGClanguageP) || m_btnMgr.selected(m_gameSettingsBtnGClanguageM)) else if(m_btnMgr.selected(m_gameSettingsBtnGClanguageP) || m_btnMgr.selected(m_gameSettingsBtnGClanguageM))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnGClanguageP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnGClanguageP) ? 1 : -1;
m_gcfg2.setInt(id, "gc_language", (int)loopNum((u32)m_gcfg2.getInt(id, "gc_language", 0) + direction, ARRAY_SIZE(CMenu::_GClanguages))); m_gcfg2.setInt(id, "gc_language", (int)loopNum((u32)m_gcfg2.getInt(id, "gc_language", 0) + direction, ARRAY_SIZE(CMenu::_GClanguages)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) || m_btnMgr.selected(m_gameSettingsBtnAspectRatioM)) else if(m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) || m_btnMgr.selected(m_gameSettingsBtnAspectRatioM))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) ? 1 : -1;
m_gcfg2.setInt(id, "aspect_ratio", (int)loopNum((u32)m_gcfg2.getInt(id, "aspect_ratio", 0) + direction, ARRAY_SIZE(CMenu::_AspectRatio))); m_gcfg2.setInt(id, "aspect_ratio", (int)loopNum((u32)m_gcfg2.getInt(id, "aspect_ratio", 0) + direction, ARRAY_SIZE(CMenu::_AspectRatio)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnNMM_P) || m_btnMgr.selected(m_gameSettingsBtnNMM_M)) else if(m_btnMgr.selected(m_gameSettingsBtnNMM_P) || m_btnMgr.selected(m_gameSettingsBtnNMM_M))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnNMM_P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnNMM_P) ? 1 : -1;
m_gcfg2.setInt(id, "dml_nmm", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_nmm", 0) + direction, ARRAY_SIZE(CMenu::_NMM))); m_gcfg2.setInt(id, "dml_nmm", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_nmm", 0) + direction, ARRAY_SIZE(CMenu::_NMM)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnNoDVD_P) || m_btnMgr.selected(m_gameSettingsBtnNoDVD_M)) else if(m_btnMgr.selected(m_gameSettingsBtnNoDVD_P) || m_btnMgr.selected(m_gameSettingsBtnNoDVD_M))
{ {
s8 direction = m_btnMgr.selected(m_gameSettingsBtnNoDVD_P) ? 1 : -1; s8 direction = m_btnMgr.selected(m_gameSettingsBtnNoDVD_P) ? 1 : -1;
m_gcfg2.setInt(id, "no_disc_patch", (int)loopNum((u32)m_gcfg2.getInt(id, "no_disc_patch", 0) + direction, ARRAY_SIZE(CMenu::_NoDVD))); m_gcfg2.setInt(id, "no_disc_patch", (int)loopNum((u32)m_gcfg2.getInt(id, "no_disc_patch", 0) + direction, ARRAY_SIZE(CMenu::_NoDVD)));
@ -624,7 +626,7 @@ void CMenu::_gameSettings(void)
m_gcfg2.setInt(id, "gc_loader", (int)loopNum((u32)m_gcfg2.getInt(id, "gc_loader", 0) + direction, ARRAY_SIZE(CMenu::_GCLoader))); m_gcfg2.setInt(id, "gc_loader", (int)loopNum((u32)m_gcfg2.getInt(id, "gc_loader", 0) + direction, ARRAY_SIZE(CMenu::_GCLoader)));
_showGameSettings(); _showGameSettings();
} }
else if (m_btnMgr.selected(m_gameSettingsBtnIOSM) || m_btnMgr.selected(m_gameSettingsBtnIOSP)) else if(m_btnMgr.selected(m_gameSettingsBtnIOSM) || m_btnMgr.selected(m_gameSettingsBtnIOSP))
{ {
if( _installed_cios.size() > 0) if( _installed_cios.size() > 0)
{ {

View File

@ -64,7 +64,7 @@ int CMenu::_configScreen(void)
SetupInput(); SetupInput();
_showConfigScreen(); _showConfigScreen();
while (true) while(!m_exit)
{ {
change = _configCommon(); change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE) if (change != CONFIG_PAGE_NO_CHANGE)

View File

@ -65,7 +65,7 @@ int CMenu::_configSnd(void)
int step = 1; int step = 1;
_showConfigSnd(); _showConfigSnd();
while (true) while(!m_exit)
{ {
change = _configCommon(); change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE) if (change != CONFIG_PAGE_NO_CHANGE)

View File

@ -1222,9 +1222,9 @@ void CMenu::_download(string gameId)
else else
m_coverDLGameId = gameId; m_coverDLGameId = gameId;
while(true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if ((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking) if ((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
{ {
if(settingsmenu) if(settingsmenu)

View File

@ -393,7 +393,7 @@ void CMenu::_game(bool launch)
m_banner->ToogleZoom(); m_banner->ToogleZoom();
s8 startGameSound = 1; s8 startGameSound = 1;
while(true) while(!m_exit)
{ {
if(startGameSound < 1) if(startGameSound < 1)
startGameSound++; startGameSound++;
@ -594,7 +594,7 @@ void CMenu::_game(bool launch)
m_cf.clear(); m_cf.clear();
_showWaitMessage(); _showWaitMessage();
exitHandler(0); //Making wiiflow ready to boot something exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something
if(hdr->type != TYPE_HOMEBREW && hdr->type != TYPE_PLUGIN) if(hdr->type != TYPE_HOMEBREW && hdr->type != TYPE_PLUGIN)
{ {
@ -903,7 +903,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
WII_Initialize(); WII_Initialize();
WII_LaunchTitle(0x100000100LL); WII_LaunchTitle(0x100000100LL);
} }
Sys_LoadMenu(); Sys_Exit();
} }
void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments) void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
@ -962,7 +962,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id)
if(_installed_cios.size() <= 0) if(_installed_cios.size() <= 0)
{ {
error(sfmt("errgame2", L"No cIOS found!")); error(sfmt("errgame2", L"No cIOS found!"));
Sys_LoadMenu(); Sys_Exit();
} }
u8 IOS[3]; u8 IOS[3];
IOS[0] = gameIOS; IOS[0] = gameIOS;
@ -1081,7 +1081,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if(!Load_Neek2o_Kernel()) if(!Load_Neek2o_Kernel())
{ {
error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
Sys_LoadMenu(); Sys_Exit();
} }
ShutdownBeforeExit(); ShutdownBeforeExit();
Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL); Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL);
@ -1097,7 +1097,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if(!emu_disabled) if(!emu_disabled)
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED) if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
return; Sys_Exit();
} }
if(CurrentIOS.Type == IOS_TYPE_D2X && rtrn != NULL && strlen(rtrn) == 4) if(CurrentIOS.Type == IOS_TYPE_D2X && rtrn != NULL && strlen(rtrn) == 4)
{ {
@ -1125,15 +1125,14 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
{ {
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
error(_t("errgame5", L"Enabling emu failed!")); error(_t("errgame5", L"Enabling emu failed!"));
return; Sys_Exit();
} }
} }
if(forwarder) if(forwarder)
{ {
ShutdownBeforeExit(); ShutdownBeforeExit();
WII_Initialize(); WII_Initialize();
if(WII_LaunchTitle(gameTitle) < 0) WII_LaunchTitle(gameTitle);
Sys_LoadMenu();
} }
else else
{ {
@ -1143,6 +1142,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
ExternalBooter_ChannelSetup(gameTitle); ExternalBooter_ChannelSetup(gameTitle);
BootChannel(gameTitle, gameIOS, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio); BootChannel(gameTitle, gameIOS, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio);
} }
Sys_Exit();
} }
void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
@ -1167,7 +1167,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if(WDVD_GetCoverStatus(&cover) < 0) if(WDVD_GetCoverStatus(&cover) < 0)
{ {
error(_t("errgame7", L"WDVDGetCoverStatus Failed!")); error(_t("errgame7", L"WDVDGetCoverStatus Failed!"));
if (BTN_B_PRESSED) return; Sys_Exit();
} }
if(!(cover & 0x2)) if(!(cover & 0x2))
{ {
@ -1186,8 +1186,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if(Disc_Open(true) < 0) if(Disc_Open(true) < 0)
{ {
error(_t("wbfsoperr2", L"Disc_Open failed")); error(_t("wbfsoperr2", L"Disc_Open failed"));
if(BTN_B_PRESSED) Sys_Exit();
return;
} }
/* Check disc */ /* Check disc */
if(Disc_IsWii() < 0) if(Disc_IsWii() < 0)
@ -1195,8 +1194,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if (Disc_IsGC() < 0) if (Disc_IsGC() < 0)
{ {
error(_t("errgame9", L"This is not a Wii or GC disc")); error(_t("errgame9", L"This is not a Wii or GC disc"));
if(BTN_B_PRESSED) Sys_Exit();
return;
} }
else else
{ {
@ -1296,23 +1294,18 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
} }
} }
#ifndef DOLPHIN #ifndef DOLPHIN
bool iosLoaded = false;
if(!dvd || neek2o()) if(!dvd || neek2o())
{ {
int result = _loadIOS(GetRequestedGameIOS(hdr), m_gcfg2.getInt(id, "ios"), id); int result = _loadIOS(GetRequestedGameIOS(hdr), m_gcfg2.getInt(id, "ios"), id);
if(result == LOAD_IOS_FAILED) if(result == LOAD_IOS_FAILED)
return; Sys_Exit();
if(result == LOAD_IOS_SUCCEEDED)
iosLoaded = true;
} }
#else
bool iosLoaded = true;
#endif #endif
DeviceHandler::Instance()->Open_WBFS(currentPartition); DeviceHandler::Instance()->Open_WBFS(currentPartition);
bool wbfs_partition = (DeviceHandler::Instance()->GetFSType(currentPartition) == PART_FS_WBFS); bool wbfs_partition = (DeviceHandler::Instance()->GetFSType(currentPartition) == PART_FS_WBFS);
if(!dvd && !wbfs_partition && get_frag_list((u8 *)id.c_str(), (char*)path.c_str(), currentPartition == 0 ? 0x200 : USBStorage2_GetSectorSize()) < 0) if(!dvd && !wbfs_partition && get_frag_list((u8 *)id.c_str(), (char*)path.c_str(), currentPartition == 0 ? 0x200 : USBStorage2_GetSectorSize()) < 0)
return; Sys_Exit();
u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
hooktype = (u32) m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h hooktype = (u32) m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h
@ -1394,8 +1387,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
{ {
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
error(_t("errgame6", L"Enabling emu after reload failed!")); error(_t("errgame6", L"Enabling emu after reload failed!"));
Sys_LoadMenu(); Sys_Exit();
return;
} }
if(!DeviceHandler::Instance()->IsInserted(currentPartition)) if(!DeviceHandler::Instance()->IsInserted(currentPartition))
DeviceHandler::Instance()->Mount(currentPartition); DeviceHandler::Instance()->Mount(currentPartition);
@ -1408,16 +1400,12 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
{ {
gprintf("Set USB failed: %d\n", ret); gprintf("Set USB failed: %d\n", ret);
error(wfmt(_fmt("errgame10", L"Set USB failed: %d"), ret)); error(wfmt(_fmt("errgame10", L"Set USB failed: %d"), ret));
if(iosLoaded) Sys_Exit();
Sys_LoadMenu();
return;
} }
if(Disc_Open(false) < 0) if(Disc_Open(false) < 0)
{ {
error(_t("wbfsoperr2", L"Disc_Open failed")); error(_t("wbfsoperr2", L"Disc_Open failed"));
if(iosLoaded) Sys_Exit();
Sys_LoadMenu();
return;
} }
} }
if(CurrentIOS.Type == IOS_TYPE_HERMES) if(CurrentIOS.Type == IOS_TYPE_HERMES)

View File

@ -3,6 +3,7 @@
#include "svnrev.h" #include "svnrev.h"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/nk.h" #include "loader/nk.h"
#include "loader/sys.h"
u32 m_homeLblTitle; u32 m_homeLblTitle;
u32 m_exittoLblTitle; u32 m_exittoLblTitle;
@ -28,7 +29,7 @@ bool CMenu::_Home(void)
_showHome(); _showHome();
string prevTheme = m_cfg.getString("GENERAL", "theme", "default"); string prevTheme = m_cfg.getString("GENERAL", "theme", "default");
while(1) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if(BTN_A_PRESSED) if(BTN_A_PRESSED)
@ -86,7 +87,7 @@ bool CMenu::_Home(void)
{ {
_hideHome(); _hideHome();
if(m_locked) if(m_locked)
exitHandler(0); exitHandler(PRIILOADER_DEF);
else else
_ExitTo(); _ExitTo();
if(m_exit) if(m_exit)
@ -96,12 +97,12 @@ bool CMenu::_Home(void)
} }
else if(BTN_HOME_PRESSED) else if(BTN_HOME_PRESSED)
{ {
exitHandler(0); exitHandler(PRIILOADER_DEF);
break; break;
} }
else if(BTN_B_PRESSED) else if(BTN_B_PRESSED)
break; break;
} }
_hideHome(); _hideHome();
return m_exit; return m_exit;
@ -112,29 +113,29 @@ bool CMenu::_ExitTo(void)
SetupInput(); SetupInput();
_showExitTo(); _showExitTo();
while(1) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if(BTN_A_PRESSED) if(BTN_A_PRESSED)
{ {
if(m_btnMgr.selected(m_homeBtnExitToHBC)) if(m_btnMgr.selected(m_homeBtnExitToHBC))
{ {
exitHandler(1); exitHandler(EXIT_TO_HBC);
break; break;
} }
else if(m_btnMgr.selected(m_homeBtnExitToMenu)) else if(m_btnMgr.selected(m_homeBtnExitToMenu))
{ {
exitHandler(2); exitHandler(EXIT_TO_MENU);
break; break;
} }
else if(m_btnMgr.selected(m_homeBtnExitToPriiloader)) else if(m_btnMgr.selected(m_homeBtnExitToPriiloader))
{ {
exitHandler(3); exitHandler(EXIT_TO_PRIILOADER);
break; break;
} }
else if(m_btnMgr.selected(m_homeBtnExitToBootmii)) else if(m_btnMgr.selected(m_homeBtnExitToBootmii))
{ {
exitHandler(4); exitHandler(EXIT_TO_BOOTMII);
break; break;
} }
else if(m_btnMgr.selected(m_homeBtnExitToNeek)) else if(m_btnMgr.selected(m_homeBtnExitToNeek))
@ -142,16 +143,16 @@ bool CMenu::_ExitTo(void)
if(!Load_Neek2o_Kernel()) if(!Load_Neek2o_Kernel())
{ {
error(sfmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); error(sfmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
exitHandler(2); exitHandler(PRIILOADER_DEF);
} }
else else
exitHandler(5); exitHandler(EXIT_TO_BOOTMII);
break; break;
} }
} }
else if(BTN_HOME_PRESSED) else if(BTN_HOME_PRESSED)
{ {
exitHandler(0); exitHandler(PRIILOADER_DEF);
break; break;
} }
else if(BTN_B_PRESSED) else if(BTN_B_PRESSED)

View File

@ -210,39 +210,19 @@ void CMenu::LoadView(void)
void CMenu::exitHandler(int ExitTo) void CMenu::exitHandler(int ExitTo)
{ {
gprintf("Exit WiiFlow called\n"); m_exit = true;
Nand::Instance()->Disable_Emu(); if(ExitTo == EXIT_TO_BOOTMII) //Bootmii, check that the files are there, or ios will hang.
if(!m_disable_exit || ExitTo == 0)
{ {
m_exit = true; struct stat dummy;
if(ExitTo == 1) // HBC if(!DeviceHandler::Instance()->IsInserted(SD) ||
Sys_ExitTo(EXIT_TO_HBC); stat("sd:/bootmii/armboot.bin", &dummy) != 0 ||
else if(ExitTo == 2) // System Menu stat("sd:/bootmii/ppcboot.elf", &dummy) != 0)
Sys_ExitTo(EXIT_TO_MENU); ExitTo = EXIT_TO_HBC;
else if(ExitTo == 3) // Priiloader
Sys_ExitTo(EXIT_TO_PRIILOADER);
else if(ExitTo == 4) //Bootmii, check that the files are there, or ios will hang.
{
struct stat dummy;
if(DeviceHandler::Instance()->IsInserted(SD) &&
stat(fmt("%s:/bootmii/armboot.bin", DeviceName[SD]), &dummy) == 0 &&
stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) == 0)
{
Sys_ExitTo(EXIT_TO_BOOTMII);
}
else
Sys_ExitTo(EXIT_TO_HBC);
}
else if(ExitTo == 5) //Neek2o kernel
Sys_ExitTo(EXIT_TO_NEEK2O);
}
m_reload = (BTN_B_HELD || m_disable_exit);
if(m_exit)
{
// Mark exiting to prevent soundhandler from restarting
extern bool exiting;
exiting = true;
} }
Sys_ExitTo(ExitTo);
// Mark exiting to prevent soundhandler from restarting
extern bool exiting;
exiting = true;
} }
int CMenu::main(void) int CMenu::main(void)
@ -297,7 +277,7 @@ int CMenu::main(void)
bUsed = true; bUsed = true;
} }
while(true) while(!m_exit)
{ {
/* IMPORTANT check if a disc is inserted */ /* IMPORTANT check if a disc is inserted */
WDVD_GetCoverStatus(&disc_check); WDVD_GetCoverStatus(&disc_check);
@ -838,7 +818,7 @@ int CMenu::main(void)
{ {
m_cf.clear(); m_cf.clear();
_showWaitMessage(); _showWaitMessage();
exitHandler(0); //Making wiiflow ready to boot something exitHandler(PRIILOADER_DEF); //Making wiiflow ready to boot something
_launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), m_homebrewArgs); _launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), m_homebrewArgs);
return 0; return 0;
} }

View File

@ -325,9 +325,9 @@ int CMenu::_NandEmuCfg(void)
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_nandext = false; m_nandext = false;
while(true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking) if((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
break; break;
else if(BTN_UP_PRESSED) else if(BTN_UP_PRESSED)
@ -428,9 +428,9 @@ int CMenu::_FlashSave(string gameId)
m_saveExtGameId = gameId; m_saveExtGameId = gameId;
while(true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if(m_forceext) if(m_forceext)
{ {
m_forceext = false; m_forceext = false;
@ -523,9 +523,9 @@ int CMenu::_AutoExtractSave(string gameId)
m_saveExtGameId = gameId; m_saveExtGameId = gameId;
while(true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if((BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnExtract))) || m_forceext) if((BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnExtract))) || m_forceext)
{ {
m_forceext = false; m_forceext = false;
@ -618,9 +618,9 @@ int CMenu::_AutoCreateNand(void)
m_btnMgr.show(m_nandemuBtnPartition); m_btnMgr.show(m_nandemuBtnPartition);
m_btnMgr.show(m_nandemuLblInit); m_btnMgr.show(m_nandemuLblInit);
while(true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnExtract))) if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnExtract)))
{ {
m_fulldump = true; m_fulldump = true;

View File

@ -101,7 +101,7 @@ void CMenu::_PluginSettings()
Plugin_curPage = 1; Plugin_curPage = 1;
_textPluginSettings(); _textPluginSettings();
_showPluginSettings(); _showPluginSettings();
while(true) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if(!m_btnMgr.selected(Plugin_lastBtn)) if(!m_btnMgr.selected(Plugin_lastBtn))
@ -222,7 +222,7 @@ void CMenu::_textPluginSettings(void)
m_btnMgr.setText(m_pluginLblTitle, _t("cfgpl1", L"Select Plugins")); m_btnMgr.setText(m_pluginLblTitle, _t("cfgpl1", L"Select Plugins"));
m_btnMgr.setText(m_pluginBtnBack, _t("cd1", L"Back")); m_btnMgr.setText(m_pluginBtnBack, _t("cd1", L"Back"));
u8 i = 0; u8 i = 0;
while(true) while(!m_exit)
{ {
if(i == 0) if(i == 0)
m_btnMgr.setText(m_pluginLblCat[i], _t("dl25", L"All")); m_btnMgr.setText(m_pluginLblCat[i], _t("dl25", L"All"));

View File

@ -189,14 +189,12 @@ bool CMenu::_Source()
m_btnMgr.show(m_sourceBtnEmu); m_btnMgr.show(m_sourceBtnEmu);
} }
else else
{
_updateSourceBtns(); _updateSourceBtns();
}
while(!m_exit)
while(true)
{ {
_mainLoopCommon(); _mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED) if(BTN_HOME_PRESSED || BTN_B_PRESSED)
{ {
back = true; back = true;
break; break;

View File

@ -29,15 +29,11 @@ void CMenu::_system()
m_thrdStop = false; m_thrdStop = false;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_showtimer = -1; m_showtimer = -1;
while (true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if(amount_of_skips == 0) // Check dimensions in the loop, because the animation can have an effect
if (amount_of_skips == 0)
{
// Check dimensions in the loop, because the animation can have an effect
m_btnMgr.getDimensions(m_systemLblInfo, update_x, update_y, update_w, update_h); // Get original dimensions m_btnMgr.getDimensions(m_systemLblInfo, update_x, update_y, update_w, update_h); // Get original dimensions
}
if(first) if(first)
{ {
m_btnMgr.moveBy(m_systemLblInfo, 0, -(pixels_to_skip * 10)); m_btnMgr.moveBy(m_systemLblInfo, 0, -(pixels_to_skip * 10));

View File

@ -288,9 +288,9 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
} }
m_thrdStop = false; m_thrdStop = false;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
while(true) while(!m_exit)
{ {
_mainLoopCommon(false, m_thrdWorking); _mainLoopCommon();
if((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking) if((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
break; break;
else if(BTN_UP_PRESSED) else if(BTN_UP_PRESSED)