mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 21:54:15 +01:00
- added ability to auto select a category for source menu plugin buttons. So you can do as wiimpathy suggested.
- all theme related source menu images and ini now need to go in a subfolder of wiiflow/source_menu/ and be named the same as the theme data folder. this keeps source stuff seperate from theme stuff. - redid the code for menu_source making it more compact and smaller even with the new additions and shrunk menu_category a little.
This commit is contained in:
parent
1afd473be8
commit
f9274d4c88
@ -125,6 +125,8 @@ CMenu::CMenu()
|
||||
m_use_wifi_gecko = false;
|
||||
init_network = false;
|
||||
m_use_source = true;
|
||||
m_clearCats = true;
|
||||
m_catStartPage = 1;
|
||||
}
|
||||
|
||||
void CMenu::init()
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
u8 enabledPluginPos;
|
||||
u8 enabledPluginsCount;
|
||||
char PluginMagicWord[9];
|
||||
u8 m_catStartPage;
|
||||
bool m_clearCats;
|
||||
private:
|
||||
struct SZone
|
||||
{
|
||||
@ -943,6 +945,7 @@ private:
|
||||
void _showCoverBanner(void);
|
||||
void _showExplorer(void);
|
||||
void _showWad(void);
|
||||
void _clearSources(void);
|
||||
void _updateSourceBtns(void);
|
||||
void _updatePluginText(void);
|
||||
void _updatePluginCheckboxes(void);
|
||||
|
@ -18,7 +18,6 @@ s16 m_categoryBtnCatReq[11];
|
||||
s16 m_categoryLblUser[4];
|
||||
TexData m_categoryBg;
|
||||
|
||||
vector<string> sourceMagics;
|
||||
vector<char> m_categories;
|
||||
u8 curPage;
|
||||
u8 lastBtn;
|
||||
@ -164,72 +163,8 @@ void CMenu::_CategorySettings(bool fromGameSet)
|
||||
curPage = 1;
|
||||
gameSet = fromGameSet;
|
||||
|
||||
if(m_source.loaded())
|
||||
{
|
||||
u8 sourceCount = 0;
|
||||
string sourceName = "";
|
||||
if(m_cfg.getBool(WII_DOMAIN, "source", false))
|
||||
{
|
||||
sourceCount++;
|
||||
sourceName = "wii";
|
||||
}
|
||||
if(m_cfg.getBool(GC_DOMAIN, "source", false))
|
||||
{
|
||||
sourceCount++;
|
||||
sourceName = "dml";
|
||||
}
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false))
|
||||
{
|
||||
sourceCount++;
|
||||
sourceName = "emunand";
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "disable"))
|
||||
sourceName = "realnand";
|
||||
}
|
||||
if(m_cfg.getBool(HOMEBREW_DOMAIN, "source", false))
|
||||
{
|
||||
sourceCount++;
|
||||
sourceName = "homebrew";
|
||||
}
|
||||
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false))
|
||||
{
|
||||
sourceCount++;
|
||||
sourceName = "plugin";
|
||||
_checkForSinglePlugin();
|
||||
if(sourceCount == 1 && enabledPluginsCount != 1)
|
||||
sourceCount = 0;
|
||||
}
|
||||
if(sourceCount == 1)
|
||||
{
|
||||
for(int i = 0; i < m_cfg.getInt("GENERAL", "max_source_buttons", 71); ++i)
|
||||
{
|
||||
if(sourceName == m_source.getString(fmt("BUTTON_%i", i), "source", ""))
|
||||
{
|
||||
if(sourceName != "plugin")
|
||||
{
|
||||
curPage = m_source.getInt(fmt("BUTTON_%i", i), "catpage", 1);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceMagics.clear();
|
||||
sourceMagics = m_source.getStrings(fmt("BUTTON_%i", i), "magic", ',');
|
||||
if (sourceMagics.size() > 0)
|
||||
{
|
||||
for (vector<string>::iterator itr = sourceMagics.begin(); itr != sourceMagics.end(); itr++)
|
||||
{
|
||||
string sourceMagic = *itr;
|
||||
if(PluginMagicWord == sourceMagic)
|
||||
{
|
||||
curPage = m_source.getInt(fmt("BUTTON_%i", i), "catpage", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m_source.loaded() && m_catStartPage > 0)
|
||||
curPage = m_catStartPage;
|
||||
|
||||
m_max_categories = m_cat.getInt("GENERAL", "numcategories", 6);
|
||||
if(curPage < 1 || curPage > (((m_max_categories - 2)/ 10) + 1))
|
||||
|
@ -185,8 +185,12 @@ void CMenu::LoadView(void)
|
||||
CoverFlow.clear();
|
||||
if(!m_vid.showingWaitMessage())
|
||||
_showWaitMessage();
|
||||
if(m_clearCats)
|
||||
{
|
||||
m_cat.remove("GENERAL", "selected_categories");
|
||||
m_cat.remove("GENERAL", "required_categories");
|
||||
}
|
||||
m_clearCats = true;
|
||||
m_favorites = false;
|
||||
if (m_cfg.getBool("GENERAL", "save_favorites_mode", false))
|
||||
m_favorites = m_cfg.getBool(_domainFromView(), "favorites", false);
|
||||
@ -309,7 +313,7 @@ int CMenu::main(void)
|
||||
}
|
||||
if(dpad_mode && (BTN_UP_PRESSED || BTN_DOWN_PRESSED || BTN_LEFT_PRESSED || BTN_RIGHT_PRESSED) && (m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnUsb) || m_btnMgr.selected(m_mainBtnDML) || m_btnMgr.selected(m_mainBtnHomebrew) || m_btnMgr.selected(m_mainBtnEmu)))
|
||||
{
|
||||
u32 lastView = m_current_view;
|
||||
u8 lastView = m_current_view;
|
||||
if(BTN_UP_PRESSED)
|
||||
m_current_view = COVERFLOW_USB;
|
||||
else if(BTN_DOWN_PRESSED && (m_show_dml ||m_devo_installed))
|
||||
@ -342,6 +346,7 @@ int CMenu::main(void)
|
||||
default:
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
}
|
||||
m_catStartPage = 1;
|
||||
LoadView();
|
||||
continue;
|
||||
}
|
||||
@ -403,6 +408,7 @@ int CMenu::main(void)
|
||||
default:
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
}
|
||||
m_catStartPage = 1;
|
||||
LoadView();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_mainBtnInit))
|
||||
|
@ -34,10 +34,12 @@ s16 m_sourceBtnHomebrew;
|
||||
|
||||
TexData m_sourceBg;
|
||||
|
||||
int Source_curPage;
|
||||
int pages;
|
||||
u8 numPlugins;
|
||||
u8 sourceBtn;
|
||||
u8 selectedBtns;
|
||||
int source_curPage;
|
||||
int source_Pages;
|
||||
string m_sourceDir;
|
||||
string themeName;
|
||||
vector<string> magicNums;
|
||||
|
||||
void CMenu::_hideSource(bool instant)
|
||||
@ -54,13 +56,14 @@ void CMenu::_hideSource(bool instant)
|
||||
m_btnMgr.hide(m_sourceBtnDML, instant);
|
||||
m_btnMgr.hide(m_sourceBtnEmu, instant);
|
||||
|
||||
for(u8 i = 0; i < ARRAY_SIZE(m_sourceLblUser); ++i)
|
||||
u8 i;
|
||||
for(i = 0; i < ARRAY_SIZE(m_sourceLblUser); ++i)
|
||||
{
|
||||
if(m_sourceLblUser[i] != -1)
|
||||
m_btnMgr.hide(m_sourceLblUser[i], instant);
|
||||
}
|
||||
|
||||
for(u8 i = 0; i < 12; ++i)
|
||||
for(i = 0; i < 12; ++i)
|
||||
{
|
||||
m_btnMgr.hide(m_sourceBtnSource[i], instant);
|
||||
m_btnMgr.freeBtnTexture(m_sourceBtnSource[i]);
|
||||
@ -79,37 +82,26 @@ void CMenu::_showSource(void)
|
||||
|
||||
m_btnMgr.show(m_sourceLblTitle);
|
||||
m_btnMgr.show(m_sourceBtnBack);
|
||||
|
||||
for(u8 i = m_cfg.getInt("GENERAL", "max_source_buttons", 71); i > 11; --i)
|
||||
{
|
||||
string source = m_source.getString(fmt("BUTTON_%i", i), "source", "");
|
||||
if (!source.empty())
|
||||
{
|
||||
pages = (i / 12) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMenu::_updateSourceBtns(void)
|
||||
{
|
||||
if (pages > 1)
|
||||
if (source_Pages > 1)
|
||||
{
|
||||
m_btnMgr.setText(m_sourceLblPage, wfmt(L"%i / %i", Source_curPage, pages));
|
||||
m_btnMgr.setText(m_sourceLblPage, wfmt(L"%i / %i", source_curPage, source_Pages));
|
||||
m_btnMgr.show(m_sourceLblPage);
|
||||
m_btnMgr.show(m_sourceBtnPageM);
|
||||
m_btnMgr.show(m_sourceBtnPageP);
|
||||
}
|
||||
for (u8 i = 0; i < 12; ++i)
|
||||
m_btnMgr.hide(m_sourceBtnSource[i], true);
|
||||
|
||||
const char *ImgName = NULL;
|
||||
const char *ImgSelName = NULL;
|
||||
u8 j = (Source_curPage - 1) * 12;
|
||||
|
||||
u8 j = (source_curPage - 1) * 12;
|
||||
sourceBtn = 0;
|
||||
selectedBtns = 0;
|
||||
for(u8 i = 0; i < 12; ++i)
|
||||
{
|
||||
m_btnMgr.hide(m_sourceBtnSource[i], true);
|
||||
string btnSource = m_source.getString(fmt("BUTTON_%i", (i + j)), "source", "");
|
||||
|
||||
if(btnSource == "")
|
||||
@ -118,7 +110,11 @@ void CMenu::_updateSourceBtns(void)
|
||||
{
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
if(EnabledPlugins.size() == 0)
|
||||
{
|
||||
sourceBtn = i + j;
|
||||
selectedBtns++;
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str();
|
||||
}
|
||||
else
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str();
|
||||
}
|
||||
@ -127,7 +123,11 @@ void CMenu::_updateSourceBtns(void)
|
||||
magicNums.clear();
|
||||
magicNums = m_source.getStrings(fmt("BUTTON_%i", i + j), "magic", ',');
|
||||
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", false) && m_cfg.getBool("PLUGIN", magicNums.at(0), false))
|
||||
{
|
||||
sourceBtn = i + j;
|
||||
selectedBtns++;
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str();
|
||||
}
|
||||
else
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str();
|
||||
}
|
||||
@ -135,7 +135,11 @@ void CMenu::_updateSourceBtns(void)
|
||||
{
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str();
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "realnand")
|
||||
{
|
||||
sourceBtn = i + j;
|
||||
selectedBtns++;
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str();
|
||||
}
|
||||
else if(m_cfg.getBool(CHANNEL_DOMAIN, "source", false) && !m_cfg.getBool(CHANNEL_DOMAIN, "disable") && btnSource == "emunand")
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str();
|
||||
}
|
||||
@ -143,7 +147,11 @@ void CMenu::_updateSourceBtns(void)
|
||||
{
|
||||
string domain = (btnSource == "dml" ? GC_DOMAIN : (btnSource == "homebrew" ? HOMEBREW_DOMAIN : WII_DOMAIN));
|
||||
if(m_cfg.getBool(domain, "source", false))
|
||||
{
|
||||
sourceBtn = i + j;
|
||||
selectedBtns++;
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image_s", "").c_str();
|
||||
}
|
||||
else
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i + j),"image", "").c_str();
|
||||
}
|
||||
@ -152,12 +160,12 @@ void CMenu::_updateSourceBtns(void)
|
||||
|
||||
TexData texConsoleImg;
|
||||
TexData texConsoleImgs;
|
||||
if(TexHandle.fromImageFile(texConsoleImg, fmt("%s/%s", m_themeDataDir.c_str(), ImgName)) != TE_OK)
|
||||
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", m_themeDataDir.c_str(), ImgSelName)) != TE_OK)
|
||||
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);
|
||||
@ -175,22 +183,50 @@ void CMenu::_showSourceNotice(void)
|
||||
|
||||
bool CMenu::_Source()
|
||||
{
|
||||
u8 i, j, k;
|
||||
bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false);
|
||||
bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false);
|
||||
bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false);
|
||||
bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false);
|
||||
bool noChanges = true;
|
||||
bool updateSource = false;
|
||||
bool exitSource = false;
|
||||
u8 numPlugins = 0;
|
||||
m_showtimer = 0;
|
||||
source_curPage = 1;
|
||||
|
||||
SetupInput();
|
||||
_showSource();
|
||||
bool sourceIniLoaded = m_source.loaded();
|
||||
if(!sourceIniLoaded)
|
||||
{
|
||||
m_btnMgr.show(m_sourceBtnHomebrew);
|
||||
m_btnMgr.show(m_sourceBtnChannel);
|
||||
m_btnMgr.show(m_sourceBtnUsb);
|
||||
m_btnMgr.show(m_sourceBtnDML);
|
||||
m_btnMgr.show(m_sourceBtnEmu);
|
||||
}
|
||||
else
|
||||
{
|
||||
//set number of pages based on highest source btn number used
|
||||
for(i = m_cfg.getInt("GENERAL", "max_source_buttons", 71); i > 11; --i)
|
||||
{
|
||||
string source = m_source.getString(fmt("BUTTON_%i", i), "source", "");
|
||||
if (!source.empty())
|
||||
{
|
||||
source_Pages = (i / 12) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(show_emu)
|
||||
{
|
||||
Config m_plugin_cfg;
|
||||
DIR *pdir;
|
||||
struct dirent *pent;
|
||||
|
||||
if(!m_source.loaded())
|
||||
if(!m_source.load(fmt("%s/%s", m_themeDataDir.c_str(), SOURCE_FILENAME)))
|
||||
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME));
|
||||
|
||||
pdir = opendir(m_pluginsDir.c_str());
|
||||
Config m_plugin_cfg;
|
||||
u8 numPlugins = 0;
|
||||
bool back = true;
|
||||
|
||||
while((pent = readdir(pdir)) != NULL)
|
||||
{
|
||||
if(pent->d_name[0] == '.'|| strcasecmp(pent->d_name, "plugins.ini") == 0 ||
|
||||
strcasecmp(pent->d_name, "scummvm.ini") == 0)
|
||||
if(pent->d_name[0] == '.'|| strcasecmp(pent->d_name, "scummvm.ini") == 0)
|
||||
continue;
|
||||
if(strcasestr(pent->d_name, ".ini") != NULL)
|
||||
{
|
||||
@ -205,47 +241,37 @@ bool CMenu::_Source()
|
||||
}
|
||||
closedir(pdir);
|
||||
m_plugin.EndAdd();
|
||||
|
||||
SetupInput();
|
||||
bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false);
|
||||
bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false);
|
||||
bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false);
|
||||
bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false);
|
||||
|
||||
m_showtimer = 0;
|
||||
Source_curPage = 1;
|
||||
pages = 1;
|
||||
|
||||
_showSource();
|
||||
if(!m_source.loaded())
|
||||
{
|
||||
m_btnMgr.show(m_sourceBtnHomebrew);
|
||||
m_btnMgr.show(m_sourceBtnChannel);
|
||||
m_btnMgr.show(m_sourceBtnUsb);
|
||||
m_btnMgr.show(m_sourceBtnDML);
|
||||
m_btnMgr.show(m_sourceBtnEmu);
|
||||
}
|
||||
else
|
||||
_updateSourceBtns();
|
||||
}
|
||||
|
||||
while(!m_exit)
|
||||
{
|
||||
updateSource = false;
|
||||
_mainLoopCommon();
|
||||
bool imgSelected = false;
|
||||
if(BTN_HOME_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack)) || (BTN_B_PRESSED)) //&& !WPadIR_ANY()))
|
||||
if(BTN_HOME_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack)) || (BTN_B_PRESSED))
|
||||
{
|
||||
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 == 0)
|
||||
if(selectedBtns == 1)
|
||||
{
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", sourceBtn), "cat_page", 1);
|
||||
if(m_source.getString(fmt("BUTTON_%i", sourceBtn), "source") == "plugin")
|
||||
{
|
||||
int layout = m_source.getInt(fmt("BUTTON_%i", sourceBtn), "emuflow", 0);
|
||||
if(layout > 0)
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
||||
int category = m_source.getInt(fmt("BUTTON_%i", sourceBtn), "category", 0);
|
||||
if(category > 0)
|
||||
{
|
||||
m_cat.remove("GENERAL", "selected_categories");
|
||||
m_cat.remove("GENERAL", "required_categories");
|
||||
char cCh = static_cast<char>(category + 32);
|
||||
string newSelCats(1, cCh);
|
||||
m_cat.setString("GENERAL", "selected_categories", newSelCats);
|
||||
m_clearCats = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(selectedBtns == 0)
|
||||
m_cfg.setBool(WII_DOMAIN, "source", true);
|
||||
break;
|
||||
}
|
||||
@ -253,338 +279,279 @@ bool CMenu::_Source()
|
||||
m_btnMgr.up();
|
||||
else if(BTN_DOWN_PRESSED)
|
||||
m_btnMgr.down();
|
||||
else if((BTN_LEFT_PRESSED && pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
||||
else if((BTN_LEFT_PRESSED && source_Pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
||||
{
|
||||
Source_curPage--;
|
||||
if(Source_curPage < 1)
|
||||
Source_curPage = pages;
|
||||
source_curPage--;
|
||||
if(source_curPage < 1)
|
||||
source_curPage = source_Pages;
|
||||
if(BTN_LEFT_PRESSED)
|
||||
m_btnMgr.click(m_sourceBtnPageM);
|
||||
_updateSourceBtns();
|
||||
}
|
||||
else if((BTN_RIGHT_PRESSED && pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
||||
else if((BTN_RIGHT_PRESSED && source_Pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
||||
{
|
||||
Source_curPage++;
|
||||
if(Source_curPage > pages)
|
||||
Source_curPage = 1;
|
||||
source_curPage++;
|
||||
if(source_curPage > source_Pages)
|
||||
source_curPage = 1;
|
||||
if (BTN_RIGHT_PRESSED)
|
||||
m_btnMgr.click(m_sourceBtnPageP);
|
||||
_updateSourceBtns();
|
||||
}
|
||||
else if(BTN_A_PRESSED)
|
||||
else if(BTN_A_PRESSED && !sourceIniLoaded)
|
||||
{
|
||||
// check default source buttons when no source_menu.ini
|
||||
if(m_btnMgr.selected(m_sourceBtnUsb))
|
||||
{
|
||||
m_current_view = COVERFLOW_USB;
|
||||
imgSelected = true;
|
||||
_clearSources();
|
||||
m_cfg.setBool(WII_DOMAIN, "source", true);
|
||||
exitSource = true;
|
||||
}
|
||||
if(m_btnMgr.selected(m_sourceBtnDML))
|
||||
{
|
||||
if (!m_show_dml && !m_devo_installed) _showSourceNotice();
|
||||
if(!m_show_dml && !m_devo_installed) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_DML;
|
||||
imgSelected = true;
|
||||
_clearSources();
|
||||
m_cfg.setBool(GC_DOMAIN, "source", true);
|
||||
exitSource = true;
|
||||
}
|
||||
}
|
||||
if(m_btnMgr.selected(m_sourceBtnChannel))
|
||||
{
|
||||
if (!show_channel) _showSourceNotice();
|
||||
if(!show_channel) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_CHANNEL;
|
||||
imgSelected = true;
|
||||
_clearSources();
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
exitSource = true;
|
||||
}
|
||||
}
|
||||
if(m_btnMgr.selected(m_sourceBtnHomebrew))
|
||||
{
|
||||
if (!show_homebrew || (!parental_homebrew && m_locked)) _showSourceNotice();
|
||||
if(!show_homebrew || (!parental_homebrew && m_locked)) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_HOMEBREW;
|
||||
imgSelected = true;
|
||||
_clearSources();
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
||||
exitSource = true;
|
||||
}
|
||||
}
|
||||
if(m_btnMgr.selected(m_sourceBtnEmu))
|
||||
{
|
||||
if (!show_emu) _showSourceNotice();
|
||||
if(!show_emu) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_PLUGIN;
|
||||
imgSelected = true;
|
||||
_clearSources();
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
exitSource = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((BTN_A_PRESSED || BTN_PLUS_PRESSED) && sourceIniLoaded)
|
||||
{
|
||||
// check actual source menu buttons
|
||||
u8 j = (Source_curPage - 1) * 12;
|
||||
for(int i = 0; i < 12; ++i)
|
||||
j = (source_curPage - 1) * 12;
|
||||
for(i = 0; i < 12; ++i)
|
||||
{
|
||||
if(m_btnMgr.selected(m_sourceBtnSource[i]))
|
||||
{
|
||||
string source = m_source.getString(fmt("BUTTON_%i", i + j), "source", "");
|
||||
if (source == "wii")
|
||||
if(source == "wii" && BTN_A_PRESSED)
|
||||
{
|
||||
m_current_view = COVERFLOW_USB;
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
if (source == "dml")
|
||||
{
|
||||
if (!m_show_dml && !m_devo_installed) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_DML;
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "emunand")
|
||||
{
|
||||
if (!show_channel) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_CHANNEL;
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "realnand")
|
||||
{
|
||||
if (!show_channel) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_CHANNEL;
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "homebrew")
|
||||
{
|
||||
if (!show_homebrew || (!parental_homebrew && m_locked)) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_HOMEBREW;
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "allplugins")
|
||||
{
|
||||
if (!show_emu) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_PLUGIN;
|
||||
imgSelected = true;
|
||||
|
||||
for (u8 j = 0; j < numPlugins; ++j)
|
||||
{
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "plugin")
|
||||
{
|
||||
if(!show_emu)
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_current_view = COVERFLOW_PLUGIN;
|
||||
imgSelected = true;
|
||||
magicNums.clear();
|
||||
magicNums = m_source.getStrings(fmt("BUTTON_%i", i + j), "magic", ',');
|
||||
if (magicNums.size() > 0)
|
||||
{
|
||||
for (u8 k = 0; k < numPlugins; ++k)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
_checkForSinglePlugin();
|
||||
if(enabledPluginsCount == 1)
|
||||
{
|
||||
currentPartition = m_cfg.getInt("PLUGINS/PARTITION", PluginMagicWord, 1);
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
|
||||
}
|
||||
int layout = m_source.getInt(fmt("BUTTON_%i", i + j), "emuflow", 0);
|
||||
if(layout != 0)
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(imgSelected)
|
||||
{
|
||||
back = false;
|
||||
m_cfg.setBool(WII_DOMAIN, "source", false);
|
||||
m_cfg.setBool(GC_DOMAIN, "source", false);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", false);
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", false);
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", false);
|
||||
switch(m_current_view)
|
||||
{
|
||||
case COVERFLOW_USB:
|
||||
_clearSources();
|
||||
m_cfg.setBool(WII_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
break;
|
||||
case COVERFLOW_DML:
|
||||
}
|
||||
else if(source == "wii" && BTN_PLUS_PRESSED)
|
||||
{
|
||||
updateSource = true;
|
||||
m_cfg.setBool(WII_DOMAIN, "source", !m_cfg.getBool(WII_DOMAIN, "source"));
|
||||
break;
|
||||
}
|
||||
if(source == "dml")
|
||||
{
|
||||
if(!m_show_dml && !m_devo_installed) _showSourceNotice();
|
||||
else if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(GC_DOMAIN, "source", true);
|
||||
break;
|
||||
case COVERFLOW_CHANNEL:
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
break;
|
||||
case COVERFLOW_HOMEBREW:
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
||||
break;
|
||||
default:
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED)
|
||||
{
|
||||
u8 j = (Source_curPage - 1) * 12;
|
||||
for(int i = 0; i < 12; ++i)
|
||||
{
|
||||
if(m_btnMgr.selected(m_sourceBtnSource[i]))
|
||||
{
|
||||
string source = m_source.getString(fmt("BUTTON_%i", i + j), "source", "");
|
||||
if (source == "wii")
|
||||
{
|
||||
m_cfg.setBool(WII_DOMAIN, "source", !m_cfg.getBool(WII_DOMAIN, "source", false));
|
||||
imgSelected = true;
|
||||
updateSource = true;
|
||||
m_cfg.setBool(GC_DOMAIN, "source", !m_cfg.getBool(GC_DOMAIN, "source"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (source == "dml")
|
||||
if(source == "emunand")
|
||||
{
|
||||
if (!m_show_dml && !m_devo_installed) _showSourceNotice();
|
||||
if(!show_channel) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(GC_DOMAIN, "source", !m_cfg.getBool(GC_DOMAIN, "source", false));
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "emunand")
|
||||
{
|
||||
if (!show_channel) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "source"))
|
||||
{
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "disable"))//real nand on
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
||||
else
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", false);
|
||||
}
|
||||
else
|
||||
if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateSource = true;
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", !m_cfg.getBool(CHANNEL_DOMAIN, "source"));
|
||||
}
|
||||
}
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "realnand")
|
||||
if(source == "realnand")
|
||||
{
|
||||
if (!show_channel) _showSourceNotice();
|
||||
if(!show_channel) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "source"))
|
||||
{
|
||||
if(m_cfg.getBool(CHANNEL_DOMAIN, "disable") == false)//emu nand on
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
||||
else
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", false);
|
||||
}
|
||||
else
|
||||
if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
}
|
||||
imgSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source == "homebrew")
|
||||
{
|
||||
if (!show_homebrew || (!parental_homebrew && m_locked)) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", !m_cfg.getBool(HOMEBREW_DOMAIN, "source", false));
|
||||
imgSelected = true;
|
||||
updateSource = true;
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", !m_cfg.getBool(CHANNEL_DOMAIN, "source"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(source == "homebrew")
|
||||
{
|
||||
if(!show_homebrew || (!parental_homebrew && m_locked)) _showSourceNotice();
|
||||
else if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
}
|
||||
if (source == "allplugins")
|
||||
else if(BTN_PLUS_PRESSED)
|
||||
{
|
||||
if (!show_emu) _showSourceNotice();
|
||||
else
|
||||
updateSource = true;
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", !m_cfg.getBool(HOMEBREW_DOMAIN, "source"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(source == "allplugins")
|
||||
{
|
||||
imgSelected = true;
|
||||
if(!show_emu) _showSourceNotice();
|
||||
else if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
for (j = 0; j < numPlugins; ++j)
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, 2);
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED)
|
||||
{
|
||||
updateSource = true;
|
||||
bool EnableAll = m_plugin.GetEnabledPlugins(m_cfg).size();
|
||||
for(u8 j = 0; m_plugin.PluginExist(j); j++)
|
||||
for(j = 0; m_plugin.PluginExist(j); j++)
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, EnableAll ? 2 : 1);
|
||||
if(EnableAll)
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
else
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (source == "plugin")
|
||||
{
|
||||
if(!show_emu)
|
||||
_showSourceNotice();
|
||||
if(!show_emu) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
imgSelected = true;
|
||||
// if all plugin btns off clear plugins before turning one on
|
||||
if(!m_cfg.getBool(PLUGIN_DOMAIN, "source", false))
|
||||
{
|
||||
for (u8 k = 0; k < numPlugins; ++k)
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 1);
|
||||
}
|
||||
magicNums.clear();
|
||||
magicNums = m_source.getStrings(fmt("BUTTON_%i", i + j), "magic", ',');
|
||||
if (magicNums.size() > 0)
|
||||
{
|
||||
if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
exitSource = true;
|
||||
for (k = 0; k < numPlugins; ++k)
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 1);
|
||||
for (vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
||||
{
|
||||
string magic = *itr;
|
||||
if(m_cfg.getBool("PLUGIN", magic, false))// if plugin btn on turn it off
|
||||
m_cfg.setBool("PLUGIN", magic, false);
|
||||
else // turn on plugin btn and domain just in case it's the firtst plugin on
|
||||
u32 sourceMagic = strtoul(magic.c_str(), NULL, 16);
|
||||
for (k = 0; k < numPlugins; ++k)
|
||||
{
|
||||
if (sourceMagic == m_plugin.getPluginMagic(k))
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 2);
|
||||
}
|
||||
}
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
int layout = m_source.getInt(fmt("BUTTON_%i", i + j), "emuflow", 0);
|
||||
if(layout > 0)
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
||||
int category = m_source.getInt(fmt("BUTTON_%i", i + j), "category", 0);
|
||||
if(category > 0)
|
||||
{
|
||||
m_cat.remove("GENERAL", "selected_categories");
|
||||
m_cat.remove("GENERAL", "required_categories");
|
||||
char cCh = static_cast<char>(category + 32);
|
||||
string newSelCats(1, cCh);
|
||||
m_cat.setString("GENERAL", "selected_categories", newSelCats);
|
||||
m_clearCats = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateSource = true;
|
||||
// turn off all plugins unless plugin source is already on
|
||||
if(!m_cfg.getBool(PLUGIN_DOMAIN, "source", false))
|
||||
{
|
||||
for (k = 0; k < numPlugins; ++k)
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 1);
|
||||
}
|
||||
for (vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
||||
{
|
||||
string magic = *itr;
|
||||
m_cfg.setBool("PLUGIN", magic, !m_cfg.getBool("PLUGIN", magic, false));
|
||||
if(m_cfg.getBool("PLUGIN", magic))
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
m_cfg.setBool("PLUGIN", magic, true);
|
||||
}
|
||||
}
|
||||
_checkForSinglePlugin();
|
||||
if(enabledPluginsCount == 0) // if last plugin turn domain off
|
||||
if(enabledPluginsCount == 0 && BTN_PLUS_PRESSED) // if last plugin turn domain off
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", false);
|
||||
if(enabledPluginsCount == 1)
|
||||
{
|
||||
currentPartition = m_cfg.getInt("PLUGINS/PARTITION", PluginMagicWord, 1);
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(imgSelected)
|
||||
if(exitSource)
|
||||
{
|
||||
back = false;
|
||||
noChanges = false;
|
||||
break;
|
||||
}
|
||||
if(updateSource)
|
||||
{
|
||||
noChanges = false;
|
||||
_updateSourceBtns();
|
||||
}
|
||||
if(m_showtimer > 0)
|
||||
@ -594,7 +561,16 @@ bool CMenu::_Source()
|
||||
}
|
||||
}
|
||||
_hideSource(true);
|
||||
return back;
|
||||
return noChanges;
|
||||
}
|
||||
|
||||
void CMenu::_clearSources(void)
|
||||
{
|
||||
m_cfg.setBool(WII_DOMAIN, "source", false);
|
||||
m_cfg.setBool(GC_DOMAIN, "source", false);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", false);
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", false);
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", false);
|
||||
}
|
||||
|
||||
void CMenu::_initSourceMenu()
|
||||
@ -638,8 +614,8 @@ void CMenu::_initSourceMenu()
|
||||
|
||||
m_sourceDir = m_cfg.getString("GENERAL", "dir_Source", fmt("%s/source_menu", m_dataDir.c_str()));
|
||||
|
||||
if(!m_source.loaded())
|
||||
if(!m_source.load(fmt("%s/%s", m_themeDataDir.c_str(), SOURCE_FILENAME)))
|
||||
themeName = m_cfg.getString("GENERAL", "theme", "default");
|
||||
if(!m_source.load(fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), SOURCE_FILENAME)))
|
||||
m_source.load(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME));
|
||||
|
||||
int row;
|
||||
@ -666,6 +642,7 @@ void CMenu::_initSourceMenu()
|
||||
row = i / 4;
|
||||
col = i - (row * 4);
|
||||
m_sourceBtnSource[i] = _addPicButton(fmt("SOURCE/SOURCE_BTN_%i", i), texConsoleImg, texConsoleImgs, (30 + 150 * col), (90 + 100 * row), 120, 90);
|
||||
_setHideAnim(m_sourceBtnSource[i], fmt("SOURCE/SOURCE_BTN_%i", i), 0, 0, 1.f, 1.f);
|
||||
}
|
||||
_setHideAnim(m_sourceBtnChannel, "SOURCE/CHANNEL_BTN", 0, 40, 0.f, 0.f);
|
||||
_setHideAnim(m_sourceBtnHomebrew, "SOURCE/HOMEBREW_BTN", 0, 40, 0.f, 0.f);
|
||||
@ -679,10 +656,6 @@ void CMenu::_initSourceMenu()
|
||||
_setHideAnim(m_sourceBtnPageP, "SOURCE/PAGE_PLUS", 0, 0, -1.f, 1.f);
|
||||
_setHideAnim(m_sourceBtnBack, "SOURCE/BACK_BTN", 0, 0, -2.f, 0.f);
|
||||
|
||||
for(int i = 0; i < 12; ++i)
|
||||
{
|
||||
_setHideAnim(m_sourceBtnSource[i], fmt("SOURCE/SOURCE_BTN_%i", i), 0, 0, 1.f, 1.f);
|
||||
}
|
||||
_textSource();
|
||||
_hideSource(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user