2016-11-07 16:06:00 +01:00
|
|
|
|
2012-12-21 20:51:22 +01:00
|
|
|
#include "menu.hpp"
|
2012-12-27 00:22:44 +01:00
|
|
|
#include "channel/nand_save.hpp"
|
2012-12-21 20:51:22 +01:00
|
|
|
|
2022-06-24 20:05:59 +02:00
|
|
|
TexData m_bootBg;
|
|
|
|
|
2012-12-21 20:51:22 +01:00
|
|
|
s16 m_bootLblTitle;
|
2013-08-17 15:21:43 +02:00
|
|
|
s16 m_bootBtnBack;
|
|
|
|
s16 m_bootLblUser[4];
|
|
|
|
|
2013-04-08 23:45:13 +02:00
|
|
|
u8 set_port = 0;
|
|
|
|
|
2016-11-07 16:06:00 +01:00
|
|
|
void CMenu::_hideBoot(bool instant)
|
2012-12-21 20:51:22 +01:00
|
|
|
{
|
2016-11-07 16:06:00 +01:00
|
|
|
m_btnMgr.hide(m_bootLblTitle, instant);
|
|
|
|
m_btnMgr.hide(m_bootBtnBack, instant);
|
2013-08-14 18:11:26 +02:00
|
|
|
for(u8 i = 0; i < ARRAY_SIZE(m_bootLblUser); ++i)
|
|
|
|
if(m_bootLblUser[i] != -1)
|
2016-11-07 16:06:00 +01:00
|
|
|
m_btnMgr.hide(m_bootLblUser[i], instant);
|
|
|
|
|
2022-06-24 20:05:59 +02:00
|
|
|
_hideConfigButtons(instant);
|
2012-12-21 20:51:22 +01:00
|
|
|
}
|
|
|
|
|
2016-11-07 16:06:00 +01:00
|
|
|
void CMenu::_showBoot()
|
|
|
|
{
|
2022-06-24 20:05:59 +02:00
|
|
|
_setBg(m_bootBg, m_bootBg);
|
2016-11-07 16:06:00 +01:00
|
|
|
m_btnMgr.show(m_bootLblTitle);
|
|
|
|
m_btnMgr.show(m_bootBtnBack);
|
|
|
|
for(u8 i = 0; i < ARRAY_SIZE(m_bootLblUser); ++i)
|
|
|
|
if(m_bootLblUser[i] != -1)
|
|
|
|
m_btnMgr.show(m_bootLblUser[i]);
|
|
|
|
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configLbl1, _t("cfgbt2", L"Force Load cIOS"));
|
|
|
|
m_btnMgr.setText(m_configLbl2, _t("cfgbt3", L"Force cIOS Revision"));
|
|
|
|
m_btnMgr.setText(m_configLbl3, _t("cfgbt4", L"USB Port"));
|
|
|
|
m_btnMgr.setText(m_configLbl4, _t("cfg719", L"Mount SD only"));
|
|
|
|
|
|
|
|
m_btnMgr.setText(m_configBtn1, _optBoolToString(cur_load));
|
2016-11-07 16:06:00 +01:00
|
|
|
if(cur_ios > 0)
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configLbl2Val, wfmt(L"%i", cur_ios));
|
2016-11-07 16:06:00 +01:00
|
|
|
else
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configLbl2Val, L"AUTO");// cIOS 249 unless the user changed it via the meta.xml
|
|
|
|
m_btnMgr.setText(m_configBtn3, wfmt(L"%i", set_port));
|
|
|
|
m_btnMgr.setText(m_configBtn4, m_cfg.getBool("GENERAL", "sd_only") ? _t("yes", L"Yes") : _t("no", L"No"));
|
2016-11-07 16:06:00 +01:00
|
|
|
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.show(m_configLbl1);
|
|
|
|
m_btnMgr.show(m_configBtn1);
|
2016-11-07 16:06:00 +01:00
|
|
|
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.show(m_configLbl2);
|
|
|
|
m_btnMgr.show(m_configLbl2Val);
|
|
|
|
m_btnMgr.show(m_configBtn2M);
|
|
|
|
m_btnMgr.show(m_configBtn2P);
|
2016-11-07 16:06:00 +01:00
|
|
|
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.show(m_configLbl3);
|
|
|
|
m_btnMgr.show(m_configBtn3);
|
|
|
|
|
|
|
|
m_btnMgr.show(m_configLbl4);
|
|
|
|
m_btnMgr.show(m_configBtn4);
|
2016-11-07 16:06:00 +01:00
|
|
|
}
|
|
|
|
|
2022-01-17 21:50:40 +01:00
|
|
|
void CMenu::_Boot(void)
|
2012-12-21 20:51:22 +01:00
|
|
|
{
|
2018-08-06 16:58:26 +02:00
|
|
|
if(isWiiVC)
|
|
|
|
{
|
|
|
|
error(_t("errboot7", L"Access denied in Wii VC mode."));
|
2022-01-17 21:50:40 +01:00
|
|
|
return;
|
2018-08-06 16:58:26 +02:00
|
|
|
}
|
2013-04-08 23:45:13 +02:00
|
|
|
set_port = currentPort;
|
|
|
|
bool prev_load = cur_load;
|
|
|
|
u8 prev_ios = cur_ios;
|
2018-12-24 14:42:31 +01:00
|
|
|
bool prev_sd = m_cfg.getBool("GENERAL", "sd_only");
|
2022-06-18 00:29:09 +02:00
|
|
|
bool cur_sd = prev_sd;
|
2016-11-07 16:06:00 +01:00
|
|
|
SetupInput();
|
|
|
|
_showBoot();
|
2012-12-21 20:51:22 +01:00
|
|
|
|
|
|
|
while(!m_exit)
|
|
|
|
{
|
|
|
|
_mainLoopCommon();
|
|
|
|
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
|
2013-02-14 22:30:48 +01:00
|
|
|
break;
|
2013-08-17 15:21:43 +02:00
|
|
|
else if(BTN_UP_PRESSED)
|
|
|
|
m_btnMgr.up();
|
|
|
|
else if(BTN_DOWN_PRESSED)
|
|
|
|
m_btnMgr.down();
|
2012-12-21 20:51:22 +01:00
|
|
|
else if(BTN_A_PRESSED)
|
|
|
|
{
|
2013-04-08 23:45:13 +02:00
|
|
|
if(m_btnMgr.selected(m_bootBtnBack))
|
|
|
|
break;
|
2022-06-24 20:05:59 +02:00
|
|
|
else if(m_btnMgr.selected(m_configBtn1))
|
2012-12-21 20:51:22 +01:00
|
|
|
{
|
2013-04-08 23:45:13 +02:00
|
|
|
cur_load = !cur_load;
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configBtn1, _optBoolToString(cur_load));
|
2012-12-21 20:51:22 +01:00
|
|
|
}
|
2022-06-24 20:05:59 +02:00
|
|
|
else if(m_btnMgr.selected(m_configBtn2M) || m_btnMgr.selected(m_configBtn2P))
|
2012-12-21 20:51:22 +01:00
|
|
|
{
|
2022-06-24 20:05:59 +02:00
|
|
|
bool increase = m_btnMgr.selected(m_configBtn2P);
|
2013-04-08 23:45:13 +02:00
|
|
|
CIOSItr itr = _installed_cios.find(cur_ios);
|
2012-12-21 20:51:22 +01:00
|
|
|
if(increase)
|
|
|
|
{
|
|
|
|
itr++;
|
|
|
|
if(itr == _installed_cios.end())
|
|
|
|
itr = _installed_cios.begin();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(itr == _installed_cios.begin())
|
|
|
|
itr = _installed_cios.end();
|
|
|
|
itr--;
|
|
|
|
}
|
2013-04-08 23:45:13 +02:00
|
|
|
cur_ios = itr->first;
|
2013-08-17 15:21:43 +02:00
|
|
|
if(cur_ios > 0)
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configLbl2Val, wfmt(L"%i", cur_ios));
|
2013-08-17 15:21:43 +02:00
|
|
|
else
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configLbl2Val, L"AUTO");
|
2013-02-14 22:30:48 +01:00
|
|
|
}
|
2022-06-24 20:05:59 +02:00
|
|
|
else if(m_btnMgr.selected(m_configBtn3))
|
2013-02-14 22:30:48 +01:00
|
|
|
{
|
2013-04-08 23:45:13 +02:00
|
|
|
set_port = !set_port;
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configBtn3, wfmt(L"%i", set_port));
|
2013-08-17 15:21:43 +02:00
|
|
|
}
|
2022-06-24 20:05:59 +02:00
|
|
|
else if (m_btnMgr.selected(m_configBtn4))
|
2013-08-17 15:21:43 +02:00
|
|
|
{
|
2022-06-18 00:29:09 +02:00
|
|
|
cur_sd = !cur_sd;
|
2022-06-24 20:05:59 +02:00
|
|
|
m_btnMgr.setText(m_configBtn4, cur_sd ? _t("yes", L"Yes") : _t("no", L"No"));
|
2013-08-17 15:21:43 +02:00
|
|
|
}
|
2012-12-21 20:51:22 +01:00
|
|
|
}
|
|
|
|
}
|
2022-06-18 00:29:09 +02:00
|
|
|
if(cur_sd != prev_sd)
|
|
|
|
{
|
|
|
|
InternalSave.SaveSDOnly(cur_sd);
|
|
|
|
m_cfg.setBool("GENERAL", "sd_only", cur_sd);// backwards compatibity
|
|
|
|
}
|
2012-12-27 00:22:44 +01:00
|
|
|
if(prev_load != cur_load || prev_ios != cur_ios)
|
2013-04-08 23:45:13 +02:00
|
|
|
InternalSave.SaveIOS();
|
|
|
|
if(set_port != currentPort)
|
|
|
|
InternalSave.SavePort(set_port);
|
2016-11-07 16:06:00 +01:00
|
|
|
_hideBoot();
|
2013-02-14 22:50:46 +01:00
|
|
|
|
2018-12-24 14:42:31 +01:00
|
|
|
if(prev_load != cur_load || prev_ios != cur_ios || set_port != currentPort || prev_sd != cur_sd)
|
2013-02-14 22:50:46 +01:00
|
|
|
{
|
2019-05-06 20:53:33 +02:00
|
|
|
error(_t("errboot8", L"Press 'A' to reload WiiFlow"));
|
2022-01-17 21:50:40 +01:00
|
|
|
vector<string> arguments = _getMetaXML(fmt("%s/boot.dol", m_appDir.c_str()));
|
|
|
|
_launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), arguments);
|
2013-02-14 22:30:48 +01:00
|
|
|
}
|
2012-12-21 20:51:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_initBoot(void)
|
|
|
|
{
|
2022-06-24 20:05:59 +02:00
|
|
|
m_bootBg = _texture("BOOT/BG", "texture", theme.bg, false);
|
|
|
|
|
2013-08-14 18:11:26 +02:00
|
|
|
_addUserLabels(m_bootLblUser, ARRAY_SIZE(m_bootLblUser), "BOOT");
|
2018-12-28 01:47:00 +01:00
|
|
|
m_bootLblTitle = _addLabel("BOOT/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
2013-11-04 20:46:23 +01:00
|
|
|
m_bootBtnBack = _addButton("BOOT/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
|
2013-08-17 15:21:43 +02:00
|
|
|
|
2013-11-04 20:46:23 +01:00
|
|
|
_setHideAnim(m_bootLblTitle, "BOOT/TITLE", 0, 0, -2.f, 0.f);
|
2013-08-17 15:21:43 +02:00
|
|
|
_setHideAnim(m_bootBtnBack, "BOOT/BACK_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
|
2016-11-07 16:06:00 +01:00
|
|
|
_hideBoot(true);
|
2012-12-21 20:51:22 +01:00
|
|
|
_textBoot();
|
|
|
|
}
|
2016-11-07 16:06:00 +01:00
|
|
|
|
|
|
|
void CMenu::_textBoot(void)
|
|
|
|
{
|
|
|
|
m_btnMgr.setText(m_bootLblTitle, _t("cfgbt1", L"Startup Settings"));
|
|
|
|
m_btnMgr.setText(m_bootBtnBack, _t("cfg10", L"Back"));
|
|
|
|
}
|