- Fix for source menu combined view to work properly across all pages

This commit is contained in:
fledge68 2013-08-15 12:26:44 +00:00
parent a59330463e
commit dbfec98ee5

View File

@ -99,10 +99,11 @@ void CMenu::_updateSourceBtns(void)
u8 j = (source_curPage - 1) * 12; u8 j = (source_curPage - 1) * 12;
sourceBtn = 0; sourceBtn = 0;
selectedBtns = 0; selectedBtns = 0;
for(u8 i = 0; i < 12; ++i) for(u8 i = 0; i < ((source_Pages - 1) * 12 + 12); ++i)
{ {
m_btnMgr.hide(m_sourceBtnSource[i], true); if(i < 12)
string btnSource = m_source.getString(fmt("BUTTON_%i", (i + j)), "source", ""); m_btnMgr.hide(m_sourceBtnSource[i], true);
string btnSource = m_source.getString(fmt("BUTTON_%i", i), "source", "");
if(btnSource == "") if(btnSource == "")
continue; continue;
@ -111,40 +112,40 @@ void CMenu::_updateSourceBtns(void)
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg); const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
if(EnabledPlugins.size() == 0) if(EnabledPlugins.size() == 0)
{ {
sourceBtn = i + j; sourceBtn = i;
selectedBtns++; selectedBtns++;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
} }
else else
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
} }
else if(btnSource == "plugin") else if(btnSource == "plugin")
{ {
magicNums.clear(); magicNums.clear();
magicNums = m_source.getStrings(fmt("BUTTON_%i", i + j), "magic", ','); magicNums = m_source.getStrings(fmt("BUTTON_%i", i), "magic", ',');
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false) && m_cfg.getBool("PLUGIN", magicNums.at(0), false)) if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false) && m_cfg.getBool("PLUGIN", magicNums.at(0), false))
{ {
sourceBtn = i + j; sourceBtn = i;
selectedBtns++; selectedBtns++;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
} }
else else
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
} }
else if(btnSource == "realnand" || btnSource == "emunand") else if(btnSource == "realnand" || btnSource == "emunand")
{ {
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "realnand") if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "realnand")
{ {
sourceBtn = i + j; sourceBtn = i;
selectedBtns++; selectedBtns++;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
} }
else if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && !m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "emunand") else if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && !m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "emunand")
{ {
sourceBtn = i + j; sourceBtn = i;
selectedBtns++; selectedBtns++;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
} }
} }
else if(btnSource != "realnand" && btnSource != "emunand" && btnSource != "plugin" && btnSource != "allplugins") else if(btnSource != "realnand" && btnSource != "emunand" && btnSource != "plugin" && btnSource != "allplugins")
@ -152,30 +153,32 @@ void CMenu::_updateSourceBtns(void)
string domain = (btnSource == "dml" ? GC_DOMAIN : (btnSource == "homebrew" ? HOMEBREW_DOMAIN : WII_DOMAIN)); string domain = (btnSource == "dml" ? GC_DOMAIN : (btnSource == "homebrew" ? HOMEBREW_DOMAIN : WII_DOMAIN));
if(m_cfg.getBool(domain, "source", false)) if(m_cfg.getBool(domain, "source", false))
{ {
sourceBtn = i + j; sourceBtn = i;
selectedBtns++; selectedBtns++;
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
} }
else else
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str(); ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
} }
ImgSelName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str(); ImgSelName = m_source.getString(fmt("BUTTON_%i", i),"image_s", "").c_str();
if(i >= j && i < (j + 12))
TexData texConsoleImg;
TexData texConsoleImgs;
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), ImgName)) != TE_OK)
{ {
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK) TexData texConsoleImg;
TexHandle.fromPNG(texConsoleImg, favoriteson_png); TexData texConsoleImgs;
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), ImgName)) != TE_OK)
{
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_sourceDir.c_str(), ImgName)) != TE_OK)
TexHandle.fromPNG(texConsoleImg, favoriteson_png);
}
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), ImgSelName)) != TE_OK)
{
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), ImgSelName)) != TE_OK)
TexHandle.fromPNG(texConsoleImgs, favoritesons_png);
}
m_btnMgr.setBtnTexture(m_sourceBtnSource[i - j], texConsoleImg, texConsoleImgs);
m_btnMgr.show(m_sourceBtnSource[i - j]);
} }
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), ImgSelName)) != TE_OK)
{
if(TexHandle.fromImageFile(texConsoleImgs, fmt("%s/%s", m_sourceDir.c_str(), ImgSelName)) != TE_OK)
TexHandle.fromPNG(texConsoleImgs, favoritesons_png);
}
m_btnMgr.setBtnTexture(m_sourceBtnSource[i], texConsoleImg, texConsoleImgs);
m_btnMgr.show(m_sourceBtnSource[i]);
} }
} }
@ -278,7 +281,19 @@ bool CMenu::_Source()
} }
if(selectedBtns == 0) if(selectedBtns == 0)
m_cfg.setBool(WII_DOMAIN, "source", true); m_cfg.setBool(WII_DOMAIN, "source", true);
if(selectedBtns > 1)
u8 sourceCount = 0;
if(m_cfg.getBool(WII_DOMAIN, "source", false))
sourceCount++;
if(m_cfg.getBool(GC_DOMAIN, "source", false))
sourceCount++;
if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false))
sourceCount++;
if(m_cfg.getBool(HOMEBREW_DOMAIN, "source", false))
sourceCount++;
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false))
sourceCount++;
if(sourceCount > 1)
m_combined_view = true; m_combined_view = true;
break; break;
} }