2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
#include "menu.hpp"
|
|
|
|
#include "loader/sys.h"
|
|
|
|
#include "channels.h"
|
|
|
|
#include "gecko.h"
|
|
|
|
#include "defines.h"
|
|
|
|
#include "nand.hpp"
|
|
|
|
|
|
|
|
static const int g_curPage = 4;
|
|
|
|
|
|
|
|
static inline int loopNum(int i, int s)
|
|
|
|
{
|
|
|
|
return i < 0 ? (s - (-i % s)) % s : i % s;
|
|
|
|
}
|
|
|
|
|
|
|
|
int currentChannelIndex = -1;
|
|
|
|
int amountOfChannels = -1;
|
|
|
|
|
2012-02-11 13:03:46 +01:00
|
|
|
const CMenu::SOption CMenu::_exitTo[6] = {
|
|
|
|
{ "def", L"Default" },
|
2012-02-11 22:28:53 +01:00
|
|
|
{ "menu", L"System Menu" },
|
2012-01-21 21:57:41 +01:00
|
|
|
{ "hbc", L"HBC" },
|
2012-02-11 13:03:46 +01:00
|
|
|
{ "prii", L"Priiloader" },
|
2012-01-21 21:57:41 +01:00
|
|
|
{ "disabled", L"Disabled" },
|
|
|
|
{ "bootmii", L"BootMii" }
|
|
|
|
};
|
|
|
|
|
|
|
|
void CMenu::_hideConfig4(bool instant)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
_hideConfigCommon(instant);
|
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.hide(m_config4LblHome, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnHome, instant);
|
|
|
|
m_btnMgr.hide(m_config4LblSaveFavMode, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnSaveFavMode, instant);
|
|
|
|
m_btnMgr.hide(m_config4LblCategoryOnBoot, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnCategoryOnBoot, instant);
|
|
|
|
m_btnMgr.hide(m_config4LblReturnTo, instant);
|
|
|
|
m_btnMgr.hide(m_config4LblReturnToVal, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnReturnToM, instant);
|
|
|
|
m_btnMgr.hide(m_config4BtnReturnToP, instant);
|
|
|
|
for (u32 i = 0; i < ARRAY_SIZE(m_config4LblUser); ++i)
|
|
|
|
if (m_config4LblUser[i] != -1u)
|
|
|
|
m_btnMgr.hide(m_config4LblUser[i], instant);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_showConfig4(void)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
_showConfigCommon(m_config4Bg, g_curPage);
|
|
|
|
|
2012-01-21 21:57:41 +01:00
|
|
|
m_btnMgr.show(m_config4LblHome);
|
|
|
|
m_btnMgr.show(m_config4BtnHome);
|
|
|
|
m_btnMgr.show(m_config4LblSaveFavMode);
|
|
|
|
m_btnMgr.show(m_config4BtnSaveFavMode);
|
|
|
|
m_btnMgr.show(m_config4LblCategoryOnBoot);
|
|
|
|
m_btnMgr.show(m_config4BtnCategoryOnBoot);
|
|
|
|
m_btnMgr.show(m_config4LblReturnTo);
|
|
|
|
m_btnMgr.show(m_config4LblReturnToVal);
|
|
|
|
m_btnMgr.show(m_config4BtnReturnToM);
|
|
|
|
m_btnMgr.show(m_config4BtnReturnToP);
|
|
|
|
|
|
|
|
for (u32 i = 0; i < ARRAY_SIZE(m_config4LblUser); ++i)
|
|
|
|
if (m_config4LblUser[i] != -1u)
|
|
|
|
m_btnMgr.show(m_config4LblUser[i]);
|
|
|
|
|
|
|
|
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));
|
|
|
|
m_btnMgr.setText(m_config4BtnSaveFavMode, m_cfg.getBool("GENERAL", "favorites_on_startup") ? _t("on", L"On") : _t("off", L"Off"));
|
|
|
|
m_btnMgr.setText(m_config4BtnCategoryOnBoot, m_cat.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off"));
|
|
|
|
|
|
|
|
Config titles, custom_titles;
|
2012-05-04 14:30:43 +02:00
|
|
|
titles.load(fmt("%s/" TITLES_FILENAME, m_settingsDir.c_str()));
|
|
|
|
custom_titles.load(fmt("%s/" CTITLES_FILENAME, m_settingsDir.c_str()));
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
wstringEx channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");
|
|
|
|
|
|
|
|
string langCode = m_loc.getString(m_curLanguage, "gametdb_code", "EN");
|
|
|
|
|
|
|
|
Nand::Instance()->Disable_Emu();
|
|
|
|
|
|
|
|
m_channels.Init(0x00010001, langCode, true);
|
|
|
|
amountOfChannels = m_channels.Count();
|
|
|
|
|
|
|
|
string currentChanId = m_cfg.getString("GENERAL", "returnto" );
|
|
|
|
if (currentChanId.size() > 0)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < amountOfChannels; i++)
|
|
|
|
{
|
|
|
|
if (currentChanId == m_channels.GetId(i))
|
|
|
|
{
|
|
|
|
channelName = custom_titles.getWString("TITLES", currentChanId, titles.getWString("TITLES", currentChanId, m_channels.GetName(i)));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-11 20:47:24 +01:00
|
|
|
if(m_current_view == COVERFLOW_CHANNEL && m_cfg.getInt("NAND", "emulation", 0) > 0)
|
|
|
|
Nand::Instance()->Enable_Emu();
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
m_btnMgr.setText(m_config4LblReturnToVal, channelName);
|
|
|
|
}
|
|
|
|
|
|
|
|
int CMenu::_config4(void)
|
|
|
|
{
|
2012-05-04 05:46:18 +02:00
|
|
|
int change = CONFIG_PAGE_NO_CHANGE;
|
2012-01-21 21:57:41 +01:00
|
|
|
|
|
|
|
_showConfig4();
|
|
|
|
while (true)
|
|
|
|
{
|
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
|
|
|
{
|
|
|
|
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);
|
|
|
|
Sys_ExitTo(exit_to);
|
2012-02-20 21:50:15 +01:00
|
|
|
m_disable_exit = exit_to == EXIT_TO_DISABLE;
|
2012-01-21 21:57:41 +01:00
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnSaveFavMode))
|
|
|
|
{
|
|
|
|
m_cfg.setBool("GENERAL", "favorites_on_startup", !m_cfg.getBool("GENERAL", "favorites_on_startup"));
|
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnCategoryOnBoot))
|
|
|
|
{
|
|
|
|
m_cat.setBool("GENERAL", "category_on_start", !m_cat.getBool("GENERAL", "category_on_start", false));
|
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnReturnToP))
|
|
|
|
{
|
|
|
|
currentChannelIndex = (currentChannelIndex >= amountOfChannels - 1) ? -1 : currentChannelIndex + 1;
|
|
|
|
if (currentChannelIndex == -1)
|
|
|
|
m_cfg.remove("GENERAL", "returnto");
|
|
|
|
else
|
|
|
|
m_cfg.setString("GENERAL", "returnto", m_channels.GetId(currentChannelIndex));
|
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
else if (m_btnMgr.selected(m_config4BtnReturnToM))
|
|
|
|
{
|
|
|
|
if (currentChannelIndex == -1) currentChannelIndex = amountOfChannels;
|
|
|
|
currentChannelIndex--;
|
|
|
|
if (currentChannelIndex == -1)
|
|
|
|
m_cfg.remove("GENERAL", "returnto");
|
|
|
|
else
|
|
|
|
m_cfg.setString("GENERAL", "returnto", m_channels.GetId(currentChannelIndex));
|
|
|
|
_showConfig4();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_hideConfig4();
|
2012-05-04 05:46:18 +02:00
|
|
|
return change;
|
2012-01-21 21:57:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_initConfig4Menu(CMenu::SThemeData &theme)
|
|
|
|
{
|
|
|
|
_addUserLabels(theme, m_config4LblUser, ARRAY_SIZE(m_config4LblUser), "CONFIG4");
|
|
|
|
m_config4Bg = _texture(theme.texSet, "CONFIG4/BG", "texture", theme.bg);
|
|
|
|
m_config4LblHome = _addLabel(theme, "CONFIG4/WIIMENU", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
2012-02-10 19:45:42 +01:00
|
|
|
m_config4BtnHome = _addButton(theme, "CONFIG4/WIIMENU_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_config4LblSaveFavMode = _addLabel(theme, "CONFIG4/SAVE_FAVMODE", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
2012-02-10 19:45:42 +01:00
|
|
|
m_config4BtnSaveFavMode = _addButton(theme, "CONFIG4/SAVE_FAVMODE_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_config4LblCategoryOnBoot = _addLabel(theme, "CONFIG4/CAT_ON_START", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
2012-02-10 19:45:42 +01:00
|
|
|
m_config4BtnCategoryOnBoot = _addButton(theme, "CONFIG4/CAT_ON_START_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
|
2012-01-21 21:57:41 +01:00
|
|
|
m_config4LblReturnTo = _addLabel(theme, "CONFIG4/RETURN_TO", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_config4LblReturnToVal = _addLabel(theme, "CONFIG4/RETURN_TO_BTN", theme.btnFont, L"", 426, 310, 118, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
|
|
|
m_config4BtnReturnToM = _addPicButton(theme, "CONFIG4/RETURN_TO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 370, 310, 56, 56);
|
|
|
|
m_config4BtnReturnToP = _addPicButton(theme, "CONFIG4/RETURN_TO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
|
|
|
|
//
|
|
|
|
_setHideAnim(m_config4LblHome, "CONFIG4/WIIMENU", 100, 0, -2.f, 0.f);
|
2012-02-10 19:45:42 +01:00
|
|
|
_setHideAnim(m_config4BtnHome, "CONFIG4/WIIMENU_BTN", 0, 0, 1.f, -1.f);
|
2012-01-21 21:57:41 +01:00
|
|
|
_setHideAnim(m_config4LblSaveFavMode, "CONFIG4/SAVE_FAVMODE", 100, 0, -2.f, 0.f);
|
2012-02-10 19:45:42 +01:00
|
|
|
_setHideAnim(m_config4BtnSaveFavMode, "CONFIG4/SAVE_FAVMODE_BTN", 0, 0, 1.f, -1.f);
|
2012-01-21 21:57:41 +01:00
|
|
|
_setHideAnim(m_config4LblCategoryOnBoot, "CONFIG4/CAT_ON_START", 100, 0, -2.f, 0.f);
|
2012-02-10 19:45:42 +01:00
|
|
|
_setHideAnim(m_config4BtnCategoryOnBoot, "CONFIG4/CAT_ON_START_BTN", 0, 0, 1.f, -1.f);
|
2012-01-21 21:57:41 +01:00
|
|
|
_setHideAnim(m_config4LblReturnTo, "CONFIG4/RETURN_TO", 100, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_config4LblReturnToVal, "CONFIG4/RETURN_TO_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_config4BtnReturnToM, "CONFIG4/RETURN_TO_MINUS", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_config4BtnReturnToP, "CONFIG4/RETURN_TO_PLUS", 0, 0, 1.f, -1.f);
|
|
|
|
_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"));
|
|
|
|
m_btnMgr.setText(m_config4LblCategoryOnBoot, _t("cfgd7", L"Show categories on boot"));
|
|
|
|
m_btnMgr.setText(m_config4LblReturnTo, _t("cfgg21", L"Return To Channel"));
|
|
|
|
}
|