2012-06-21 19:28:46 +02:00
|
|
|
|
|
|
|
#include "menu.hpp"
|
2012-08-05 15:48:15 +02:00
|
|
|
#include "loader/cios.h"
|
|
|
|
#include "loader/nk.h"
|
2012-11-01 17:39:42 +01:00
|
|
|
#include "const_str.hpp"
|
2012-06-21 19:28:46 +02:00
|
|
|
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 m_homeLblTitle;
|
|
|
|
s16 m_exittoLblTitle;
|
2012-06-21 19:28:46 +02:00
|
|
|
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 m_homeBtnSettings;
|
|
|
|
s16 m_homeBtnReloadCache;
|
|
|
|
s16 m_homeBtnUpdate;
|
2012-12-21 16:11:24 +01:00
|
|
|
s16 m_homeBtnInstall;
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 m_homeBtnAbout;
|
|
|
|
s16 m_homeBtnExitTo;
|
2012-07-05 21:57:28 +02:00
|
|
|
|
2012-09-13 16:54:17 +02:00
|
|
|
s16 m_homeBtnExitToHBC;
|
|
|
|
s16 m_homeBtnExitToMenu;
|
|
|
|
s16 m_homeBtnExitToPriiloader;
|
|
|
|
s16 m_homeBtnExitToBootmii;
|
|
|
|
s16 m_homeBtnExitToNeek;
|
2012-06-21 19:28:46 +02:00
|
|
|
|
2012-11-29 19:48:44 +01:00
|
|
|
s16 m_homeLblBattery;
|
|
|
|
|
2012-12-28 15:19:40 +01:00
|
|
|
TexData m_homeBg;
|
2012-06-21 19:28:46 +02:00
|
|
|
|
|
|
|
bool CMenu::_Home(void)
|
|
|
|
{
|
|
|
|
SetupInput();
|
|
|
|
_showHome();
|
|
|
|
|
|
|
|
string prevTheme = m_cfg.getString("GENERAL", "theme", "default");
|
2012-09-09 20:35:15 +02:00
|
|
|
while(!m_exit)
|
2012-06-21 19:28:46 +02:00
|
|
|
{
|
2012-11-29 19:48:44 +01:00
|
|
|
/* battery gets refreshed in here... */
|
2012-06-21 19:28:46 +02:00
|
|
|
_mainLoopCommon();
|
2012-11-29 19:48:44 +01:00
|
|
|
/* and it always changes so... */
|
|
|
|
m_btnMgr.setText(m_homeLblBattery, wfmt(PLAYER_BATTERY_LABEL, min((float)wd[0]->battery_level/2, 100.f),
|
|
|
|
min((float)wd[1]->battery_level/2, 100.f), min((float)wd[2]->battery_level/2, 100.f), min((float)wd[3]->battery_level/2, 100.f)));
|
2012-06-21 19:28:46 +02:00
|
|
|
if(BTN_A_PRESSED)
|
|
|
|
{
|
|
|
|
if(m_btnMgr.selected(m_homeBtnSettings))
|
|
|
|
{
|
|
|
|
_hideHome();
|
|
|
|
_config(1);
|
|
|
|
if(prevTheme != m_cfg.getString("GENERAL", "theme") || m_reload == true)
|
|
|
|
{
|
2012-07-07 15:42:21 +02:00
|
|
|
m_exit = true;
|
2012-06-21 19:28:46 +02:00
|
|
|
m_reload = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
_showHome();
|
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_homeBtnReloadCache))
|
|
|
|
{
|
2012-10-03 23:34:37 +02:00
|
|
|
//m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
2012-06-21 19:28:46 +02:00
|
|
|
UpdateCache(m_current_view);
|
|
|
|
LoadView();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_homeBtnUpdate) && !m_locked)
|
|
|
|
{
|
2012-11-11 19:28:03 +01:00
|
|
|
CoverFlow.stopCoverLoader(true);
|
2012-06-21 19:28:46 +02:00
|
|
|
_hideHome();
|
|
|
|
_system();
|
|
|
|
remove(m_ver.c_str());
|
|
|
|
if(m_exit)
|
|
|
|
_launchHomebrew(m_dol.c_str(), m_homebrewArgs);
|
2012-12-21 16:11:24 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_showHome();
|
|
|
|
CoverFlow.startCoverLoader();
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
|
|
|
}
|
2012-12-21 16:11:24 +01:00
|
|
|
else if(m_btnMgr.selected(m_homeBtnInstall))
|
2012-08-14 17:42:34 +02:00
|
|
|
{
|
|
|
|
_hideHome();
|
2012-12-21 16:11:24 +01:00
|
|
|
_wbfsOp(WO_ADD_GAME);
|
2012-08-14 17:42:34 +02:00
|
|
|
_showHome();
|
|
|
|
}
|
2012-06-21 19:28:46 +02:00
|
|
|
else if(m_btnMgr.selected(m_homeBtnAbout))
|
|
|
|
{
|
|
|
|
_hideHome();
|
|
|
|
_about();
|
|
|
|
_showHome();
|
|
|
|
}
|
2012-07-05 21:57:28 +02:00
|
|
|
else if(m_btnMgr.selected(m_homeBtnExitTo))
|
2012-07-07 15:42:21 +02:00
|
|
|
{
|
|
|
|
_hideHome();
|
2012-07-07 00:38:21 +02:00
|
|
|
if(m_locked)
|
2012-12-07 23:40:16 +01:00
|
|
|
exitHandler(WIIFLOW_DEF);
|
2012-07-07 15:42:21 +02:00
|
|
|
else
|
|
|
|
_ExitTo();
|
|
|
|
_showHome();
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(BTN_HOME_PRESSED)
|
|
|
|
{
|
2012-12-21 16:11:24 +01:00
|
|
|
exitHandler(WIIFLOW_DEF);
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
2012-07-05 21:57:28 +02:00
|
|
|
else if(BTN_B_PRESSED)
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-09-09 20:35:15 +02:00
|
|
|
}
|
2012-07-05 21:57:28 +02:00
|
|
|
|
2012-06-21 19:28:46 +02:00
|
|
|
_hideHome();
|
2012-07-07 15:42:21 +02:00
|
|
|
return m_exit;
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
|
|
|
|
2012-07-05 21:57:28 +02:00
|
|
|
bool CMenu::_ExitTo(void)
|
|
|
|
{
|
|
|
|
SetupInput();
|
|
|
|
_showExitTo();
|
|
|
|
|
2012-09-09 20:35:15 +02:00
|
|
|
while(!m_exit)
|
2012-07-05 21:57:28 +02:00
|
|
|
{
|
|
|
|
_mainLoopCommon();
|
|
|
|
if(BTN_A_PRESSED)
|
|
|
|
{
|
|
|
|
if(m_btnMgr.selected(m_homeBtnExitToHBC))
|
|
|
|
{
|
2012-09-09 20:35:15 +02:00
|
|
|
exitHandler(EXIT_TO_HBC);
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_homeBtnExitToMenu))
|
|
|
|
{
|
2012-09-09 20:35:15 +02:00
|
|
|
exitHandler(EXIT_TO_MENU);
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_homeBtnExitToPriiloader))
|
|
|
|
{
|
2012-09-09 20:35:15 +02:00
|
|
|
exitHandler(EXIT_TO_PRIILOADER);
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_homeBtnExitToBootmii))
|
|
|
|
{
|
2012-09-09 20:35:15 +02:00
|
|
|
exitHandler(EXIT_TO_BOOTMII);
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
2012-07-22 20:02:56 +02:00
|
|
|
else if(m_btnMgr.selected(m_homeBtnExitToNeek))
|
|
|
|
{
|
2012-08-22 21:09:21 +02:00
|
|
|
if(!Load_Neek2o_Kernel())
|
2012-07-22 20:02:56 +02:00
|
|
|
{
|
|
|
|
error(sfmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
|
2012-09-09 20:35:15 +02:00
|
|
|
exitHandler(PRIILOADER_DEF);
|
2012-08-22 21:09:21 +02:00
|
|
|
}
|
|
|
|
else
|
2012-09-10 00:38:42 +02:00
|
|
|
{
|
|
|
|
bool nkWiiflow = m_cfg.getBool("NEEK2O", "launchwiiflow", true);
|
|
|
|
if(nkWiiflow)
|
|
|
|
exitHandler(EXIT_TO_WFNK2O);
|
|
|
|
else
|
|
|
|
exitHandler(EXIT_TO_SMNK2O);
|
|
|
|
}
|
2012-07-22 20:02:56 +02:00
|
|
|
break;
|
|
|
|
}
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
2012-07-07 00:38:21 +02:00
|
|
|
else if(BTN_HOME_PRESSED)
|
|
|
|
{
|
2012-12-07 23:40:16 +01:00
|
|
|
exitHandler(WIIFLOW_DEF);
|
2012-07-07 15:42:21 +02:00
|
|
|
break;
|
2012-07-07 00:38:21 +02:00
|
|
|
}
|
2012-07-07 15:42:21 +02:00
|
|
|
else if(BTN_B_PRESSED)
|
|
|
|
break;
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
_hideExitTo();
|
2012-07-07 15:42:21 +02:00
|
|
|
return m_exit;
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
|
2012-06-21 19:28:46 +02:00
|
|
|
void CMenu::_showHome(void)
|
|
|
|
{
|
|
|
|
_setBg(m_homeBg, m_homeBg);
|
|
|
|
m_btnMgr.show(m_homeLblTitle);
|
|
|
|
|
|
|
|
m_btnMgr.show(m_homeBtnSettings);
|
|
|
|
m_btnMgr.show(m_homeBtnReloadCache);
|
|
|
|
m_btnMgr.show(m_homeBtnUpdate);
|
2012-12-21 16:11:24 +01:00
|
|
|
m_btnMgr.show(m_homeBtnInstall);
|
|
|
|
m_btnMgr.show(m_homeBtnAbout);
|
2012-07-05 21:57:28 +02:00
|
|
|
m_btnMgr.show(m_homeBtnExitTo);
|
2012-11-29 19:48:44 +01:00
|
|
|
|
|
|
|
m_btnMgr.show(m_homeLblBattery);
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_showExitTo(void)
|
|
|
|
{
|
|
|
|
_setBg(m_homeBg, m_homeBg);
|
|
|
|
m_btnMgr.show(m_exittoLblTitle);
|
|
|
|
|
|
|
|
m_btnMgr.show(m_homeBtnExitToHBC);
|
|
|
|
m_btnMgr.show(m_homeBtnExitToMenu);
|
|
|
|
m_btnMgr.show(m_homeBtnExitToPriiloader);
|
|
|
|
m_btnMgr.show(m_homeBtnExitToBootmii);
|
2012-07-22 20:02:56 +02:00
|
|
|
m_btnMgr.show(m_homeBtnExitToNeek);
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_hideHome(bool instant)
|
|
|
|
{
|
|
|
|
m_btnMgr.hide(m_homeLblTitle, instant);
|
|
|
|
|
|
|
|
m_btnMgr.hide(m_homeBtnSettings, instant);
|
|
|
|
m_btnMgr.hide(m_homeBtnReloadCache, instant);
|
|
|
|
m_btnMgr.hide(m_homeBtnUpdate, instant);
|
2012-12-21 16:11:24 +01:00
|
|
|
m_btnMgr.hide(m_homeBtnInstall, instant);
|
2012-07-22 20:02:56 +02:00
|
|
|
m_btnMgr.hide(m_homeBtnAbout, instant);
|
2012-07-05 21:57:28 +02:00
|
|
|
m_btnMgr.hide(m_homeBtnExitTo, instant);
|
2012-11-29 19:48:44 +01:00
|
|
|
|
|
|
|
m_btnMgr.hide(m_homeLblBattery, instant);
|
2012-07-05 21:57:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_hideExitTo(bool instant)
|
|
|
|
{
|
|
|
|
m_btnMgr.hide(m_exittoLblTitle, instant);
|
|
|
|
|
|
|
|
m_btnMgr.hide(m_homeBtnExitToHBC, instant);
|
|
|
|
m_btnMgr.hide(m_homeBtnExitToMenu, instant);
|
|
|
|
m_btnMgr.hide(m_homeBtnExitToPriiloader, instant);
|
|
|
|
m_btnMgr.hide(m_homeBtnExitToBootmii, instant);
|
2012-07-22 20:02:56 +02:00
|
|
|
m_btnMgr.hide(m_homeBtnExitToNeek, instant);
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
void CMenu::_initHomeAndExitToMenu()
|
2012-06-21 19:28:46 +02:00
|
|
|
{
|
2012-11-03 20:16:03 +01:00
|
|
|
//Home Menu
|
|
|
|
m_homeBg = _texture("HOME/BG", "texture", theme.bg, false);
|
2012-06-21 19:28:46 +02:00
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
m_homeLblTitle = _addTitle("HOME/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
2012-06-21 19:28:46 +02:00
|
|
|
|
2012-07-29 00:38:46 +02:00
|
|
|
_setHideAnim(m_homeLblTitle, "HOME/TITLE", 0, 0, -2.f, 0.f);
|
2012-06-21 19:28:46 +02:00
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
m_homeBtnSettings = _addButton("HOME/SETTINGS", theme.btnFont, L"", 60, 120, 250, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnReloadCache = _addButton("HOME/RELOAD_CACHE", theme.btnFont, L"", 60, 230, 250, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnUpdate = _addButton("HOME/UPDATE", theme.btnFont, L"", 60, 340, 250, 56, theme.btnFontColor);
|
2012-12-21 16:11:24 +01:00
|
|
|
m_homeBtnInstall = _addButton("HOME/INSTALL", theme.btnFont, L"", 330, 120, 250, 56, theme.btnFontColor);
|
2012-11-03 20:16:03 +01:00
|
|
|
m_homeBtnAbout = _addButton("HOME/ABOUT", theme.btnFont, L"", 330, 230, 250, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnExitTo = _addButton("HOME/EXIT_TO", theme.btnFont, L"", 330, 340, 250, 56, theme.btnFontColor);
|
2012-11-29 21:30:05 +01:00
|
|
|
m_homeLblBattery = _addLabel("HOME/BATTERY", theme.btnFont, L"", 0, 420, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
2012-06-21 19:28:46 +02:00
|
|
|
|
|
|
|
_setHideAnim(m_homeBtnSettings, "HOME/SETTINGS", 0, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_homeBtnReloadCache, "HOME/RELOAD_CACHE", 0, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_homeBtnUpdate, "HOME/UPDATE", 0, 0, -2.f, 0.f);
|
2012-12-21 16:11:24 +01:00
|
|
|
_setHideAnim(m_homeBtnInstall, "HOME/INSTALL", 0, 0, -2.f, 0.f);
|
2012-06-21 19:28:46 +02:00
|
|
|
_setHideAnim(m_homeBtnAbout, "HOME/ABOUT", 0, 0, -2.f, 0.f);
|
2012-07-05 21:57:28 +02:00
|
|
|
_setHideAnim(m_homeBtnExitTo, "HOME/EXIT_TO", 0, 0, -2.f, 0.f);
|
2012-11-29 19:48:44 +01:00
|
|
|
_setHideAnim(m_homeLblBattery, "HOME/BATTERY", 0, 0, -2.f, 0.f);
|
2012-06-21 19:28:46 +02:00
|
|
|
|
|
|
|
_textHome();
|
|
|
|
_hideHome(true);
|
2012-07-05 21:57:28 +02:00
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
//ExitTo Menu
|
|
|
|
m_exittoLblTitle = _addTitle("EXIT_TO/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
2012-07-05 21:57:28 +02:00
|
|
|
|
2012-07-29 00:38:46 +02:00
|
|
|
_setHideAnim(m_exittoLblTitle, "EXIT_TO/TITLE", 0, 0, -2.f, 0.f);
|
2012-07-05 21:57:28 +02:00
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
m_homeBtnExitToHBC = _addButton("EXIT_TO/HBC", theme.btnFont, L"", 185, 120, 270, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnExitToMenu = _addButton("EXIT_TO/MENU", theme.btnFont, L"", 185, 180, 270, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnExitToPriiloader = _addButton("EXIT_TO/PRIILOADER", theme.btnFont, L"", 185, 240, 270, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnExitToBootmii = _addButton("EXIT_TO/BOOTMII", theme.btnFont, L"", 185, 300, 270, 56, theme.btnFontColor);
|
|
|
|
m_homeBtnExitToNeek = _addButton("EXIT_TO/NEEK", theme.btnFont, L"", 185, 360, 270, 56, theme.btnFontColor);
|
2012-07-05 21:57:28 +02:00
|
|
|
_setHideAnim(m_homeBtnExitToHBC, "EXIT_TO/HBC", 0, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_homeBtnExitToMenu, "EXIT_TO/MENU", 0, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_homeBtnExitToPriiloader, "EXIT_TO/PRIILOADER", 0, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_homeBtnExitToBootmii, "EXIT_TO/BOOTMII", 0, 0, -2.f, 0.f);
|
2012-07-22 20:02:56 +02:00
|
|
|
_setHideAnim(m_homeBtnExitToNeek, "EXIT_TO/NEEK", 0, 0, -2.f, 0.f);
|
2012-07-05 21:57:28 +02:00
|
|
|
|
|
|
|
_textExitTo();
|
|
|
|
_hideExitTo(true);
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_textHome(void)
|
|
|
|
{
|
2012-11-01 17:39:42 +01:00
|
|
|
m_btnMgr.setText(m_homeLblTitle, VERSION_STRING);
|
2012-06-21 19:28:46 +02:00
|
|
|
m_btnMgr.setText(m_homeBtnSettings, _t("home1", L"Settings"));
|
|
|
|
m_btnMgr.setText(m_homeBtnReloadCache, _t("home2", L"Reload Cache"));
|
|
|
|
m_btnMgr.setText(m_homeBtnUpdate, _t("home3", L"Update"));
|
2012-12-21 16:11:24 +01:00
|
|
|
m_btnMgr.setText(m_homeBtnInstall, _t("home7", L"Install Game"));
|
2012-12-25 14:42:53 +01:00
|
|
|
m_btnMgr.setText(m_homeBtnAbout, _t("home4", L"Credits"));
|
2012-07-05 21:57:28 +02:00
|
|
|
m_btnMgr.setText(m_homeBtnExitTo, _t("home5", L"Exit To"));
|
2012-06-21 19:28:46 +02:00
|
|
|
}
|
2012-07-05 21:57:28 +02:00
|
|
|
|
|
|
|
void CMenu::_textExitTo(void)
|
|
|
|
{
|
|
|
|
m_btnMgr.setText(m_exittoLblTitle, _t("exit_to", L"Exit To"));
|
|
|
|
m_btnMgr.setText(m_homeBtnExitToHBC, _t("hbc", L"Homebrew Channel"));
|
|
|
|
m_btnMgr.setText(m_homeBtnExitToMenu, _t("menu", L"System Menu"));
|
|
|
|
m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("prii", L"Priiloader"));
|
|
|
|
m_btnMgr.setText(m_homeBtnExitToBootmii, _t("bootmii", L"Bootmii"));
|
2012-07-22 20:02:56 +02:00
|
|
|
if(!neek2o())
|
|
|
|
m_btnMgr.setText(m_homeBtnExitToNeek, _t("neek2o", L"neek2o"));
|
|
|
|
else
|
|
|
|
m_btnMgr.setText(m_homeBtnExitToNeek, _t("real", L"Real Nand"));
|
2012-11-01 17:39:42 +01:00
|
|
|
}
|