- added sub/tier source menu's. put all source menu ini's in dev:/wiiflow/source_menu. the first one must be named source_menu.ini. the others can be whatever you want. to access another source menu ini create a source button with source=new_source and set magic=filename.ini replacing filename with the one you want.

This commit is contained in:
Fledge68 2018-09-26 12:48:54 -05:00
parent 0c0fb2c3c5
commit ecd02f27f4
2 changed files with 153 additions and 68 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -92,6 +92,31 @@ void CMenu::_sourceFlow()
} }
} }
} }
else if(source =="new_source")
{
const char *fn = m_source.getString(btn_selected, "magic", "").c_str();
if(fsop_FileExist(fmt("%s/%s", m_sourceDir.c_str(), fn)))
{
m_source.unload();
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), fn));
/* get max source button # */
m_max_source_btn = 0;
const char *srcDomain = m_source.firstDomain().c_str();
while(1)
{
if(strlen(srcDomain) < 2)
break;
if(strrchr(srcDomain, '_') != NULL)
{
int srcBtnNumber = atoi(strrchr(srcDomain, '_') + 1);
if(srcBtnNumber > m_max_source_btn)
m_max_source_btn = srcBtnNumber;
}
srcDomain = m_source.nextDomain().c_str();
}
return;
}
}
else //(source == "wii") else //(source == "wii")
m_current_view = COVERFLOW_WII; m_current_view = COVERFLOW_WII;
m_sourceflow = false; m_sourceflow = false;
@ -143,18 +168,26 @@ void CMenu::_updateSourceBtns(void)
m_btnMgr.show(m_sourceBtnPageM); m_btnMgr.show(m_sourceBtnPageM);
m_btnMgr.show(m_sourceBtnPageP); m_btnMgr.show(m_sourceBtnPageP);
} }
else
{
m_btnMgr.hide(m_sourceLblPage);
m_btnMgr.hide(m_sourceBtnPageM);
m_btnMgr.hide(m_sourceBtnPageP);
}
j = (curPage - 1) * 12;
sourceBtn = 0; sourceBtn = 0;
selectedBtns = 0; selectedBtns = 0;
for(i = 0; i < ((numPages - 1) * 12 + 12); ++i) j = (curPage - 1) * 12;
for(i = j; i < (j + 12); ++i)
{
if(i > m_max_source_btn)
m_btnMgr.hide(m_sourceBtnSource[i -j]);
else
{ {
memset(current_btn, 0, 16); memset(current_btn, 0, 16);
strncpy(current_btn, fmt("BUTTON_%i", i), 15); strncpy(current_btn, fmt("BUTTON_%i", i), 15);
string btnSource = m_source.getString(current_btn, "source", ""); string btnSource = m_source.getString(current_btn, "source", "");
bool src_selected = false; bool src_selected = false;
//const char *btn_image = m_source.getString(current_btn,"image", "").c_str();
//const char *btn_imageSel = m_source.getString(current_btn,"image_s", "").c_str();
if(btnSource == "") if(btnSource == "")
continue; continue;
if(m_multisource) if(m_multisource)
@ -213,10 +246,6 @@ void CMenu::_updateSourceBtns(void)
else else
snprintf(btn_image, sizeof(btn_image), "%s", m_source.getString(current_btn,"image", "").c_str()); snprintf(btn_image, sizeof(btn_image), "%s", m_source.getString(current_btn,"image", "").c_str());
if(i >= j && i < (j + 12))
{
//m_btnMgr.hide(m_sourceBtnSource[i - j], true);
//m_btnMgr.tick();
TexData texConsoleImg; TexData texConsoleImg;
TexData texConsoleImgs; TexData texConsoleImgs;
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK) if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s/%s", m_sourceDir.c_str(), themeName, btn_image)) != TE_OK)
@ -405,6 +434,34 @@ bool CMenu::_Source()
if(enabledPluginsCount == 0) // no magic #'s or invalid ones so default to first plugin in list if(enabledPluginsCount == 0) // no magic #'s or invalid ones so default to first plugin in list
m_plugin.SetEnablePlugin(m_cfg, 0, 2); m_plugin.SetEnablePlugin(m_cfg, 0, 2);
} }
else if(source =="new_source")
{
const char *fn = m_source.getString(btn_selected, "magic", "").c_str();
if(fsop_FileExist(fmt("%s/%s", m_sourceDir.c_str(), fn)))
{
m_source.unload();
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), fn));
exitSource = false;
updateSource = true;
curPage = 1;
/* get max source button # */
m_max_source_btn = 0;
const char *srcDomain = m_source.firstDomain().c_str();
while(1)
{
if(strlen(srcDomain) < 2)
break;
if(strrchr(srcDomain, '_') != NULL)
{
int srcBtnNumber = atoi(strrchr(srcDomain, '_') + 1);
if(srcBtnNumber > m_max_source_btn)
m_max_source_btn = srcBtnNumber;
}
srcDomain = m_source.nextDomain().c_str();
}
numPages = (m_max_source_btn / 12) + 1;
}
}
else //if(source == "wii") or source is invalid or empty default to wii else //if(source == "wii") or source is invalid or empty default to wii
{ {
m_current_view = COVERFLOW_WII; m_current_view = COVERFLOW_WII;
@ -458,6 +515,34 @@ bool CMenu::_Source()
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount); m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
m_current_view = enabledPluginsCount > 0 ? (m_current_view | COVERFLOW_PLUGIN) : (m_current_view & ~COVERFLOW_PLUGIN); m_current_view = enabledPluginsCount > 0 ? (m_current_view | COVERFLOW_PLUGIN) : (m_current_view & ~COVERFLOW_PLUGIN);
} }
else if(source =="new_source")
{
const char *fn = m_source.getString(btn_selected, "magic", "").c_str();
if(fsop_FileExist(fmt("%s/%s", m_sourceDir.c_str(), fn)))
{
m_source.unload();
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), fn));
exitSource = false;
updateSource = true;
curPage = 1;
/* get max source button # */
m_max_source_btn = 0;
const char *srcDomain = m_source.firstDomain().c_str();
while(1)
{
if(strlen(srcDomain) < 2)
break;
if(strrchr(srcDomain, '_') != NULL)
{
int srcBtnNumber = atoi(strrchr(srcDomain, '_') + 1);
if(srcBtnNumber > m_max_source_btn)
m_max_source_btn = srcBtnNumber;
}
srcDomain = m_source.nextDomain().c_str();
}
numPages = (m_max_source_btn / 12) + 1;
}
}
} }
} }
if(exitSource) if(exitSource)