-Categories Page update. Now you can have 20 categories and select to view more than one category at a time. Plus if Wiiflow finds old 12 categories.ini it will update it to 20 by appending eight 0's.

This commit is contained in:
fledge68 2012-03-26 14:29:57 +00:00
parent aaad7c07ef
commit c3e21c2698
4 changed files with 167 additions and 193 deletions

View File

@ -795,7 +795,7 @@ void CMenu::_buildMenus(void)
theme.txtFont = _font(theme.fontSet, "GENERAL", "text_font", TEXTFONT); theme.txtFont = _font(theme.fontSet, "GENERAL", "text_font", TEXTFONT);
theme.txtFontColor = m_theme.getColor("GENERAL", "text_font_color", 0xFFFFFFFF); theme.txtFontColor = m_theme.getColor("GENERAL", "text_font_color", 0xFFFFFFFF);
theme.selsbtnFontColor = m_theme.getColor("GENERAL", "selsbtn_font_color", 0xD0BFDFFF); theme.selsbtnFontColor = m_theme.getColor("GENERAL", "selsbtn_font_color", 0xFA5882FF);
theme.selubtnFontColor = m_theme.getColor("GENERAL", "selubtn_font_color", 0xD0BFDFFF); theme.selubtnFontColor = m_theme.getColor("GENERAL", "selubtn_font_color", 0xD0BFDFFF);
// Default Sounds // Default Sounds
@ -1404,6 +1404,7 @@ void CMenu::_initCF(void)
{ {
Config m_dump; Config m_dump;
const char *domain = _domainFromView(); const char *domain = _domainFromView();
const char *catviews = m_cat.getString("GENERAL", "categories", "").c_str();
m_cf.clear(); m_cf.clear();
m_cf.reserve(m_gameList.size()); m_cf.reserve(m_gameList.size());
@ -1419,16 +1420,25 @@ void CMenu::_initCF(void)
strncpy((char *) m_gameList[i].hdr.id, "JODI", 6); strncpy((char *) m_gameList[i].hdr.id, "JODI", 6);
string id = string((const char *)m_gameList[i].hdr.id, m_current_view == COVERFLOW_CHANNEL ? 4 : 6); string id = string((const char *)m_gameList[i].hdr.id, m_current_view == COVERFLOW_CHANNEL ? 4 : 6);
string idcats = m_cat.getString("CATEGORIES", id, "").c_str();
if (idcats.length() == 12)
{
idcats.append("00000000");
m_cat.setString("CATEGORIES", id, idcats);
}
if ((!m_favorites || m_gcfg1.getBool("FAVORITES", id, false)) && (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false)) && !m_gcfg1.getBool("HIDDEN", id, false)) if ((!m_favorites || m_gcfg1.getBool("FAVORITES", id, false)) && (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false)) && !m_gcfg1.getBool("HIDDEN", id, false))
{ {
if (m_category != 0) if (catviews[0] == '0')
{ {
const char *categories = m_cat.getString("CATEGORIES", id, "").c_str(); const char *idcats = m_cat.getString("CATEGORIES", id, "").c_str();
if (strlen(categories) != 12 || categories[m_category] == '0') if (strlen(idcats) != 20) continue;
continue; else
{
bool idinacat=0;
for (u32 j = 1; j<20; ++j) if (catviews[j] == '1' && idcats[j] == '1') idinacat=1;
if (!idinacat) continue;
}
} }
int playcount = m_gcfg1.getInt("PLAYCOUNT", id, 0); int playcount = m_gcfg1.getInt("PLAYCOUNT", id, 0);
unsigned int lastPlayed = m_gcfg1.getUInt("LASTPLAYED", id, 0); unsigned int lastPlayed = m_gcfg1.getUInt("LASTPLAYED", id, 0);

View File

@ -542,8 +542,14 @@ private:
STexture m_controlsreq[4]; STexture m_controlsreq[4];
STexture m_controls[4]; STexture m_controls[4];
// Category menu // Category menu
u32 m_categoryBtn[12]; u32 m_categoryLblPage;
u32 m_categoryBtnPageM;
u32 m_categoryBtnPageP;
u32 m_categoryBtnBack; u32 m_categoryBtnBack;
u32 m_categoryLblTitle;
u32 m_categoryLblCat[20];
u32 m_categoryBtnCat[20];
u32 m_categoryBtnCats[20];
u32 m_categoryLblUser[4]; u32 m_categoryLblUser[4];
u8 m_max_categories; u8 m_max_categories;
u8 m_category; u8 m_category;
@ -878,7 +884,7 @@ private:
void _gameinfo(void); void _gameinfo(void);
void _gameSettings(void); void _gameSettings(void);
void _CheatSettings(); void _CheatSettings();
void _CategorySettings(); void _CategorySettings(bool fromGameSet=false);
// //
void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false); void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false);
// //

View File

@ -3,10 +3,79 @@
#include <string.h> #include <string.h>
#include <gccore.h> #include <gccore.h>
void CMenu::_CategorySettings() u8 m_categories[20];
u32 C_curPage;
bool gameSet;
void CMenu::_hideCategorySettings(bool instant)
{
m_btnMgr.hide(m_categoryLblTitle, instant);
m_btnMgr.hide(m_categoryBtnBack, instant);
m_btnMgr.hide(m_categoryLblPage, instant);
m_btnMgr.hide(m_categoryBtnPageM, instant);
m_btnMgr.hide(m_categoryBtnPageP, instant);
for (u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i)
if (m_categoryLblUser[i] != -1u) m_btnMgr.hide(m_categoryLblUser[i], instant);
for (int i=0; i<20; ++i)
{
m_btnMgr.hide(m_categoryLblCat[i]);
m_btnMgr.hide(m_categoryBtnCat[i]);
m_btnMgr.hide(m_categoryBtnCats[i]);
}
}
void CMenu::_showCategorySettings(void)
{
_setBg(m_categoryBg, m_categoryBg);
m_btnMgr.show(m_categoryLblTitle);
m_btnMgr.show(m_categoryBtnBack);
m_btnMgr.setText(m_categoryLblPage, wfmt(L"%i / 2", C_curPage));
m_btnMgr.show(m_categoryLblPage);
m_btnMgr.show(m_categoryBtnPageM);
m_btnMgr.show(m_categoryBtnPageP);
for (u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i) if (m_categoryLblUser[i] != -1u) m_btnMgr.show(m_categoryLblUser[i]);
string id(m_cf.getId());
const char *catflags;
if (gameSet) catflags = m_cat.getString("CATEGORIES", id, "").c_str();
else catflags = m_cat.getString("GENERAL", "categories", "10000000000000000000").c_str();
memset(&m_categories, '0', sizeof(m_categories));
if (strlen(catflags) == sizeof(m_categories)) memcpy(&m_categories, catflags, sizeof(m_categories));
if (C_curPage == 1)
{
for (int i = 0; i < 10; ++i)
{
if (i == 0 && gameSet) continue;
m_btnMgr.show(m_categoryLblCat[i]);
if (catflags[i] == '1') m_btnMgr.show(m_categoryBtnCats[i]);
else m_btnMgr.show(m_categoryBtnCat[i]);
m_btnMgr.hide(m_categoryLblCat[i+10]);
m_btnMgr.hide(m_categoryBtnCat[i+10]);
m_btnMgr.hide(m_categoryBtnCats[i+10]);
}
}
else
{
for (int i = 10; i < 20; ++i)
{
m_btnMgr.show(m_categoryLblCat[i]);
if (catflags[i] == '1') m_btnMgr.show(m_categoryBtnCats[i]);
else m_btnMgr.show(m_categoryBtnCat[i]);
m_btnMgr.hide(m_categoryLblCat[i-10]);
m_btnMgr.hide(m_categoryBtnCat[i-10]);
m_btnMgr.hide(m_categoryBtnCats[i-10]);
}
}
}
void CMenu::_CategorySettings(bool fromGameSet)
{ {
SetupInput(); SetupInput();
bool exitloop = false; C_curPage = 1;
gameSet = false;
if (fromGameSet) gameSet=true;
_showCategorySettings(); _showCategorySettings();
while (true) while (true)
{ {
@ -17,85 +86,99 @@ void CMenu::_CategorySettings()
m_btnMgr.up(); m_btnMgr.up();
else if (BTN_DOWN_PRESSED) else if (BTN_DOWN_PRESSED)
m_btnMgr.down(); m_btnMgr.down();
if (BTN_MINUS_PRESSED || BTN_LEFT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageM)))
{
C_curPage = C_curPage == 1 ? 2 : 1;
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_categoryBtnPageM);
_hideCategorySettings();
_showCategorySettings();
}
else if (BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageP)))
{
C_curPage = C_curPage == 1 ? 2 : 1;
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_categoryBtnPageP);
_hideCategorySettings();
_showCategorySettings();
}
if (BTN_A_PRESSED) if (BTN_A_PRESSED)
{ {
if (m_btnMgr.selected(m_categoryBtnBack)) if (m_btnMgr.selected(m_categoryBtnBack))
break; break;
for (int i = 0; i < 12; ++i) for (int i = 0; i < 20; ++i)
{ {
if (m_btnMgr.selected(m_categoryBtn[i])) if (m_btnMgr.selected(m_categoryBtnCat[i]) || m_btnMgr.selected(m_categoryBtnCats[i]))
{ {
// handling code for clicked favorite m_categories[i] = m_categories[i] == '1' ? '0' : '1';
m_category = i; if (i == 0 && m_categories[i] == '1') for (int j=1; j<20; ++j) m_categories[j] = '0';
m_cat.setInt("GENERAL", "category", i); else m_categories[0] = '0';
exitloop = true; char catflags[21];
memset(&catflags, 0, sizeof(catflags));
memcpy(&catflags, &m_categories, sizeof(m_categories));
string id(m_cf.getId());
if (gameSet) m_cat.setString("CATEGORIES", id, catflags);
else m_cat.setString("GENERAL", "categories", catflags);
_hideCategorySettings();
_showCategorySettings();
break; break;
} }
} }
} }
if (exitloop == true)
break;
} }
_hideCategorySettings(); _hideCategorySettings();
} }
void CMenu::_hideCategorySettings(bool instant)
{
m_btnMgr.hide(m_categoryBtnBack,instant);
for (int i = 0; i < 12; ++i)
m_btnMgr.hide(m_categoryBtn[i],instant);
for (u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i)
if (m_categoryLblUser[i] != -1u)
m_btnMgr.hide(m_categoryLblUser[i], instant);
}
void CMenu::_showCategorySettings(void)
{
_setBg(m_categoryBg, m_categoryBg);
m_btnMgr.show(m_categoryBtnBack);
for (int i = 0; i < m_max_categories+1; ++i)
m_btnMgr.show(m_categoryBtn[i]);
for (u32 i = 0; i < ARRAY_SIZE(m_categoryLblUser); ++i)
if (m_categoryLblUser[i] != -1u)
m_btnMgr.show(m_categoryLblUser[i]);
}
void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme) void CMenu::_initCategorySettingsMenu(CMenu::SThemeData &theme)
{ {
_addUserLabels(theme, m_categoryLblUser, ARRAY_SIZE(m_categoryLblUser), "CATEGORY"); _addUserLabels(theme, m_categoryLblUser, ARRAY_SIZE(m_categoryLblUser), "CATEGORY");
m_categoryBg = _texture(theme.texSet, "CATEGORY/BG", "texture", theme.bg); m_categoryBg = _texture(theme.texSet, "CATEGORY/BG", "texture", theme.bg);
m_categoryBtnBack = _addButton(theme, "CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor); m_categoryLblTitle = _addTitle(theme, "CATEGORY/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_categoryBtn[0] = _addButton(theme, "CATEGORY/ALL_BTN", theme.btnFont, L"", 60, 40, 200, 50, theme.btnFontColor); m_categoryBtnBack = _addButton(theme, "CATEGORY/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
m_categoryBtn[1] = _addButton(theme, "CATEGORY/1_BTN", theme.btnFont, L"", 340, 40, 200, 50, theme.btnFontColor); m_categoryLblPage = _addLabel(theme, "CATEGORY/PAGE_BTN", theme.btnFont, L"", 76, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_categoryBtn[2] = _addButton(theme, "CATEGORY/2_BTN", theme.btnFont, L"", 60, 100, 200, 50, theme.btnFontColor); m_categoryBtnPageM = _addPicButton(theme, "CATEGORY/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_categoryBtn[3] = _addButton(theme, "CATEGORY/3_BTN", theme.btnFont, L"", 340, 100, 200, 50, theme.btnFontColor); m_categoryBtnPageP = _addPicButton(theme, "CATEGORY/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 176, 400, 56, 56);
m_categoryBtn[4] = _addButton(theme, "CATEGORY/4_BTN", theme.btnFont, L"", 60, 160, 200, 50, theme.btnFontColor);
m_categoryBtn[5] = _addButton(theme, "CATEGORY/5_BTN", theme.btnFont, L"", 340, 160, 200, 50, theme.btnFontColor);
m_categoryBtn[6] = _addButton(theme, "CATEGORY/6_BTN", theme.btnFont, L"", 60, 220, 200, 50, theme.btnFontColor);
m_categoryBtn[7] = _addButton(theme, "CATEGORY/7_BTN", theme.btnFont, L"", 340, 220, 200, 50, theme.btnFontColor);
m_categoryBtn[8] = _addButton(theme, "CATEGORY/8_BTN", theme.btnFont, L"", 60, 280, 200, 50, theme.btnFontColor);
m_categoryBtn[9] = _addButton(theme, "CATEGORY/9_BTN", theme.btnFont, L"", 340, 280, 200, 50, theme.btnFontColor);
m_categoryBtn[10] = _addButton(theme, "CATEGORY/10_BTN", theme.btnFont, L"", 60, 340, 200, 50, theme.btnFontColor);
m_categoryBtn[11] = _addButton(theme, "CATEGORY/11_BTN", theme.btnFont, L"",340, 340, 200, 50, theme.btnFontColor);
_setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_categoryBtn[0], "CATEGORY/ALL_BTN", 0, 0, 0.f, 0.f);
for (int i = 1; i < 12; ++i)
_setHideAnim(m_categoryBtn[i], sfmt("CATEGORY/%i_BTN", i).c_str(), 0, 0, 0.f, 0.f);
for (int i = 0; i < 5; i++)
{ // Page 1
m_categoryLblCat[i] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i).c_str(), theme.lblFont, L"", 125, (100+i*58), 185, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i).c_str(), theme.btnFont, L"", 20, (100+i*58), 96, 48, theme.btnFontColor);
m_categoryBtnCats[i] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i).c_str(), theme.btnFont, L"", 20, (100+i*58), 96, 48, theme.selsbtnFontColor);
// right half
m_categoryLblCat[i+5] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i+5).c_str(), theme.txtFont, L"", 425, (100+i*58), 185, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+5] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i+5).c_str(), theme.btnFont, L"", 320, (100+i*58), 96, 48, theme.btnFontColor);
m_categoryBtnCats[i+5] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i+5).c_str(), theme.btnFont, L"", 320, (100+i*58), 96, 48, theme.selsbtnFontColor);
// Page 2
m_categoryLblCat[i+10] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i+10).c_str(), theme.lblFont, L"", 125, (100+i*58), 185, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+10] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i+10).c_str(), theme.btnFont, L"", 20, (100+i*58), 96, 48, theme.btnFontColor);
m_categoryBtnCats[i+10] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i+10).c_str(), theme.btnFont, L"", 20, (100+i*58), 96, 48, theme.selsbtnFontColor);
// right half
m_categoryLblCat[i+15] = _addLabel(theme, sfmt("CATEGORY/CAT_%i", i+15).c_str(), theme.txtFont, L"", 425, (100+i*58), 185, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_categoryBtnCat[i+15] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTN", i+15).c_str(), theme.btnFont, L"", 320, (100+i*58), 96, 48, theme.btnFontColor);
m_categoryBtnCats[i+15] = _addButton(theme, sfmt("CATEGORY/CAT_%i_BTNS", i+15).c_str(), theme.btnFont, L"", 320, (100+i*58), 96, 48, theme.selsbtnFontColor);
}
_setHideAnim(m_categoryLblTitle, "CATEGORY/TITLE", 0, -200, 0.f, 1.f);
_setHideAnim(m_categoryLblPage, "CATEGORY/PAGE_BTN", 0, 200, 1.f, 0.f);
_setHideAnim(m_categoryBtnPageM, "CATEGORY/PAGE_MINUS", 0, 200, 1.f, 0.f);
_setHideAnim(m_categoryBtnPageP, "CATEGORY/PAGE_PLUS", 0, 200, 1.f, 0.f);
_setHideAnim(m_categoryBtnBack, "CATEGORY/BACK_BTN", 0, 200, 1.f, 0.f);
for (int i = 0; i < 20; ++i) {
_setHideAnim(m_categoryBtnCat[i], sfmt("CATEGORY/CAT_%i_BTN", i).c_str(), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryBtnCats[i], sfmt("CATEGORY/CAT_%i_BTNS", i).c_str(), 0, 0, 1.f, 0.f);
_setHideAnim(m_categoryLblCat[i], sfmt("CATEGORY/CAT_%i", i).c_str(), 0, 0, 1.f, 0.f);
}
_hideCategorySettings(true); _hideCategorySettings(true);
_textCategorySettings(); _textCategorySettings();
} }
void CMenu::_textCategorySettings(void) void CMenu::_textCategorySettings(void)
{ {
m_btnMgr.setText(m_categoryLblTitle, _t("cfgg17", L"Categories"));
m_btnMgr.setText(m_categoryBtnBack, _t("cd1", L"Back")); m_btnMgr.setText(m_categoryBtnBack, _t("cd1", L"Back"));
m_btnMgr.setText(m_categoryBtn[0], _t("dl3", L"All")); for (int i=0; i<20; ++i)
for (int i = 1; i < 12; i++) {
m_btnMgr.setText(m_categoryBtn[i], m_cat.getWString("GENERAL", sfmt("cat%d",i).c_str(), wfmt(L"Category %i",i).c_str())); if (i == 0) m_btnMgr.setText(m_categoryLblCat[i], _t("dl3", L"All"));
else m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString("GENERAL", fmt("cat%d",i), wfmt(L"Category %i",i).c_str()));
m_btnMgr.setText(m_categoryBtnCat[i], _t("off", L"OFF"));
m_btnMgr.setText(m_categoryBtnCats[i], _t("on", L"ON"));
}
} }

View File

@ -14,7 +14,6 @@ static inline int loopNum(int i, int s)
return i < 0 ? (s - (-i % s)) % s : i % s; return i < 0 ? (s - (-i % s)) % s : i % s;
} }
u8 m_gameSettingCategories[12];
u32 g_numGCfPages = 4; u32 g_numGCfPages = 4;
void CMenu::_hideGameSettings(bool instant) void CMenu::_hideGameSettings(bool instant)
@ -89,10 +88,6 @@ void CMenu::_hideGameSettings(bool instant)
m_btnMgr.hide(m_gameSettingsBtnIOSP, instant); m_btnMgr.hide(m_gameSettingsBtnIOSP, instant);
m_btnMgr.hide(m_gameSettingsBtnIOSM, instant); m_btnMgr.hide(m_gameSettingsBtnIOSM, instant);
for (int i = 0; i < 12; ++i) {
m_btnMgr.hide(m_gameSettingsBtnCategory[i], instant);
m_btnMgr.hide(m_gameSettingsLblCategory[i], instant);
}
for (u32 i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i) for (u32 i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
if (m_gameSettingsLblUser[i] != -1u) if (m_gameSettingsLblUser[i] != -1u)
m_btnMgr.hide(m_gameSettingsLblUser[i], instant); m_btnMgr.hide(m_gameSettingsLblUser[i], instant);
@ -351,71 +346,15 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsLblCustom); m_btnMgr.hide(m_gameSettingsLblCustom);
m_btnMgr.hide(m_gameSettingsBtnCustom); m_btnMgr.hide(m_gameSettingsBtnCustom);
} }
u32 i = 0; u32 i = 0;
//Categories Pages
if (m_gameSettingsPage == 51)
{
for (i = 1; i < (u32)min(m_max_categories+1, 5); ++i)
{
m_btnMgr.show(m_gameSettingsBtnCategory[i]);
m_btnMgr.show(m_gameSettingsLblCategory[i]);
}
}
else
{
for (i = 1; i < 5; ++i)
{
m_btnMgr.hide(m_gameSettingsBtnCategory[i]);
m_btnMgr.hide(m_gameSettingsLblCategory[i]);
}
}
if (m_gameSettingsPage == 52)
{
for (i = 5; i < (u32)min(m_max_categories+1, 9); ++i)
{
m_btnMgr.show(m_gameSettingsBtnCategory[i]);
m_btnMgr.show(m_gameSettingsLblCategory[i]);
}
}
else
{
for (i = 5; i < 9; ++i)
{
m_btnMgr.hide(m_gameSettingsBtnCategory[i]);
m_btnMgr.hide(m_gameSettingsLblCategory[i]);
}
}
if (m_gameSettingsPage == 53)
{
for (i = 9; i < (u32)min(m_max_categories+1, 12);++i)
{
m_btnMgr.show(m_gameSettingsBtnCategory[i]);
m_btnMgr.show(m_gameSettingsLblCategory[i]);
}
}
else
{
for (i = 9; i < 12; ++i)
{
m_btnMgr.hide(m_gameSettingsBtnCategory[i]);
m_btnMgr.hide(m_gameSettingsLblCategory[i]);
}
}
for (i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i) for (i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
if (m_gameSettingsLblUser[i] != -1u) if (m_gameSettingsLblUser[i] != -1u)
m_btnMgr.show(m_gameSettingsLblUser[i]); m_btnMgr.show(m_gameSettingsLblUser[i]);
string id(m_cf.getId()); string id(m_cf.getId());
int page = m_gameSettingsPage; int page = m_gameSettingsPage;
u32 maxpage = g_numGCfPages; u32 maxpage = g_numGCfPages;
if (m_gameSettingsPage > maxpage)
page = m_gameSettingsPage-50;
m_btnMgr.setText(m_gameSettingsLblPage, wfmt(L"%i / %i", page, maxpage)); m_btnMgr.setText(m_gameSettingsLblPage, wfmt(L"%i / %i", page, maxpage));
m_btnMgr.setText(m_gameSettingsBtnOcarina, _optBoolToString(m_gcfg2.getOptBool(id, "cheat"))); m_btnMgr.setText(m_gameSettingsBtnOcarina, _optBoolToString(m_gcfg2.getOptBool(id, "cheat")));
if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d) if(m_cf.getHdr()->hdr.gc_magic != 0xc2339f3d)
@ -465,13 +404,6 @@ void CMenu::_showGameSettings(void)
m_btnMgr.setText(m_gameSettingsBtnCategoryMain, _fmt("cfgg16", wfmt(L"Select",i).c_str() )); m_btnMgr.setText(m_gameSettingsBtnCategoryMain, _fmt("cfgg16", wfmt(L"Select",i).c_str() ));
char *categories = (char *) m_cat.getString("CATEGORIES", id, "").c_str();
memset(&m_gameSettingCategories, '0', sizeof(m_gameSettingCategories));
if (strlen(categories) == sizeof(m_gameSettingCategories))
memcpy(&m_gameSettingCategories, categories, sizeof(m_gameSettingCategories));
for (int i=0; i<12; ++i)
m_btnMgr.setText(m_gameSettingsBtnCategory[i], _optBoolToString(m_gameSettingCategories[i] == '1'));
i = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); i = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
m_btnMgr.setText(m_gameSettingsLblEmulationVal, _t(CMenu::_SaveEmu[i].id, CMenu::_SaveEmu[i].text)); m_btnMgr.setText(m_gameSettingsLblEmulationVal, _t(CMenu::_SaveEmu[i].id, CMenu::_SaveEmu[i].text));
@ -498,10 +430,7 @@ void CMenu::_gameSettings(void)
{ {
if (m_gameSettingsPage == 1) if (m_gameSettingsPage == 1)
m_gameSettingsPage = g_numGCfPages; m_gameSettingsPage = g_numGCfPages;
else if (m_gameSettingsPage == 51) else --m_gameSettingsPage;
m_gameSettingsPage = 53;
else if ((m_gameSettingsPage > 1 && m_gameSettingsPage <= g_numGCfPages) || m_gameSettingsPage > 51)
--m_gameSettingsPage;
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageM); if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageM);
_showGameSettings(); _showGameSettings();
} }
@ -509,11 +438,7 @@ void CMenu::_gameSettings(void)
{ {
if (m_gameSettingsPage == g_numGCfPages) if (m_gameSettingsPage == g_numGCfPages)
m_gameSettingsPage = 1; m_gameSettingsPage = 1;
else if (m_gameSettingsPage == 53) else ++m_gameSettingsPage;
m_gameSettingsPage = 51;
else if (m_gameSettingsPage < g_numGCfPages || (m_gameSettingsPage > g_numGCfPages && m_gameSettingsPage < 53 && m_max_categories > 8)
|| (m_gameSettingsPage > g_numGCfPages && m_gameSettingsPage < 52 && m_max_categories > 3))
++m_gameSettingsPage;
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageP); if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) m_btnMgr.click(m_gameSettingsBtnPageP);
_showGameSettings(); _showGameSettings();
} }
@ -678,20 +603,9 @@ void CMenu::_gameSettings(void)
else if (m_btnMgr.selected(m_gameSettingsBtnCategoryMain)) else if (m_btnMgr.selected(m_gameSettingsBtnCategoryMain))
{ {
_hideGameSettings(); _hideGameSettings();
m_gameSettingsPage = 51; _CategorySettings(true);
_showGameSettings(); _showGameSettings();
} }
for (int i = 0; i < 12; ++i)
if (m_btnMgr.selected(m_gameSettingsBtnCategory[i]))
{
m_gameSettingCategories[i] = m_gameSettingCategories[i] == '1' ? '0' : '1';
char categories[13];
memset(&categories, 0, sizeof(categories));
memcpy(&categories, &m_gameSettingCategories, sizeof(m_gameSettingCategories));
m_cat.setString("CATEGORIES", id, categories);
_showGameSettings();
break;
}
} }
else if ((WBTN_2_HELD && WBTN_1_PRESSED) || (WBTN_1_HELD && WBTN_2_PRESSED)) else if ((WBTN_2_HELD && WBTN_1_PRESSED) || (WBTN_1_HELD && WBTN_2_PRESSED))
{ {
@ -805,37 +719,6 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme)
m_gameSettingsLblCustom = _addLabel(theme, "GAME_SETTINGS/CUSTOM", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsLblCustom = _addLabel(theme, "GAME_SETTINGS/CUSTOM", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCustom = _addButton(theme, "GAME_SETTINGS/CUSTOM_BTN", theme.btnFont, L"", 350, 310, 240, 56, theme.btnFontColor); m_gameSettingsBtnCustom = _addButton(theme, "GAME_SETTINGS/CUSTOM_BTN", theme.btnFont, L"", 350, 310, 240, 56, theme.btnFontColor);
//Categories Page 1
//m_gameSettingsLblCategory[0] = _addLabel(theme, "GAME_SETTINGS/CAT_ALL", theme.lblFont, L"All", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
//m_gameSettingsBtnCategory[0] = _addButton(theme, "GAME_SETTINGS/CAT_ALL_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[1] = _addLabel(theme, "GAME_SETTINGS/CAT_1", theme.lblFont, L"", 40, 130, 190, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[1] = _addButton(theme, "GAME_SETTINGS/CAT_1_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[2] = _addLabel(theme, "GAME_SETTINGS/CAT_2", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[2] = _addButton(theme, "GAME_SETTINGS/CAT_2_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[3] = _addLabel(theme, "GAME_SETTINGS/CAT_3", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[3] = _addButton(theme, "GAME_SETTINGS/CAT_3_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[4] = _addLabel(theme, "GAME_SETTINGS/CAT_4", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[4] = _addButton(theme, "GAME_SETTINGS/CAT_4_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
//Categories Page 2
m_gameSettingsLblCategory[5] = _addLabel(theme, "GAME_SETTINGS/CAT_5", theme.lblFont, L"", 40, 130, 190, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[5] = _addButton(theme, "GAME_SETTINGS/CAT_5_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[6] = _addLabel(theme, "GAME_SETTINGS/CAT_6", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[6] = _addButton(theme, "GAME_SETTINGS/CAT_6_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[7] = _addLabel(theme, "GAME_SETTINGS/CAT_7", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[7] = _addButton(theme, "GAME_SETTINGS/CAT_7_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[8] = _addLabel(theme, "GAME_SETTINGS/CAT_8", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[8] = _addButton(theme, "GAME_SETTINGS/CAT_8_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
//Categories Page 3
m_gameSettingsLblCategory[9] = _addLabel(theme, "GAME_SETTINGS/CAT_9", theme.lblFont, L"", 40, 130, 190, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[9] = _addButton(theme, "GAME_SETTINGS/CAT_9_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[10] = _addLabel(theme, "GAME_SETTINGS/CAT_10", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[10] = _addButton(theme, "GAME_SETTINGS/CAT_10_BTN", theme.btnFont, L"", 330, 190, 270, 56, theme.btnFontColor);
m_gameSettingsLblCategory[11] = _addLabel(theme, "GAME_SETTINGS/CAT_11", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnCategory[11] = _addButton(theme, "GAME_SETTINGS/CAT_11_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
m_gameSettingsLblPage = _addLabel(theme, "GAME_SETTINGS/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_gameSettingsLblPage = _addLabel(theme, "GAME_SETTINGS/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnPageM = _addPicButton(theme, "GAME_SETTINGS/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56); m_gameSettingsBtnPageM = _addPicButton(theme, "GAME_SETTINGS/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
m_gameSettingsBtnPageP = _addPicButton(theme, "GAME_SETTINGS/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56); m_gameSettingsBtnPageP = _addPicButton(theme, "GAME_SETTINGS/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56);
@ -911,12 +794,6 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme)
//Categories //Categories
_setHideAnim(m_gameSettingsBtnCategoryMain, "GAME_SETTINGS/CAT_MAIN_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnCategoryMain, "GAME_SETTINGS/CAT_MAIN_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblCategoryMain, "GAME_SETTINGS/CAT_MAIN", -200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblCategoryMain, "GAME_SETTINGS/CAT_MAIN", -200, 0, 1.f, 0.f);
//_setHideAnim(m_gameSettingsBtnCategory[0], "GAME_SETTINGS/CAT_ALL_BTN", 200, 0, 1.f, 0.f);
//_setHideAnim(m_gameSettingsLblCategory[0], "GAME_SETTINGS/CAT_ALL", -200, 0, 1.f, 0.f);
for (int i = 1; i < 12; ++i) {
_setHideAnim(m_gameSettingsBtnCategory[i], sfmt("GAME_SETTINGS/CAT_%i_BTN", i).c_str(), 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblCategory[i], sfmt("GAME_SETTINGS/CAT_%i", i).c_str(), -200, 0, 1.f, 0.f);
}
_hideGameSettings(true); _hideGameSettings(true);
_textGameSettings(); _textGameSettings();
@ -949,6 +826,4 @@ void CMenu::_textGameSettings(void)
m_btnMgr.setText(m_gameSettingsLblNMM, _t("cfgg28", L"NMM")); m_btnMgr.setText(m_gameSettingsLblNMM, _t("cfgg28", L"NMM"));
m_btnMgr.setText(m_gameSettingsLblNoDVD, _t("cfgg29", L"No DVD Patch")); m_btnMgr.setText(m_gameSettingsLblNoDVD, _t("cfgg29", L"No DVD Patch"));
m_btnMgr.setText(m_gameSettingsLblCustom, _t("custom", L"Custom")); m_btnMgr.setText(m_gameSettingsLblCustom, _t("custom", L"Custom"));
for (int i = 1; i < 12; ++i)
m_btnMgr.setText(m_gameSettingsLblCategory[i], m_cat.getWString("GENERAL", fmt("cat%d",i), wfmt(L"Category %i",i).c_str()));
} }