mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
- Source menu update. Now you can have 46 buttons and 4 pages and I can easily add more if needed. Now you can have multiple magic numbers/plugins per button seperated by commas. This means you can have a wii64 button for both not64 and wii64 for example.
This commit is contained in:
parent
e646425e2a
commit
c23025a63f
@ -20,6 +20,7 @@ extern const u8 favoritesons_png[];
|
|||||||
int Source_curPage;
|
int Source_curPage;
|
||||||
int pages;
|
int pages;
|
||||||
u8 numPlugins;
|
u8 numPlugins;
|
||||||
|
u8 maxBtns = 47;
|
||||||
string m_sourceDir;
|
string m_sourceDir;
|
||||||
Config m_source;
|
Config m_source;
|
||||||
|
|
||||||
@ -75,12 +76,13 @@ void CMenu::_showSource(void)
|
|||||||
|
|
||||||
m_btnMgr.show(m_sourceLblTitle);
|
m_btnMgr.show(m_sourceLblTitle);
|
||||||
|
|
||||||
for(i = 12; i < 36; ++i)
|
for(i = maxBtns; i > 11; --i)
|
||||||
{
|
{
|
||||||
string source = m_source.getString(fmt("BUTTON_%i", i), "source", "");
|
string source = m_source.getString(fmt("BUTTON_%i", i), "source", "");
|
||||||
if (!source.empty())
|
if (!source.empty())
|
||||||
{
|
{
|
||||||
pages = (i / 12) + 1;
|
pages = (i / 12) + 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +148,7 @@ bool CMenu::_Source()
|
|||||||
|
|
||||||
pdir = opendir(m_pluginsDir.c_str());
|
pdir = opendir(m_pluginsDir.c_str());
|
||||||
Config m_plugin_cfg;
|
Config m_plugin_cfg;
|
||||||
u8 i = 0;
|
u8 numPlugins = 0;
|
||||||
bool back = false;
|
bool back = false;
|
||||||
|
|
||||||
while((pent = readdir(pdir)) != NULL)
|
while((pent = readdir(pdir)) != NULL)
|
||||||
@ -159,7 +161,7 @@ bool CMenu::_Source()
|
|||||||
m_plugin_cfg.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
m_plugin_cfg.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name));
|
||||||
if (m_plugin_cfg.loaded())
|
if (m_plugin_cfg.loaded())
|
||||||
{
|
{
|
||||||
i++;
|
numPlugins++;
|
||||||
m_plugin.AddPlugin(m_plugin_cfg);
|
m_plugin.AddPlugin(m_plugin_cfg);
|
||||||
}
|
}
|
||||||
m_plugin_cfg.unload();
|
m_plugin_cfg.unload();
|
||||||
@ -167,7 +169,6 @@ bool CMenu::_Source()
|
|||||||
}
|
}
|
||||||
closedir(pdir);
|
closedir(pdir);
|
||||||
m_plugin.EndAdd();
|
m_plugin.EndAdd();
|
||||||
numPlugins = i;
|
|
||||||
|
|
||||||
SetupInput();
|
SetupInput();
|
||||||
bool show_homebrew = !m_cfg.getBool("HOMEBREW", "disable", false);
|
bool show_homebrew = !m_cfg.getBool("HOMEBREW", "disable", false);
|
||||||
@ -205,14 +206,18 @@ bool CMenu::_Source()
|
|||||||
m_btnMgr.down();
|
m_btnMgr.down();
|
||||||
if(((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED) && pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
if(((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED) && pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
||||||
{
|
{
|
||||||
Source_curPage = Source_curPage == 1 ? pages : (Source_curPage == 2 ? 1 : 2);
|
Source_curPage--;
|
||||||
|
if(Source_curPage < 1)
|
||||||
|
Source_curPage = pages;
|
||||||
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
|
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
|
||||||
m_btnMgr.click(m_sourceBtnPageM);
|
m_btnMgr.click(m_sourceBtnPageM);
|
||||||
_updateSourceBtns();
|
_updateSourceBtns();
|
||||||
}
|
}
|
||||||
else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED) && pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED) && pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
||||||
{
|
{
|
||||||
Source_curPage = Source_curPage == 3 ? 1 : (Source_curPage == 1 ? 2 : (pages == 2 ? 1 : 3));
|
Source_curPage++;
|
||||||
|
if(Source_curPage > pages)
|
||||||
|
Source_curPage = 1;
|
||||||
if (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
|
if (BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
|
||||||
m_btnMgr.click(m_sourceBtnPageP);
|
m_btnMgr.click(m_sourceBtnPageP);
|
||||||
_updateSourceBtns();
|
_updateSourceBtns();
|
||||||
@ -337,16 +342,20 @@ bool CMenu::_Source()
|
|||||||
{
|
{
|
||||||
m_current_view = COVERFLOW_PLUGIN;
|
m_current_view = COVERFLOW_PLUGIN;
|
||||||
imgSelected = true;
|
imgSelected = true;
|
||||||
u32 sourceMagic = strtoul(m_source.getString(fmt("BUTTON_%i", i + j), "magic","").c_str(), NULL, 16);
|
vector<string> magicNums = m_source.getStrings(fmt("BUTTON_%i", i + j), "magic", ',');
|
||||||
for (u8 k = 0; k < numPlugins; ++k)
|
if (magicNums.size() > 0)
|
||||||
{
|
{
|
||||||
if (sourceMagic == m_plugin.getPluginMagic(k))
|
for (u8 k = 0; k < numPlugins; ++k)
|
||||||
{
|
|
||||||
m_plugin.SetEnablePlugin(m_cfg, k, 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_plugin.SetEnablePlugin(m_cfg, k, 1);
|
m_plugin.SetEnablePlugin(m_cfg, k, 1);
|
||||||
|
for (vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
||||||
|
{
|
||||||
|
string magic = *itr;
|
||||||
|
u32 sourceMagic = strtoul(magic.c_str(), NULL, 16);
|
||||||
|
for (u8 k = 0; k < numPlugins; ++k)
|
||||||
|
{
|
||||||
|
if (sourceMagic == m_plugin.getPluginMagic(k))
|
||||||
|
m_plugin.SetEnablePlugin(m_cfg, k, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user