- Merged common menu code

- The main settings menu will now only update the coverflow if needed.  This means pages 3-6 will return instantly.

- fixed typo in NAND saves text (exCisting).  You may have to delete or fix "cfgne26" in your english language file to see the change.
This commit is contained in:
yardape8000 2012-05-04 03:46:18 +00:00
parent 0e4ab68f4a
commit bb285e4188
8 changed files with 169 additions and 258 deletions

View File

@ -629,6 +629,8 @@ private:
s32 wmote_roll_skip[WPAD_MAX_WIIMOTES];
bool enable_wmote_roll;
bool m_cfNeedsUpdate;
void SetupInput(void);
void ScanInput(void);
@ -859,6 +861,7 @@ private:
void _hideCheatSettings(bool instant = false);
void _hideError(bool instant = false);
void _hideMain(bool instant = false);
void _hideConfigCommon(bool instant = false);
void _hideConfig(bool instant = false);
void _hideConfig3(bool instant = false);
void _hideConfigScreen(bool instant = false);
@ -881,6 +884,7 @@ private:
//
void _showError(void);
void _showMain(void);
void _showConfigCommon(const STexture & bg, int page);
void _showConfig(void);
void _showConfig3(void);
void _showConfigScreen(void);
@ -907,8 +911,9 @@ private:
void _drawBg(void);
void _updateText(void);
void _showNandEmu(void);
//
//
void _config(int page);
int _configCommon(void);
int _config1(void);
int _config3(void);
int _configScreen(void);
@ -918,6 +923,14 @@ private:
int _NandEmuCfg(void);
int _AutoCreateNand(void);
int _AutoExtractSave(string gameId);
enum configPageChanges
{
CONFIG_PAGE_DEC = -1,
CONFIG_PAGE_NO_CHANGE = 0,
CONFIG_PAGE_INC = 1,
CONFIG_PAGE_BACK,
};
void _cfNeedsUpdate(void);
void _game(bool launch = false);
void _download(std::string gameId = std::string());
bool _code(char code[4], bool erase = false);

View File

@ -11,14 +11,19 @@ using namespace std;
const int CMenu::_nbCfgPages = 6;
static const int g_curPage = 1;
void CMenu::_hideConfig(bool instant)
void CMenu::_hideConfigCommon(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
m_btnMgr.hide(m_configBtnBack, instant);
}
void CMenu::_hideConfig(bool instant)
{
_hideConfigCommon(instant);
m_btnMgr.hide(m_configLblPartitionName, instant);
m_btnMgr.hide(m_configLblPartition, instant);
m_btnMgr.hide(m_configBtnPartitionP, instant);
@ -35,11 +40,21 @@ void CMenu::_hideConfig(bool instant)
m_btnMgr.hide(m_configLblUser[i], instant);
}
void CMenu::_showConfig(void)
void CMenu::_showConfigCommon(const STexture & bg, int page)
{
_setBg(m_configBg, m_configBg);
_setBg(bg, bg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", page, m_locked ? page : _nbCfgPages));
}
void CMenu::_showConfig(void)
{
_showConfigCommon(m_configBg, g_curPage);
if (!m_locked)
{
m_btnMgr.show(m_configLblPartitionName);
@ -48,69 +63,108 @@ void CMenu::_showConfig(void)
m_btnMgr.show(m_configBtnPartitionM);
m_btnMgr.show(m_configLblDownload);
m_btnMgr.show(m_configBtnDownload);
bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
char *partitionname = disable ? (char *)"NAND" : (char *)DeviceName[m_cfg.getInt(_domainFromView(), "partition", 0)];
for(u8 i = 0; strncmp((const char *)&partitionname[i], "\0", 1) != 0; i++)
partitionname[i] = toupper(partitionname[i]);
for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if (m_configLblUser[i] != -1u)
m_btnMgr.show(m_configLblUser[i]);
m_btnMgr.setText(m_configLblPartition, (string)partitionname);
m_btnMgr.show(m_configLblNandEmu);
m_btnMgr.show(m_configBtnNandEmu);
}
m_btnMgr.show(m_configLblParental);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
m_btnMgr.show(m_locked ? m_configBtnUnlock : m_configBtnSetCode);
bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
char *partitionname = disable ? (char *)"NAND" : (char *)DeviceName[m_cfg.getInt(_domainFromView(), "partition", 0)];
}
for(u8 i = 0; strncmp((const char *)&partitionname[i], "\0", 1) != 0; i++)
partitionname[i] = toupper(partitionname[i]);
for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if (m_configLblUser[i] != -1u)
m_btnMgr.show(m_configLblUser[i]);
m_btnMgr.setText(m_configLblPartition, (string)partitionname);
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage + 1 : CMenu::_nbCfgPages));
m_btnMgr.show(m_configLblNandEmu);
m_btnMgr.show(m_configBtnNandEmu);
void CMenu::_cfNeedsUpdate(void)
{
if (!m_cfNeedsUpdate)
m_cf.clear();
m_cfNeedsUpdate = true;
}
void CMenu::_config(int page)
{
m_curGameId = m_cf.getId();
m_cf.clear();
while (page > 0 && page <= CMenu::_nbCfgPages)
m_cfNeedsUpdate = false;
int change = CONFIG_PAGE_NO_CHANGE;
while (true)
{
switch (page)
{
case 1:
page = _config1();
change = _config1();
break;
case 2:
page = _configAdv();
change = _configAdv();
break;
case 3:
page = _config3();
change = _config3();
break;
case 4:
page = _config4();
change = _config4();
break;
case 5:
page = _configSnd();
change = _configSnd();
break;
case 6:
page = _configScreen();
change = _configScreen();
break;
}
if (change == CONFIG_PAGE_BACK)
break;
if (!m_locked)
{
// assumes change is in the range of CONFIG_PAGE_DEC to CONFIG_PAGE_INC
page += change;
if (page > _nbCfgPages)
page = 1;
else if (page < 0)
page = _nbCfgPages;
}
}
if (m_cfNeedsUpdate)
{
m_cfg.save();
m_cf.setBoxMode(m_cfg.getBool("GENERAL", "box_mode"));
_initCF();
}
}
int CMenu::_configCommon(void)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnBack)))
return CONFIG_PAGE_BACK;
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
else if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
return CONFIG_PAGE_DEC;
}
else if (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP)))
{
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
return CONFIG_PAGE_INC;
}
return CONFIG_PAGE_NO_CHANGE;
}
int CMenu::_config1(void)
{
int nextPage = 0;
int change = CONFIG_PAGE_NO_CHANGE;
SetupInput();
s32 bCurrentPartition = currentPartition;
@ -120,37 +174,20 @@ int CMenu::_config1(void)
_showConfig();
while (true)
{
_mainLoopCommon();
change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE)
break;
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
{
_enableNandEmu(false);
break;
}
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
nextPage = g_curPage == 1 && !m_locked ? CMenu::_nbCfgPages : max(1, m_locked ? 1 : g_curPage - 1);
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
break;
}
if (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP)))
{
nextPage = (g_curPage == CMenu::_nbCfgPages) ? 1 : min(g_curPage + 1, CMenu::_nbCfgPages);
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
break;
}
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
{
_enableNandEmu(false);
break;
}
else if (m_btnMgr.selected(m_configBtnDownload))
if (m_btnMgr.selected(m_configBtnDownload))
{
_cfNeedsUpdate();
m_cf.stopCoverLoader(true);
_hideConfig();
_download();
@ -162,7 +199,10 @@ int CMenu::_config1(void)
char code[4];
_hideConfig();
if (_code(code) && memcmp(code, m_cfg.getString("GENERAL", "parent_code", "").c_str(), 4) == 0)
{
_cfNeedsUpdate();
m_locked = false;
}
else
error(_t("cfgg25",L"Password incorrect."));
_showConfig();
@ -173,18 +213,20 @@ int CMenu::_config1(void)
_hideConfig();
if (_code(code, true))
{
_cfNeedsUpdate();
m_cfg.setString("GENERAL", "parent_code", string(code, 4).c_str());
m_locked = true;
}
_showConfig();
}
else if (!m_locked && (m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM)))
else if ((m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM)))
{
_enableNandEmu(true);
_showConfig();
}
else if (!m_locked && m_btnMgr.selected(m_configBtnNandEmu))
else if (m_btnMgr.selected(m_configBtnNandEmu))
{
_cfNeedsUpdate();
m_cf.stopCoverLoader(true);
_hideConfig();
_NandEmuCfg();
@ -215,7 +257,7 @@ int CMenu::_config1(void)
_hideConfig();
return nextPage;
return change;
}
void CMenu::_initConfigMenu(CMenu::SThemeData &theme)

View File

@ -15,11 +15,7 @@ template <class T> static inline T loopNum(T i, T s)
void CMenu::_hideConfig3(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
_hideConfigCommon(instant);
if(m_current_view != COVERFLOW_DML)
{
@ -54,12 +50,7 @@ void CMenu::_hideConfig3(bool instant)
void CMenu::_showConfig3(void)
{
_setBg(m_config3Bg, m_config3Bg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
_showConfigCommon(m_config3Bg, g_curPage);
if(m_current_view != COVERFLOW_DML)
{
@ -92,7 +83,6 @@ void CMenu::_showConfig3(void)
if (m_config3LblUser[i] != -1u)
m_btnMgr.show(m_config3LblUser[i]);
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage : CMenu::_nbCfgPages));
int i;
if(m_current_view != COVERFLOW_DML)
@ -119,35 +109,17 @@ void CMenu::_showConfig3(void)
int CMenu::_config3(void)
{
int nextPage = 0;
int change = CONFIG_PAGE_NO_CHANGE;
_showConfig3();
while (true)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE)
break;
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
nextPage = max(1, m_locked ? 1 : g_curPage - 1);
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
break;
}
if (!m_locked && (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP))))
{
nextPage = min(g_curPage + 1, CMenu::_nbCfgPages);
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
break;
}
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
break;
else if (m_btnMgr.selected(m_config3BtnLanguageP) || m_btnMgr.selected(m_config3BtnLanguageM))
if (m_btnMgr.selected(m_config3BtnLanguageP) || m_btnMgr.selected(m_config3BtnLanguageM))
{
s8 direction = m_btnMgr.selected(m_config3BtnLanguageP) ? 1 : -1;
m_cfg.setInt("GENERAL", "game_language", (int)loopNum((u32)m_cfg.getInt("GENERAL", "game_language", 0) + direction, ARRAY_SIZE(CMenu::_languages)));
@ -184,7 +156,7 @@ int CMenu::_config3(void)
}
}
_hideConfig3();
return nextPage;
return change;
}
void CMenu::_initConfig3Menu(CMenu::SThemeData &theme)

View File

@ -29,12 +29,8 @@ const CMenu::SOption CMenu::_exitTo[6] = {
void CMenu::_hideConfig4(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
//
_hideConfigCommon(instant);
m_btnMgr.hide(m_config4LblHome, instant);
m_btnMgr.hide(m_config4BtnHome, instant);
m_btnMgr.hide(m_config4LblSaveFavMode, instant);
@ -52,13 +48,8 @@ void CMenu::_hideConfig4(bool instant)
void CMenu::_showConfig4(void)
{
_setBg(m_config4Bg, m_config4Bg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
//
_showConfigCommon(m_config4Bg, g_curPage);
m_btnMgr.show(m_config4LblHome);
m_btnMgr.show(m_config4BtnHome);
m_btnMgr.show(m_config4LblSaveFavMode);
@ -74,7 +65,6 @@ void CMenu::_showConfig4(void)
if (m_config4LblUser[i] != -1u)
m_btnMgr.show(m_config4LblUser[i]);
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage : CMenu::_nbCfgPages));
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));
@ -115,35 +105,17 @@ void CMenu::_showConfig4(void)
int CMenu::_config4(void)
{
int nextPage = 0;
int change = CONFIG_PAGE_NO_CHANGE;
_showConfig4();
while (true)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE)
break;
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
nextPage = max(1, m_locked ? 1 : g_curPage - 1);
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
break;
}
if (!m_locked && (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP))))
{
nextPage = min(g_curPage + 1, CMenu::_nbCfgPages);
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
break;
}
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
break;
else if (m_btnMgr.selected(m_config4BtnHome))
if (m_btnMgr.selected(m_config4BtnHome))
{
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);
@ -183,7 +155,7 @@ int CMenu::_config4(void)
}
}
_hideConfig4();
return nextPage;
return change;
}
void CMenu::_initConfig4Menu(CMenu::SThemeData &theme)

View File

@ -19,11 +19,7 @@ template <class T> static inline T loopNum(T i, T s)
void CMenu::_hideConfigAdv(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
_hideConfigCommon(instant);
m_btnMgr.hide(m_configAdvLblInstall, instant);
m_btnMgr.hide(m_configAdvBtnInstall, instant);
@ -44,12 +40,7 @@ void CMenu::_hideConfigAdv(bool instant)
void CMenu::_showConfigAdv(void)
{
_setBg(m_configAdvBg, m_configAdvBg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
_showConfigCommon(m_configAdvBg, g_curPage);
m_btnMgr.show(m_configAdvLblCurTheme);
m_btnMgr.show(m_configAdvBtnCurThemeM);
@ -70,7 +61,6 @@ void CMenu::_showConfigAdv(void)
if (m_configAdvLblUser[i] != -1u)
m_btnMgr.show(m_configAdvLblUser[i]);
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage : CMenu::_nbCfgPages));
m_btnMgr.setText(m_configAdvLblCurLanguage, m_curLanguage);
m_btnMgr.setText(m_configAdvLblCurTheme, m_cfg.getString("GENERAL", "theme"));
}
@ -103,7 +93,7 @@ static void listThemes(const char * path, safe_vector<string> &themes)
int CMenu::_configAdv(void)
{
int nextPage = 0;
int change = CONFIG_PAGE_NO_CHANGE;
safe_vector<string> themes;
string prevTheme = m_cfg.getString("GENERAL", "theme");
@ -120,40 +110,21 @@ int CMenu::_configAdv(void)
_showConfigAdv();
while (true)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE)
break;
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
nextPage = max(1, m_locked ? 1 : g_curPage - 1);
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
break;
}
if (!m_locked && (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP))))
{
nextPage = min(g_curPage + 1, CMenu::_nbCfgPages);
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
break;
}
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
break;
else if (m_btnMgr.selected(m_configAdvBtnInstall))
if (m_btnMgr.selected(m_configAdvBtnInstall))
{
if (!m_locked)
{
_hideConfigAdv();
_wbfsOp(CMenu::WO_ADD_GAME);
_showConfigAdv();
}
_cfNeedsUpdate();
_hideConfigAdv();
_wbfsOp(CMenu::WO_ADD_GAME);
_showConfigAdv();
}
else if (m_btnMgr.selected(m_configAdvBtnCurThemeP) || m_btnMgr.selected(m_configAdvBtnCurThemeM))
{
_cfNeedsUpdate();
s8 direction = m_btnMgr.selected(m_configAdvBtnCurThemeP) ? 1 : -1;
curTheme = loopNum(curTheme + direction, (int)themes.size());
m_cfg.setString("GENERAL", "theme", themes[curTheme]);
@ -162,6 +133,7 @@ int CMenu::_configAdv(void)
}
else if (m_btnMgr.selected(m_configAdvBtnCurLanguageP) || m_btnMgr.selected(m_configAdvBtnCurLanguageM))
{
_cfNeedsUpdate();
s8 direction = m_btnMgr.selected(m_configAdvBtnCurLanguageP) ? 1 : -1;
int lang = (int)loopNum((u32)m_cfg.getInt("GENERAL", "language", 0) + direction, ARRAY_SIZE(CMenu::_translations));
m_curLanguage = CMenu::_translations[lang];
@ -190,6 +162,7 @@ int CMenu::_configAdv(void)
}
else if (m_btnMgr.selected(m_configAdvBtnCFTheme))
{
_cfNeedsUpdate();
_hideConfigAdv();
_cfTheme();
_showConfigAdv();
@ -206,7 +179,7 @@ int CMenu::_configAdv(void)
}
lang_changed = false;
return nextPage;
return change;
}
void CMenu::_initConfigAdvMenu(CMenu::SThemeData &theme)

View File

@ -8,12 +8,8 @@ static const int g_curPage = 6;
void CMenu::_hideConfigScreen(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
//
_hideConfigCommon(instant);
m_btnMgr.hide(m_configScreenLblTVHeight, instant);
m_btnMgr.hide(m_configScreenLblTVHeightVal, instant);
m_btnMgr.hide(m_configScreenBtnTVHeightP, instant);
@ -37,13 +33,8 @@ void CMenu::_hideConfigScreen(bool instant)
void CMenu::_showConfigScreen(void)
{
_setBg(m_configScreenBg, m_configScreenBg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
//
_showConfigCommon(m_configScreenBg, g_curPage);
m_btnMgr.show(m_configScreenLblTVHeight);
m_btnMgr.show(m_configScreenLblTVHeightVal);
m_btnMgr.show(m_configScreenBtnTVHeightP);
@ -63,8 +54,7 @@ void CMenu::_showConfigScreen(void)
for (u32 i = 0; i < ARRAY_SIZE(m_configScreenLblUser); ++i)
if (m_configScreenLblUser[i] != -1u)
m_btnMgr.show(m_configScreenLblUser[i]);
//
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage : CMenu::_nbCfgPages));
m_btnMgr.setText(m_configScreenLblTVWidthVal, wfmt(L"%i", 640 * 640 / max(1, m_cfg.getInt("GENERAL", "tv_width", 640))));
m_btnMgr.setText(m_configScreenLblTVHeightVal, wfmt(L"%i", 480 * 480 / max(1, m_cfg.getInt("GENERAL", "tv_height", 480))));
m_btnMgr.setText(m_configScreenLblTVXVal, wfmt(L"%i", -m_cfg.getInt("GENERAL", "tv_x", 0)));
@ -73,36 +63,15 @@ void CMenu::_showConfigScreen(void)
int CMenu::_configScreen(void)
{
int nextPage = 0;
int change = CONFIG_PAGE_NO_CHANGE;
SetupInput();
_showConfigScreen();
while (true)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE)
break;
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
nextPage = g_curPage == 1 && !m_locked ? CMenu::_nbCfgPages : max(1, m_locked ? 1 : g_curPage - 1);
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
break;
}
if (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP)))
{
nextPage = (g_curPage == CMenu::_nbCfgPages) ? 1 : min(g_curPage + 1, CMenu::_nbCfgPages);
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
break;
}
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
break;
}
if (BTN_A_REPEAT)
{
if (m_btnMgr.selected(m_configScreenBtnTVWidthP) || m_btnMgr.selected(m_configScreenBtnTVWidthM)
@ -133,7 +102,7 @@ int CMenu::_configScreen(void)
}
}
_hideConfigScreen();
return nextPage;
return change;
}
void CMenu::_initConfigScreenMenu(CMenu::SThemeData &theme)

View File

@ -7,12 +7,8 @@ static const int g_curPage = 5;
void CMenu::_hideConfigSnd(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_configLblPage, instant);
m_btnMgr.hide(m_configBtnPageM, instant);
m_btnMgr.hide(m_configBtnPageP, instant);
//
_hideConfigCommon(instant);
m_btnMgr.hide(m_configSndLblBnrVol, instant);
m_btnMgr.hide(m_configSndLblBnrVolVal, instant);
m_btnMgr.hide(m_configSndBtnBnrVolP, instant);
@ -36,13 +32,8 @@ void CMenu::_hideConfigSnd(bool instant)
void CMenu::_showConfigSnd(void)
{
_setBg(m_configSndBg, m_configSndBg);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_configLblPage);
m_btnMgr.show(m_configBtnPageM);
m_btnMgr.show(m_configBtnPageP);
//
_showConfigCommon(m_configSndBg, g_curPage);
m_btnMgr.show(m_configSndLblBnrVol);
m_btnMgr.show(m_configSndLblBnrVolVal);
m_btnMgr.show(m_configSndBtnBnrVolP);
@ -62,8 +53,7 @@ void CMenu::_showConfigSnd(void)
for (u32 i = 0; i < ARRAY_SIZE(m_configSndLblUser); ++i)
if (m_configSndLblUser[i] != -1u)
m_btnMgr.show(m_configSndLblUser[i]);
//
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage : CMenu::_nbCfgPages));
m_btnMgr.setText(m_configSndLblGuiVolVal, wfmt(L"%i", m_cfg.getInt("GENERAL", "sound_volume_gui", 255)));
m_btnMgr.setText(m_configSndLblCFVolVal, wfmt(L"%i", m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255)));
m_btnMgr.setText(m_configSndLblMusicVolVal, wfmt(L"%i", m_cfg.getInt("GENERAL", "sound_volume_music", 255)));
@ -72,37 +62,16 @@ void CMenu::_showConfigSnd(void)
int CMenu::_configSnd(void)
{
int nextPage = 0;
int change = CONFIG_PAGE_NO_CHANGE;
SetupInput();
int step = 1;
_showConfigSnd();
while (true)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
change = _configCommon();
if (change != CONFIG_PAGE_NO_CHANGE)
break;
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
m_btnMgr.down();
if (BTN_LEFT_PRESSED || BTN_MINUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageM)))
{
nextPage = max(1, m_locked ? 1 : g_curPage - 1);
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_configBtnPageM);
break;
}
if (!m_locked && (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnPageP))))
{
nextPage = min(g_curPage + 1, CMenu::_nbCfgPages);
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_configBtnPageP);
break;
}
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
break;
}
if (BTN_A_REPEAT)
{
if (m_btnMgr.selected(m_configSndBtnBnrVolP))
@ -158,7 +127,7 @@ int CMenu::_configSnd(void)
}
}
_hideConfigSnd();
return nextPage;
return change;
}
void CMenu::_initConfigSndMenu(CMenu::SThemeData &theme)

View File

@ -43,6 +43,7 @@ static bool _nandSaveExcists(const char *npath)
void CMenu::_enableNandEmu(bool fromconfig)
{
_cfNeedsUpdate();
bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
gprintf("i: %i\n",i);
@ -279,7 +280,7 @@ int CMenu::_AutoExtractSave(string gameId)
{
m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne24", L"Extract save"));
m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne25", L"Create new save"));
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne26", L"A save file for this game was created on real nand. Extract excisting safe file from real nand or create new file for nandemulation?"));
m_btnMgr.setText(m_nandemuLblInit, _t("cfgne26", L"A save file for this game was created on real nand. Extract existing safe file from real nand or create new file for nand emulation?"));
m_btnMgr.show(m_nandemuBtnExtract);
m_btnMgr.show(m_nandemuBtnDisable);
m_btnMgr.show(m_nandemuLblInit);