2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
#include "menu.hpp"
|
2012-08-05 15:48:15 +02:00
|
|
|
#include "channel/channels.h"
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
static const int g_curPage = 4;
|
2016-11-07 16:06:00 +01:00
|
|
|
Config custom_titles;
|
|
|
|
int currentChannelIndex = -1;
|
|
|
|
int amountOfChannels = -1;
|
2012-01-21 21:57:41 +01:00
|
|
|
|
2016-04-03 02:51:40 +02:00
|
|
|
template <class T> static inline T loopNum(T i, T s)
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2016-04-03 02:51:40 +02:00
|
|
|
return (i + s) % s;
|
2012-01-21 21:57:41 +01:00
|
|
|
}
|
|
|
|
|
2017-09-22 00:03:41 +02:00
|
|
|
const CMenu::SOption CMenu::_exitTo[3] = {
|
2012-02-11 22:28:53 +01:00
|
|
|
{ "menu", L"System Menu" },
|
2012-01-21 21:57:41 +01:00
|
|
|
{ "hbc", L"HBC" },
|
2017-09-22 00:03:41 +02:00
|
|
|
{ "wiiu", L"Wii U Menu" },
|
2012-01-21 21:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void CMenu::_hideConfig4(bool instant)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
_hideConfigCommon(instant);
|
|
|
|
|
2013-08-17 15:21:43 +02:00
|
|
|
m_btnMgr.hide(m_config4LblPathManager, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnPathManager, instant);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.hide(m_config4LblSaveFavMode, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnSaveFavMode, instant);
|
2013-08-17 15:21:43 +02:00
|
|
|
m_btnMgr.hide(m_config4LblHome, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnHome, instant);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.hide(m_config4LblReturnTo, instant);
|
|
|
|
m_btnMgr.hide(m_config4LblReturnToVal, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnReturnToM, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnReturnToP, instant);
|
2012-07-05 15:15:23 +02:00
|
|
|
for(u8 i = 0; i < ARRAY_SIZE(m_config4LblUser); ++i)
|
2012-09-13 16:54:17 +02:00
|
|
|
if(m_config4LblUser[i] != -1)
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.hide(m_config4LblUser[i], instant);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_showConfig4(void)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
_showConfigCommon(m_config4Bg, g_curPage);
|
|
|
|
|
2013-08-17 15:21:43 +02:00
|
|
|
m_btnMgr.show(m_config4LblPathManager);
|
|
|
|
m_btnMgr.show(m_config4BtnPathManager);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.show(m_config4LblSaveFavMode);
|
|
|
|
m_btnMgr.show(m_config4BtnSaveFavMode);
|
2013-08-17 15:21:43 +02:00
|
|
|
m_btnMgr.show(m_config4LblHome);
|
|
|
|
m_btnMgr.show(m_config4BtnHome);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.show(m_config4LblReturnTo);
|
|
|
|
m_btnMgr.show(m_config4LblReturnToVal);
|
|
|
|
m_btnMgr.show(m_config4BtnReturnToM);
|
|
|
|
m_btnMgr.show(m_config4BtnReturnToP);
|
|
|
|
|
2012-07-05 15:15:23 +02:00
|
|
|
for(u32 i = 0; i < ARRAY_SIZE(m_config4LblUser); ++i)
|
2012-09-13 16:54:17 +02:00
|
|
|
if(m_config4LblUser[i] != -1)
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.show(m_config4LblUser[i]);
|
2013-03-28 14:02:50 +01:00
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
int i;
|
|
|
|
i = min(max(0, m_cfg.getInt("GENERAL", "exit_to", 0)), (int)ARRAY_SIZE(CMenu::_exitTo) - 1);
|
|
|
|
m_btnMgr.setText(m_config4BtnHome, _t(CMenu::_exitTo[i].id, CMenu::_exitTo[i].text));
|
2012-09-11 14:01:07 +02:00
|
|
|
m_btnMgr.setText(m_config4BtnSaveFavMode, m_cfg.getBool("GENERAL", "save_favorites_mode") ? _t("on", L"On") : _t("off", L"Off"));
|
2012-01-21 21:57:41 +01:00
|
|
|
|
2012-05-04 14:30:43 +02:00
|
|
|
custom_titles.load(fmt("%s/" CTITLES_FILENAME, m_settingsDir.c_str()));
|
2012-01-21 21:57:41 +01:00
|
|
|
|
2012-10-20 00:01:30 +02:00
|
|
|
ChannelHandle.Init(m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
2012-10-04 17:16:04 +02:00
|
|
|
amountOfChannels = ChannelHandle.Count();
|
2016-04-13 18:47:25 +02:00
|
|
|
wstringEx channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");
|
2012-12-27 21:22:40 +01:00
|
|
|
const string ¤tChanId = m_cfg.getString("GENERAL", "returnto");
|
2016-04-13 18:47:25 +02:00
|
|
|
currentChannelIndex = -1;
|
2012-12-27 21:22:40 +01:00
|
|
|
if(!currentChanId.empty())
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2012-12-27 21:22:40 +01:00
|
|
|
for(int i = 0; i < amountOfChannels; i++)
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2012-12-27 21:22:40 +01:00
|
|
|
if(strncmp(currentChanId.c_str(), ChannelHandle.GetId(i), 4) == 0)
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2016-11-07 16:06:00 +01:00
|
|
|
channelName = custom_titles.getWString("TITLES", currentChanId, ChannelHandle.GetName(i));
|
2016-04-13 18:47:25 +02:00
|
|
|
currentChannelIndex = i;
|
2012-01-21 21:57:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_btnMgr.setText(m_config4LblReturnToVal, channelName);
|
|
|
|
}
|
|
|
|
|
|
|
|
int CMenu::_config4(void)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
int change = CONFIG_PAGE_NO_CHANGE;
|
2016-04-13 18:47:25 +02:00
|
|
|
bool curNANDemuView = NANDemuView;
|
|
|
|
NANDemuView = false;
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
2012-09-09 20:35:15 +02:00
|
|
|
while(!m_exit)
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
change = _configCommon();
|
|
|
|
if (change != CONFIG_PAGE_NO_CHANGE)
|
2012-01-21 21:57:41 +01:00
|
|
|
break;
|
|
|
|
if (BTN_A_PRESSED)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
if (m_btnMgr.selected(m_config4BtnHome))
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2018-05-08 15:49:43 +02:00
|
|
|
int exit_to = (int)loopNum(m_cfg.getUInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo));
|
2012-01-21 21:57:41 +01:00
|
|
|
m_cfg.setInt("GENERAL", "exit_to", exit_to);
|
2018-07-09 16:53:35 +02:00
|
|
|
Sys_ExitTo(exit_to);
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnSaveFavMode))
|
|
|
|
{
|
2012-09-11 14:01:07 +02:00
|
|
|
m_cfg.setBool("GENERAL", "save_favorites_mode", !m_cfg.getBool("GENERAL", "save_favorites_mode"));
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
|
|
|
}
|
2013-08-17 15:21:43 +02:00
|
|
|
else if (m_btnMgr.selected(m_config4BtnPathManager))
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2013-08-17 15:21:43 +02:00
|
|
|
_hideConfig4();
|
|
|
|
_Paths();
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnReturnToP))
|
|
|
|
{
|
2016-04-13 18:47:25 +02:00
|
|
|
if(currentChannelIndex >= (amountOfChannels - 1))
|
2012-01-21 21:57:41 +01:00
|
|
|
m_cfg.remove("GENERAL", "returnto");
|
|
|
|
else
|
2016-04-13 18:47:25 +02:00
|
|
|
m_cfg.setString("GENERAL", "returnto", ChannelHandle.GetId(currentChannelIndex + 1));
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnReturnToM))
|
|
|
|
{
|
2016-04-13 18:47:25 +02:00
|
|
|
if(currentChannelIndex == -1)
|
|
|
|
currentChannelIndex = amountOfChannels;
|
|
|
|
if((currentChannelIndex - 1) == -1)
|
2012-01-21 21:57:41 +01:00
|
|
|
m_cfg.remove("GENERAL", "returnto");
|
|
|
|
else
|
2016-04-13 18:47:25 +02:00
|
|
|
m_cfg.setString("GENERAL", "returnto", ChannelHandle.GetId(currentChannelIndex - 1));
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-13 18:47:25 +02:00
|
|
|
NANDemuView = curNANDemuView;
|
2012-01-21 21:57:41 +01:00
|
|
|
_hideConfig4();
|
2016-11-07 16:06:00 +01:00
|
|
|
if(custom_titles.loaded())
|
|
|
|
custom_titles.unload();
|
2012-05-04 05:46:18 +02:00
|
|
|
return change;
|
2012-01-21 21:57:41 +01:00
|
|
|
}
|
|
|
|
|
2012-11-03 20:16:03 +01:00
|
|
|
void CMenu::_initConfig4Menu()
|
2012-01-21 21:57:41 +01:00
|
|
|
{
|
2012-11-03 20:16:03 +01:00
|
|
|
_addUserLabels(m_config4LblUser, ARRAY_SIZE(m_config4LblUser), "CONFIG4");
|
|
|
|
m_config4Bg = _texture("CONFIG4/BG", "texture", theme.bg, false);
|
2013-08-17 15:21:43 +02:00
|
|
|
|
2013-11-04 20:46:23 +01:00
|
|
|
m_config4LblHome = _addLabel("CONFIG4/WIIMENU", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_config4BtnHome = _addButton("CONFIG4/WIIMENU_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
|
|
|
|
m_config4LblSaveFavMode = _addLabel("CONFIG4/SAVE_FAVMODE", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_config4BtnSaveFavMode = _addButton("CONFIG4/SAVE_FAVMODE_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor);
|
|
|
|
m_config4LblPathManager = _addLabel("CONFIG4/PATH_MANAGER", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_config4BtnPathManager = _addButton("CONFIG4/PATH_MANAGER_BTN", theme.btnFont, L"", 420, 250, 200, 48, theme.btnFontColor);
|
|
|
|
m_config4LblReturnTo = _addLabel("CONFIG4/RETURN_TO", theme.lblFont, L"", 20, 305, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_config4LblReturnToVal = _addLabel("CONFIG4/RETURN_TO_BTN", theme.btnFont, L"", 468, 310, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
|
|
|
m_config4BtnReturnToM = _addPicButton("CONFIG4/RETURN_TO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 310, 48, 48);
|
|
|
|
m_config4BtnReturnToP = _addPicButton("CONFIG4/RETURN_TO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 310, 48, 48);
|
2012-01-21 21:57:41 +01:00
|
|
|
//
|
2013-11-04 20:46:23 +01:00
|
|
|
_setHideAnim(m_config4LblPathManager, "CONFIG4/PATH_MANAGER", 50, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_config4BtnPathManager, "CONFIG4/PATH_MANAGER_BTN", -50, 0, 1.f, 0.f);
|
|
|
|
_setHideAnim(m_config4LblSaveFavMode, "CONFIG4/SAVE_FAVMODE", 50, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_config4BtnSaveFavMode, "CONFIG4/SAVE_FAVMODE_BTN", -50, 0, 1.f, 0.f);
|
|
|
|
_setHideAnim(m_config4LblHome, "CONFIG4/WIIMENU", 50, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_config4BtnHome, "CONFIG4/WIIMENU_BTN", -50, 0, 1.f, 0.f);
|
|
|
|
_setHideAnim(m_config4LblReturnTo, "CONFIG4/RETURN_TO", 50, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_config4LblReturnToVal, "CONFIG4/RETURN_TO_BTN", -50, 0, 1.f, 0.f);
|
|
|
|
_setHideAnim(m_config4BtnReturnToM, "CONFIG4/RETURN_TO_MINUS", -50, 0, 1.f, 0.f);
|
|
|
|
_setHideAnim(m_config4BtnReturnToP, "CONFIG4/RETURN_TO_PLUS", -50, 0, 1.f, 0.f);
|
2012-01-21 21:57:41 +01:00
|
|
|
_hideConfig4(true);
|
|
|
|
_textConfig4();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_textConfig4(void)
|
|
|
|
{
|
|
|
|
m_btnMgr.setText(m_config4LblHome, _t("cfgc1", L"Exit To"));
|
|
|
|
m_btnMgr.setText(m_config4LblSaveFavMode, _t("cfgd5", L"Save favorite mode state"));
|
2013-08-17 15:21:43 +02:00
|
|
|
m_btnMgr.setText(m_config4LblPathManager, _t("cfgd4", L"Path Manager"));
|
|
|
|
m_btnMgr.setText(m_config4BtnPathManager, _t("cfgc5", L"Go"));
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.setText(m_config4LblReturnTo, _t("cfgg21", L"Return To Channel"));
|
|
|
|
}
|