- more config menu's cleanup and restructuring.

This commit is contained in:
Fledge68 2022-06-24 13:05:59 -05:00
parent 6b1dcabf36
commit 3335827419
8 changed files with 169 additions and 298 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -1276,7 +1276,7 @@ void CMenu::_buildMenus(void)
_initCheatSettingsMenu();
_initSourceMenu();
_initCfgSrc();
_initCfgHB();
_initConfigHB();
_initPluginSettingsMenu();
_initCategorySettingsMenu();
_initGameInfoMenu();
@ -1980,7 +1980,7 @@ void CMenu::_updateText(void)
_textCheatSettings();
_textConfigGC();
_textPartitionsCfg();
_textCfgHB();
_textConfigHB();
_textGame();
_textDownload();
_textCode();

View File

@ -883,7 +883,7 @@ private:
void _initCheatSettingsMenu();
void _initSourceMenu();
void _initCfgSrc();
void _initCfgHB();
void _initConfigHB();
void _initPluginSettingsMenu();
void _initCategorySettingsMenu();
void _initGameInfoMenu();
@ -897,7 +897,7 @@ private:
//
void _textSource(void);
void _textCfgSrc(void);
void _textCfgHB(void);
void _textConfigHB(void);
void _textPluginSettings(void);
void _textCategorySettings(void);
void _textCheatSettings(void);
@ -926,17 +926,17 @@ private:
void _hideCheatSettings(bool instant = false);
void _hideError(bool instant = false);
void _hideMain(bool instant = false);
void _hideConfigMain(bool instant = false);
void _hideConfigMain(bool instant = true);
void _hideConfigButtons(bool instant = false);
void _hideConfigGC(bool instant = false);
void _hideConfigGCPage(bool instant = false);
void _hideConfigGC(bool instant = true);
void _hideConfigHB(bool instant = true);
void _hidePartitionsCfg(bool instant = false);
void _hideGame(bool instant = false);
void _hideDownload(bool instant = false);
void _hideSettings(bool instant = false);
void _hideCode(bool instant = false);
void _hideAbout(bool instant = false);
void _hideBoot(bool instant = false);
void _hideBoot(bool instant = true);
void _hideWBFS(bool instant = false);
void _hideCFTheme(bool instant = false);
void _hideGameSettings(bool instant = false);
@ -960,8 +960,8 @@ private:
void _showError(void);
void _showMain(void);
void _showConfigMain(int curPage);
void _showConfigGC(void);
void _showConfigGCPage(void);
void _showConfigGC(int curPage);
void _showConfigHB(void);
void _showPartitionsCfg(void);
void _showNandEmu(void);
void _showGame(void);
@ -1011,19 +1011,11 @@ private:
int _getCFVersion(void);
//
void _configMain(void);
wstringEx _getChannelName(void);
void _configGC(void);
void _partitionsCfg(void);
int _NandEmuCfg(void);
int _AutoExtractSave(string gameId);
int _FlashSave(string gameId);
enum configPageChanges
{
CONFIG_PAGE_DEC = -1,
CONFIG_PAGE_NO_CHANGE = 0,
CONFIG_PAGE_INC = 1,
CONFIG_PAGE_BACK,
};
void _game(bool launch = false);
void _downloadUrl(const char *url, u8 **dl_file, u32 *dl_size);
void _download(string gameId = string(), int dl_type = 0);
@ -1043,7 +1035,7 @@ private:
void _CheatSettings();
bool _Source();
void _CfgSrc();
void _CfgHB();
void _ConfigHB();
void _PluginSettings();
void _checkboxesMenu(u8 md);
void _SM_Editor();

View File

@ -2,24 +2,12 @@
#include "menu.hpp"
#include "channel/nand_save.hpp"
TexData m_bootBg;
s16 m_bootLblTitle;
s16 m_bootBtnBack;
s16 m_bootLblUser[4];
s16 m_bootLblLoadCIOS;
s16 m_bootBtnLoadCIOS;
s16 m_bootLblCIOSrev;
s16 m_bootLblCurCIOSrev;
s16 m_bootLblCIOSrevM;
s16 m_bootLblCIOSrevP;
s16 m_bootLblUSBPort;
s16 m_bootBtnUSBPort;
s16 m_bootLblSDOnly;
s16 m_bootBtnSDOnly;
u8 set_port = 0;
void CMenu::_hideBoot(bool instant)
@ -30,50 +18,44 @@ void CMenu::_hideBoot(bool instant)
if(m_bootLblUser[i] != -1)
m_btnMgr.hide(m_bootLblUser[i], instant);
m_btnMgr.hide(m_bootLblLoadCIOS, instant);
m_btnMgr.hide(m_bootBtnLoadCIOS, instant);
m_btnMgr.hide(m_bootLblCIOSrev, instant);
m_btnMgr.hide(m_bootLblCurCIOSrev, instant);
m_btnMgr.hide(m_bootLblCIOSrevM, instant);
m_btnMgr.hide(m_bootLblCIOSrevP, instant);
m_btnMgr.hide(m_bootLblUSBPort, instant);
m_btnMgr.hide(m_bootBtnUSBPort, instant);
m_btnMgr.hide(m_bootLblSDOnly, instant);
m_btnMgr.hide(m_bootBtnSDOnly, instant);
_hideConfigButtons(instant);
}
void CMenu::_showBoot()
{
_setBg(m_bootBg, m_bootBg);
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]);
m_btnMgr.setText(m_bootBtnLoadCIOS, _optBoolToString(cur_load));
m_btnMgr.setText(m_bootBtnUSBPort, wfmt(L"%i", set_port));
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));
if(cur_ios > 0)
m_btnMgr.setText(m_bootLblCurCIOSrev, wfmt(L"%i", cur_ios));
m_btnMgr.setText(m_configLbl2Val, wfmt(L"%i", cur_ios));
else
m_btnMgr.setText(m_bootLblCurCIOSrev, L"AUTO");// cIOS 249 unless the user changed it via the meta.xml
m_btnMgr.show(m_bootLblLoadCIOS);
m_btnMgr.show(m_bootBtnLoadCIOS);
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"));
m_btnMgr.show(m_bootLblCIOSrev);
m_btnMgr.show(m_bootLblCurCIOSrev);
m_btnMgr.show(m_bootLblCIOSrevM);
m_btnMgr.show(m_bootLblCIOSrevP);
m_btnMgr.show(m_configLbl1);
m_btnMgr.show(m_configBtn1);
m_btnMgr.show(m_bootLblUSBPort);
m_btnMgr.show(m_bootBtnUSBPort);
m_btnMgr.show(m_configLbl2);
m_btnMgr.show(m_configLbl2Val);
m_btnMgr.show(m_configBtn2M);
m_btnMgr.show(m_configBtn2P);
m_btnMgr.setText(m_bootBtnSDOnly, m_cfg.getBool("GENERAL", "sd_only") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.show(m_bootLblSDOnly);
m_btnMgr.show(m_bootBtnSDOnly);
m_btnMgr.show(m_configLbl3);
m_btnMgr.show(m_configBtn3);
m_btnMgr.show(m_configLbl4);
m_btnMgr.show(m_configBtn4);
}
void CMenu::_Boot(void)
@ -104,14 +86,14 @@ void CMenu::_Boot(void)
{
if(m_btnMgr.selected(m_bootBtnBack))
break;
else if(m_btnMgr.selected(m_bootBtnLoadCIOS))
else if(m_btnMgr.selected(m_configBtn1))
{
cur_load = !cur_load;
m_btnMgr.setText(m_bootBtnLoadCIOS, _optBoolToString(cur_load));
m_btnMgr.setText(m_configBtn1, _optBoolToString(cur_load));
}
else if(m_btnMgr.selected(m_bootLblCIOSrevM) || m_btnMgr.selected(m_bootLblCIOSrevP))
else if(m_btnMgr.selected(m_configBtn2M) || m_btnMgr.selected(m_configBtn2P))
{
bool increase = m_btnMgr.selected(m_bootLblCIOSrevP);
bool increase = m_btnMgr.selected(m_configBtn2P);
CIOSItr itr = _installed_cios.find(cur_ios);
if(increase)
{
@ -127,19 +109,19 @@ void CMenu::_Boot(void)
}
cur_ios = itr->first;
if(cur_ios > 0)
m_btnMgr.setText(m_bootLblCurCIOSrev, wfmt(L"%i", cur_ios));
m_btnMgr.setText(m_configLbl2Val, wfmt(L"%i", cur_ios));
else
m_btnMgr.setText(m_bootLblCurCIOSrev, L"AUTO");
m_btnMgr.setText(m_configLbl2Val, L"AUTO");
}
else if(m_btnMgr.selected(m_bootBtnUSBPort))
else if(m_btnMgr.selected(m_configBtn3))
{
set_port = !set_port;
m_btnMgr.setText(m_bootBtnUSBPort, wfmt(L"%i", set_port));
m_btnMgr.setText(m_configBtn3, wfmt(L"%i", set_port));
}
else if (m_btnMgr.selected(m_bootBtnSDOnly))
else if (m_btnMgr.selected(m_configBtn4))
{
cur_sd = !cur_sd;
m_btnMgr.setText(m_bootBtnSDOnly, cur_sd ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_configBtn4, cur_sd ? _t("yes", L"Yes") : _t("no", L"No"));
}
}
}
@ -164,40 +146,14 @@ void CMenu::_Boot(void)
void CMenu::_initBoot(void)
{
m_bootBg = _texture("BOOT/BG", "texture", theme.bg, false);
_addUserLabels(m_bootLblUser, ARRAY_SIZE(m_bootLblUser), "BOOT");
m_bootLblTitle = _addLabel("BOOT/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_bootBtnBack = _addButton("BOOT/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_bootLblLoadCIOS = _addLabel("BOOT/LOAD_CIOS", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_bootBtnLoadCIOS = _addButton("BOOT/LOAD_CIOS_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
m_bootLblCIOSrev = _addLabel("BOOT/CIOS_REV", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_bootLblCurCIOSrev = _addLabel("BOOT/CIOS_REV_BTN", theme.btnFont, L"", 468, 190, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_bootLblCIOSrevM = _addPicButton("BOOT/CIOS_REV_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 190, 48, 48);
m_bootLblCIOSrevP = _addPicButton("BOOT/CIOS_REV_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 190, 48, 48);
m_bootLblUSBPort = _addLabel("BOOT/USB_PORT", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_bootBtnUSBPort = _addButton("BOOT/USB_PORT_BTN", theme.btnFont, L"", 420, 250, 200, 48, theme.btnFontColor);
m_bootLblSDOnly = _addLabel("BOOT/SD_ONLY", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_bootBtnSDOnly = _addButton("BOOT/SD_ONLY_BTN", theme.btnFont, L"", 420, 310, 200, 48, theme.btnFontColor);
_setHideAnim(m_bootLblTitle, "BOOT/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_bootBtnBack, "BOOT/BACK_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_bootLblLoadCIOS, "BOOT/LOAD_CIOS", 50, 0, -2.f, 0.f);
_setHideAnim(m_bootBtnLoadCIOS, "BOOT/LOAD_CIOS_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_bootLblCIOSrev, "BOOT/CIOS_REV", 50, 0, -2.f, 0.f);
_setHideAnim(m_bootLblCurCIOSrev, "BOOT/CIOS_REV_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_bootLblCIOSrevM, "BOOT/CIOS_REV_MINUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_bootLblCIOSrevP, "BOOT/CIOS_REV_PLUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_bootLblUSBPort, "BOOT/USB_PORT", 50, 0, -2.f, 0.f);
_setHideAnim(m_bootBtnUSBPort, "BOOT/USB_PORT_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_bootLblSDOnly, "BOOT/SD_ONLY", 50, 0, -2.f, 0.f);
_setHideAnim(m_bootBtnSDOnly, "BOOT/SD_ONLY_BTN", -50, 0, 1.f, 0.f);
_hideBoot(true);
_textBoot();
@ -206,9 +162,5 @@ void CMenu::_initBoot(void)
void CMenu::_textBoot(void)
{
m_btnMgr.setText(m_bootLblTitle, _t("cfgbt1", L"Startup Settings"));
m_btnMgr.setText(m_bootLblLoadCIOS, _t("cfgbt2", L"Force Load cIOS"));
m_btnMgr.setText(m_bootLblCIOSrev, _t("cfgbt3", L"Force cIOS Revision"));
m_btnMgr.setText(m_bootLblUSBPort, _t("cfgbt4", L"USB Port"));
m_btnMgr.setText(m_bootLblSDOnly, _t("cfg719", L"Mount SD only"));
m_btnMgr.setText(m_bootBtnBack, _t("cfg10", L"Back"));
}

View File

@ -68,7 +68,8 @@ bool CMenu::_code(char code[4], bool erase)
if(m_btnMgr.selected(m_codeBtnKey[i]))
{
codeLbl[n * 2] = 'X';
code[n++] = '0' + i;
code[n] = '0' + i;
n++;
m_btnMgr.setText(m_codeLblTitle, codeLbl);
break;
}
@ -92,7 +93,8 @@ bool CMenu::_code(char code[4], bool erase)
if(c != -1)
{
codeLbl[n * 2] = 'X';
code[n++] = '0' + c;
code[n] = '0' + c;
n++;
m_btnMgr.setText(m_codeLblTitle, codeLbl);
}
}

View File

@ -11,8 +11,6 @@ s16 m_configGCLblPage;
s16 m_configGCBtnPageM;
s16 m_configGCBtnPageP;
static int curPage;
template <class T> static inline T loopNum(T i, T s)
{
return (i + s) % s;
@ -21,18 +19,19 @@ template <class T> static inline T loopNum(T i, T s)
void CMenu::_hideConfigGC(bool instant)
{
m_btnMgr.hide(m_configGCLblTitle, instant);
m_btnMgr.hide(m_configGCBtnBack, instant);
m_btnMgr.hide(m_configGCLblPage, instant);
m_btnMgr.hide(m_configGCBtnPageM, instant);
m_btnMgr.hide(m_configGCBtnPageP, instant);
m_btnMgr.hide(m_configGCBtnBack, instant);
for(u8 i = 0; i < ARRAY_SIZE(m_configGCLblUser); ++i)
if(m_configGCLblUser[i] != -1)
m_btnMgr.hide(m_configGCLblUser[i], instant);
_hideConfigButtons(instant);
}
void CMenu::_showConfigGC(void)
void CMenu::_showConfigGC(int curPage)
{
_setBg(m_configGCBg, m_configGCBg);
m_btnMgr.show(m_configGCLblTitle);
m_btnMgr.show(m_configGCBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_configGCLblUser); ++i)
@ -42,14 +41,10 @@ void CMenu::_showConfigGC(void)
m_btnMgr.show(m_configGCLblPage);
m_btnMgr.show(m_configGCBtnPageM);
m_btnMgr.show(m_configGCBtnPageP);
_showConfigGCPage();
}
void CMenu::_showConfigGCPage(void)
{
_hideConfigButtons(true);
m_btnMgr.setText(m_configGCLblPage, wfmt(L"%i / %i", curPage, 2));
_hideConfigButtons(true);
int i;
if(curPage == 1)
{
@ -108,10 +103,9 @@ void CMenu::_configGC(void)
{
int i;
bool j;
curPage = 1;
int curPage = 1;
SetupInput();
_setBg(m_configGCBg, m_configGCBg);
_showConfigGC();
_showConfigGC(curPage);
while(!m_exit)
{
_mainLoopCommon();
@ -128,7 +122,7 @@ void CMenu::_configGC(void)
curPage = 2;
if(!BTN_A_PRESSED)
m_btnMgr.click(m_configGCBtnPageM);
_showConfigGCPage();
_showConfigGC(curPage);
}
else if(BTN_RIGHT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configGCBtnPageP)))
{
@ -137,7 +131,7 @@ void CMenu::_configGC(void)
curPage = 1;
if(!BTN_A_PRESSED)
m_btnMgr.click(m_configGCBtnPageP);
_showConfigGCPage();
_showConfigGC(curPage);
}
else if(BTN_A_PRESSED)
{

View File

@ -5,47 +5,9 @@ s16 m_cfghbLblTitle;
s16 m_cfghbBtnBack;
s16 m_cfghbLblUser[4];
s16 m_cfghbLblHideHB;
s16 m_cfghbBtnHideHB;
s16 m_cfghbLblSmallbox;
s16 m_cfghbBtnSmallbox;
s16 m_cfghbLblBoxMode;
s16 m_cfghbBtnBoxMode;
s16 m_cfghbLblPartition;
s16 m_cfghbLblPartitionVal;
s16 m_cfghbBtnPartitionP;
s16 m_cfghbBtnPartitionM;
TexData m_cfghbBg;
static void _showCfgHB(void)
{
m_btnMgr.show(m_cfghbLblTitle);
m_btnMgr.show(m_cfghbBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_cfghbLblUser); ++i)
if(m_cfghbLblUser[i] != -1)
m_btnMgr.show(m_cfghbLblUser[i]);
m_btnMgr.show(m_cfghbLblHideHB);
m_btnMgr.show(m_cfghbBtnHideHB);
m_btnMgr.show(m_cfghbLblSmallbox);
m_btnMgr.show(m_cfghbBtnSmallbox);
m_btnMgr.show(m_cfghbLblBoxMode);
m_btnMgr.show(m_cfghbBtnBoxMode);
m_btnMgr.show(m_cfghbLblPartition);
m_btnMgr.show(m_cfghbLblPartitionVal);
m_btnMgr.show(m_cfghbBtnPartitionP);
m_btnMgr.show(m_cfghbBtnPartitionM);
}
static void _hideCfgHB(bool instant)
void CMenu::_hideConfigHB(bool instant)
{
m_btnMgr.hide(m_cfghbLblTitle, instant);
m_btnMgr.hide(m_cfghbBtnBack, instant);
@ -53,34 +15,50 @@ static void _hideCfgHB(bool instant)
if(m_cfghbLblUser[i] != -1)
m_btnMgr.hide(m_cfghbLblUser[i], instant);
m_btnMgr.hide(m_cfghbLblHideHB, instant);
m_btnMgr.hide(m_cfghbBtnHideHB, instant);
m_btnMgr.hide(m_cfghbLblSmallbox, instant);
m_btnMgr.hide(m_cfghbBtnSmallbox, instant);
m_btnMgr.hide(m_cfghbLblBoxMode, instant);
m_btnMgr.hide(m_cfghbBtnBoxMode, instant);
m_btnMgr.hide(m_cfghbLblPartition, instant);
m_btnMgr.hide(m_cfghbLblPartitionVal, instant);
m_btnMgr.hide(m_cfghbBtnPartitionP, instant);
m_btnMgr.hide(m_cfghbBtnPartitionM, instant);
_hideConfigButtons(instant);
}
void CMenu::_CfgHB(void)
void CMenu::_showConfigHB(void)
{
m_btnMgr.setText(m_cfghbBtnHideHB, m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_cfghbBtnSmallbox, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_cfghbBtnBoxMode, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
_setBg(m_cfghbBg, m_cfghbBg);
m_btnMgr.show(m_cfghbLblTitle);
m_btnMgr.show(m_cfghbBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_cfghbLblUser); ++i)
if(m_cfghbLblUser[i] != -1)
m_btnMgr.show(m_cfghbLblUser[i]);
m_btnMgr.setText(m_configLbl1, _t("cfghb5", L"Hide homebrew button"));
m_btnMgr.setText(m_configLbl2, _t("cfghb2", L"Coverflow Smallbox"));
m_btnMgr.setText(m_configLbl3, _t("cfghb4", L"Box Mode"));
m_btnMgr.setText(m_configLbl4, _t("cfghb3", L"Homebrew Partition"));
m_btnMgr.setText(m_configBtn1, m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_configBtn2, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_configBtn3, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
currentPartition = m_cfg.getInt(HOMEBREW_DOMAIN, "partition", 0);
const char *partitionname = DeviceName[currentPartition];
m_btnMgr.setText(m_cfghbLblPartitionVal, upperCase(partitionname));
m_btnMgr.setText(m_configLbl4Val, upperCase(partitionname));
m_btnMgr.show(m_configLbl1);
m_btnMgr.show(m_configBtn1);
m_btnMgr.show(m_configLbl2);
m_btnMgr.show(m_configBtn2);
m_btnMgr.show(m_configLbl3);
m_btnMgr.show(m_configBtn3);
m_btnMgr.show(m_configLbl4);
m_btnMgr.show(m_configLbl4Val);
m_btnMgr.show(m_configBtn4P);
m_btnMgr.show(m_configBtn4M);
}
void CMenu::_ConfigHB(void)
{
SetupInput();
_setBg(m_cfghbBg, m_cfghbBg);
_showCfgHB();
_showConfigHB();
while(!m_exit)
{
@ -95,39 +73,39 @@ void CMenu::_CfgHB(void)
{
if(m_btnMgr.selected(m_cfghbBtnBack))
break;
else if (m_btnMgr.selected(m_cfghbBtnHideHB))
else if (m_btnMgr.selected(m_configBtn1))
{
m_cfg.setBool(HOMEBREW_DOMAIN, "disable", !m_cfg.getBool(HOMEBREW_DOMAIN, "disable"));
m_btnMgr.setText(m_cfghbBtnHideHB, m_cfg.getBool(HOMEBREW_DOMAIN, "disable") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_configBtn1, m_cfg.getBool(HOMEBREW_DOMAIN, "disable") ? _t("yes", L"Yes") : _t("no", L"No"));
}
else if (m_btnMgr.selected(m_cfghbBtnSmallbox))
else if (m_btnMgr.selected(m_configBtn2))
{
m_refreshGameList = true;
m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);
m_cfg.setBool(HOMEBREW_DOMAIN, "smallbox", !m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox", false));
m_btnMgr.setText(m_cfghbBtnSmallbox, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_configBtn2, m_cfg.getBool(HOMEBREW_DOMAIN, "smallbox") ? _t("on", L"On") : _t("off", L"Off"));
}
else if (m_btnMgr.selected(m_cfghbBtnBoxMode))
else if (m_btnMgr.selected(m_configBtn3))
{
m_refreshGameList = true;
m_cfg.setBool(HOMEBREW_DOMAIN, "box_mode", !m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode", false));
m_btnMgr.setText(m_cfghbBtnBoxMode, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_configBtn3, m_cfg.getBool(HOMEBREW_DOMAIN, "box_mode") ? _t("on", L"On") : _t("off", L"Off"));
}
else if (m_btnMgr.selected(m_cfghbBtnPartitionP) || m_btnMgr.selected(m_cfghbBtnPartitionM))
else if (m_btnMgr.selected(m_configBtn4P) || m_btnMgr.selected(m_configBtn4M))
{
m_refreshGameList = true;
m_cfg.setBool(HOMEBREW_DOMAIN, "update_cache", true);
s8 direction = m_btnMgr.selected(m_cfghbBtnPartitionP) ? 1 : -1;
s8 direction = m_btnMgr.selected(m_configBtn4P) ? 1 : -1;
_setPartition(direction);
const char *partitionname = DeviceName[currentPartition];
m_btnMgr.setText(m_cfghbLblPartitionVal, upperCase(partitionname));
m_btnMgr.setText(m_configLbl4Val, upperCase(partitionname));
}
}
}
_hideCfgHB(true);
_hideConfigHB();
}
void CMenu::_initCfgHB(void)
void CMenu::_initConfigHB(void)
{
m_cfghbBg = _texture("CFG_HB/BG", "texture", theme.bg, false);
@ -135,47 +113,15 @@ void CMenu::_initCfgHB(void)
m_cfghbLblTitle = _addLabel("CFG_HB/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_cfghbBtnBack = _addButton("CFG_HB/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_cfghbLblHideHB = _addLabel("CFG_HB/HIDE_HB", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbBtnHideHB = _addButton("CFG_HB/HIDE_HB_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
m_cfghbLblSmallbox = _addLabel("CFG_HB/HB_SMALLBOX", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbBtnSmallbox = _addButton("CFG_HB/HB_SMALLBOX_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor);
m_cfghbLblBoxMode = _addLabel("CFG_HB/HB_BOXMODE", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbBtnBoxMode = _addButton("CFG_HB/HB_BOXMODE_BTN", theme.btnFont, L"", 420, 250, 200, 48, theme.btnFontColor);
m_cfghbLblPartition = _addLabel("CFG_HB/HB_PARTITION", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_cfghbLblPartitionVal = _addLabel("CFG_HB/HB_PARTITION_VAL", theme.btnFont, L"", 468, 310, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_cfghbBtnPartitionM = _addPicButton("CFG_HB/HB_PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 310, 48, 48);
m_cfghbBtnPartitionP = _addPicButton("CFG_HB/HB_PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 310, 48, 48);
_setHideAnim(m_cfghbLblTitle, "CFG_HB/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnBack, "CFG_HB/BACK_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_cfghbLblHideHB, "CFG_HB/HIDE_HB", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnHideHB, "CFG_HB/HIDE_HB_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbLblSmallbox, "CFG_HB/HB_SMALLBOX", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnSmallbox, "CFG_HB/HB_SMALLBOX_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbLblBoxMode, "CFG_HB/HB_BOXMODE", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbBtnBoxMode, "CFG_HB/HB_BOXMODE_BTN", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbLblPartition, "CFG_HB/HB_PARTITION", -50, 0, -2.f, 0.f);
_setHideAnim(m_cfghbLblPartitionVal, "CFG_HB/HB_PARTITION_VAL", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbBtnPartitionM, "CFG_HB/HB_PARTITION_MINUS", -50, 0, 1.f, 0.f);
_setHideAnim(m_cfghbBtnPartitionP, "CFG_HB/HB_PARTITION_PLUS", -50, 0, 1.f, 0.f);
_hideCfgHB(true);
_textCfgHB();
_hideConfigHB(true);
_textConfigHB();
}
void CMenu::_textCfgHB(void)
void CMenu::_textConfigHB(void)
{
m_btnMgr.setText(m_cfghbLblTitle, _t("cfghb1", L"Homebrew Settings"));
m_btnMgr.setText(m_cfghbLblHideHB, _t("cfghb5", L"Hide homebrew button"));
m_btnMgr.setText(m_cfghbLblSmallbox, _t("cfghb2", L"Coverflow Smallbox"));
m_btnMgr.setText(m_cfghbLblBoxMode, _t("cfghb4", L"Box Mode"));
m_btnMgr.setText(m_cfghbLblPartition, _t("cfghb3", L"Homebrew Partition"));
m_btnMgr.setText(m_cfghbBtnBack, _t("cfg10", L"Back"));
}

View File

@ -49,7 +49,8 @@ void listThemes(const char * path, vector<string> &themes)
/* page 4 stuff */
Config custom_titles;
int currentChannelIndex = -1;
int amountOfChannels = -1;
int amountOfChannels = 0;
wstringEx channelName;
const CMenu::SOption CMenu::_exitTo[3] = {
{ "menu", L"System Menu" },
@ -57,26 +58,6 @@ const CMenu::SOption CMenu::_exitTo[3] = {
{ "wiiu", L"Wii U Menu" },
};
wstringEx CMenu::_getChannelName()
{
wstringEx channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");
const string &currentChanId = m_cfg.getString("GENERAL", "returnto");
currentChannelIndex = -1;
if(!currentChanId.empty())
{
for(int i = 0; i < amountOfChannels; i++)
{
if(strncmp(currentChanId.c_str(), ChannelHandle.GetId(i), 4) == 0)
{
channelName = custom_titles.getWString("TITLES", currentChanId, ChannelHandle.GetName(i));
currentChannelIndex = i;
break;
}
}
}
return channelName;
}
void CMenu::_hideConfigButtons(bool instant)
{
m_btnMgr.hide(m_configLbl1, instant);
@ -112,57 +93,29 @@ void CMenu::_hideConfigMain(bool instant)
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
_hideConfigButtons(instant);
for(u8 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if(m_configLblUser[i] != -1)
m_btnMgr.hide(m_configLblUser[i], instant);
_hideConfigButtons(instant);
}
void CMenu::_showConfigMain(int curPage)
{
_setBg(m_configBg,m_configBg);
_setBg(m_configBg, m_configBg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if(m_configLblUser[i] != -1)
m_btnMgr.show(m_configLblUser[i]);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", curPage, m_locked ? curPage : _nbCfgPages));
m_btnMgr.setText(m_configLblTitle, _t("cfg1", L"Settings"));
m_btnMgr.setText(m_configBtnBack, _t("cfg10", L"Back"));
m_btnMgr.hide(m_configLbl1, true);
m_btnMgr.hide(m_configBtn1, true);
m_btnMgr.hide(m_configLbl2, true);
m_btnMgr.hide(m_configBtn2, true);
m_btnMgr.hide(m_configLbl3, true);
m_btnMgr.hide(m_configBtn3, true);
m_btnMgr.hide(m_configLbl4, true);
m_btnMgr.hide(m_configBtn4, true);
m_btnMgr.hide(m_configLbl1Val, true);
m_btnMgr.hide(m_configBtn1M, true);
m_btnMgr.hide(m_configBtn1P, true);
m_btnMgr.hide(m_configLbl2Val, true);
m_btnMgr.hide(m_configBtn2M, true);
m_btnMgr.hide(m_configBtn2P, true);
m_btnMgr.hide(m_configLbl3Val, true);
m_btnMgr.hide(m_configBtn3M, true);
m_btnMgr.hide(m_configBtn3P, true);
m_btnMgr.hide(m_configLbl4Val, true);
m_btnMgr.hide(m_configBtn4M, true);
m_btnMgr.hide(m_configBtn4P, true);
_hideConfigButtons(true);
_setBg(m_configBg, m_configBg);
for(u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if(m_configLblUser[i] != -1)
m_btnMgr.show(m_configLblUser[i]);
m_btnMgr.show(m_configLbl2);
if(!m_locked)
{
@ -271,7 +224,22 @@ void CMenu::_showConfigMain(int curPage)
ChannelHandle.Init(m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
NANDemuView = prevNANDemuView;
amountOfChannels = ChannelHandle.Count();
m_btnMgr.setText(m_configLbl4Val, _getChannelName());
channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");
currentChannelIndex = -1;
const string &currentChanId = m_cfg.getString("GENERAL", "returnto");
if(!currentChanId.empty())
{
for(int i = 0; i < amountOfChannels; i++)
{
if(strncmp(currentChanId.c_str(), ChannelHandle.GetId(i), 4) == 0)
{
channelName = custom_titles.getWString("TITLES", currentChanId, ChannelHandle.GetName(i));
currentChannelIndex = i;
break;
}
}
}
m_btnMgr.setText(m_configLbl4Val, channelName);
}
else if(curPage == 5)
{
@ -658,21 +626,36 @@ void CMenu::_configMain(void)
}
else if(m_btnMgr.selected(m_configBtn4P))
{
if(currentChannelIndex >= (amountOfChannels - 1))
if(currentChannelIndex == (amountOfChannels - 1))
{
currentChannelIndex = -1;
m_cfg.remove("GENERAL", "returnto");
channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");
}
else
m_cfg.setString("GENERAL", "returnto", ChannelHandle.GetId(currentChannelIndex + 1));
m_btnMgr.setText(m_configLbl4Val, _getChannelName());
{
currentChannelIndex++;
m_cfg.setString("GENERAL", "returnto", ChannelHandle.GetId(currentChannelIndex));
channelName = custom_titles.getWString("TITLES", m_cfg.getString("GENERAL", "returnto"), ChannelHandle.GetName(currentChannelIndex));
}
m_btnMgr.setText(m_configLbl4Val, channelName);
}
else if(m_btnMgr.selected(m_configBtn4M))
{
if(currentChannelIndex == -1)
currentChannelIndex = amountOfChannels;
if((currentChannelIndex - 1) == -1)
m_cfg.remove("GENERAL", "returnto");
currentChannelIndex--;
if(currentChannelIndex == -2)
currentChannelIndex = amountOfChannels - 1;
if(currentChannelIndex >= 0)
{
m_cfg.setString("GENERAL", "returnto", ChannelHandle.GetId(currentChannelIndex));
channelName = custom_titles.getWString("TITLES", m_cfg.getString("GENERAL", "returnto"), ChannelHandle.GetName(currentChannelIndex));
}
else
m_cfg.setString("GENERAL", "returnto", ChannelHandle.GetId(currentChannelIndex - 1));
m_btnMgr.setText(m_configLbl4Val, _getChannelName());
{
m_cfg.remove("GENERAL", "returnto");
channelName = m_loc.getWString(m_curLanguage, "disabled", L"Disabled");
}
m_btnMgr.setText(m_configLbl4Val, channelName);
}
}
if(curPage == 5)
@ -892,7 +875,7 @@ void CMenu::_configMain(void)
if(m_btnMgr.selected(m_configBtn1))
{
_hideConfigMain();
_CfgHB();
_ConfigHB();
_showConfigMain(12);
}
else if(m_btnMgr.selected(m_configBtn2))
@ -991,13 +974,14 @@ void CMenu::_configMain(void)
void CMenu::_initConfigMenu()
{
_addUserLabels(m_configLblUser, ARRAY_SIZE(m_configLblUser), "CONFIG");
m_configBg = _texture("CONFIG/BG", "texture", theme.bg, false);
_addUserLabels(m_configLblUser, ARRAY_SIZE(m_configLblUser), "CONFIG");
m_configLblTitle = _addLabel("CONFIG/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_configBtnBack = _addButton("CONFIG/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_configLblPage = _addLabel("CONFIG/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnPageM = _addPicButton("CONFIG/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 48, 48);
m_configBtnPageP = _addPicButton("CONFIG/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 172, 400, 48, 48);
m_configBtnBack = _addButton("CONFIG/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_configLbl1 = _addLabel("CONFIG/LINE1", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtn1 = _addButton("CONFIG/LINE1_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor);
@ -1050,10 +1034,11 @@ void CMenu::_initConfigMenu()
_setHideAnim(m_configBtnPageP, "CONFIG/PAGE_PLUS", 0, 0, 1.f, -1.f);
_hideConfigMain(true);
_textConfig();
}
/*
void CMenu::_textConfig(void)
{
m_btnMgr.setText(m_configLblTitle, _t("cfg1", L"Settings"));
m_btnMgr.setText(m_configBtnBack, _t("cfg10", L"Back"));
}
*/