mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
-updated source menu stuff and added a new option to enable/disable multiple source selections in the startup settings, disabled by default
-enabled b on mode selection to open up source menu by default
This commit is contained in:
parent
d31d8e3329
commit
8057a883b6
@ -125,6 +125,7 @@ CMenu::CMenu()
|
||||
m_use_wifi_gecko = false;
|
||||
init_network = false;
|
||||
m_use_source = true;
|
||||
m_multisource = false;
|
||||
m_clearCats = true;
|
||||
m_catStartPage = 1;
|
||||
m_combined_view = false;
|
||||
@ -274,6 +275,7 @@ void CMenu::init()
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_multisource = m_cfg.getBool("GENERAL", "multisource", false);
|
||||
/* DIOS_MIOS stuff */
|
||||
if(m_cfg.getBool(GC_DOMAIN, "always_show_button", false))
|
||||
{
|
||||
@ -1511,25 +1513,6 @@ void CMenu::_addUserLabels(s16 *ids, u32 start, u32 size, const char *domain)
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_checkForSinglePlugin(void)
|
||||
{
|
||||
enabledPluginPos = 0;
|
||||
enabledPluginsCount = 0;
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
if(m_cfg.getBool(PLUGIN_DOMAIN, "source", true) && EnabledPlugins.size() != 0)
|
||||
{
|
||||
for(u8 i = 0; i < EnabledPlugins.size(); i++)
|
||||
{
|
||||
if(EnabledPlugins.at(i))
|
||||
{
|
||||
enabledPluginPos = i;
|
||||
enabledPluginsCount++;
|
||||
}
|
||||
}
|
||||
snprintf(PluginMagicWord, sizeof(PluginMagicWord), "%08x", m_plugin.getPluginMagic(enabledPluginPos));
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_initCF(void)
|
||||
{
|
||||
Config dump, gameAgeList;
|
||||
@ -1556,8 +1539,7 @@ void CMenu::_initCF(void)
|
||||
gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
|
||||
}
|
||||
}
|
||||
_checkForSinglePlugin();
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
|
||||
for(vector<dir_discHdr>::iterator element = m_gameList.begin(); element != m_gameList.end(); ++element)
|
||||
{
|
||||
|
@ -51,9 +51,7 @@ public:
|
||||
u8 m_current_view;
|
||||
u8 m_last_view;
|
||||
bool m_combined_view;
|
||||
u8 enabledPluginPos;
|
||||
u8 enabledPluginsCount;
|
||||
char PluginMagicWord[9];
|
||||
u8 m_catStartPage;
|
||||
bool m_clearCats;
|
||||
private:
|
||||
@ -90,6 +88,7 @@ private:
|
||||
bool m_favorites;
|
||||
bool m_music_info;
|
||||
bool m_use_source;
|
||||
bool m_multisource;
|
||||
bool m_load_view;
|
||||
s16 m_showtimer;
|
||||
string m_curLanguage;
|
||||
@ -966,7 +965,6 @@ private:
|
||||
void _updatePluginText(void);
|
||||
void _updatePluginCheckboxes(void);
|
||||
void _updateCheckboxes(void);
|
||||
void _checkForSinglePlugin(void);
|
||||
void _getIDCats(void);
|
||||
void _setIDCats(void);
|
||||
void _setBg(const TexData &tex, const TexData &lqTex);
|
||||
|
@ -45,6 +45,9 @@ s16 m_bootBtnCategoryOnBoot;
|
||||
s16 m_bootLblSourceOnBoot;
|
||||
s16 m_bootBtnSourceOnBoot;
|
||||
|
||||
s16 m_bootLblMultisource;
|
||||
s16 m_bootBtnMultisource;
|
||||
|
||||
u8 set_port = 0;
|
||||
u8 boot_curPage = 1;
|
||||
u8 boot_Pages = 2;
|
||||
@ -93,6 +96,9 @@ static void hideBoot(bool instant, bool common)
|
||||
|
||||
m_btnMgr.hide(m_bootLblSourceOnBoot, instant);
|
||||
m_btnMgr.hide(m_bootBtnSourceOnBoot, instant);
|
||||
|
||||
m_btnMgr.hide(m_bootLblMultisource, instant);
|
||||
m_btnMgr.hide(m_bootBtnMultisource, instant);
|
||||
}
|
||||
|
||||
bool CMenu::_Boot(void)
|
||||
@ -181,6 +187,12 @@ bool CMenu::_Boot(void)
|
||||
m_cfg.setBool("GENERAL", "source_on_start", !m_cfg.getBool("GENERAL", "source_on_start", false));
|
||||
m_btnMgr.setText(m_bootBtnSourceOnBoot, m_cfg.getBool("GENERAL", "source_on_start") ? _t("on", L"On") : _t("off", L"Off"));
|
||||
}
|
||||
else if (m_btnMgr.selected(m_bootBtnMultisource))
|
||||
{
|
||||
m_cfg.setBool("GENERAL", "multisource", !m_cfg.getBool("GENERAL", "multisource", false));
|
||||
m_btnMgr.setText(m_bootBtnMultisource, m_cfg.getBool("GENERAL", "multisource") ? _t("on", L"On") : _t("off", L"Off"));
|
||||
m_multisource = m_cfg.getBool("GENERAL", "multisource", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(prev_load != cur_load || prev_ios != cur_ios)
|
||||
@ -230,12 +242,16 @@ void CMenu::_refreshBoot()
|
||||
{
|
||||
m_btnMgr.setText(m_bootBtnCategoryOnBoot, m_cfg.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off"));
|
||||
m_btnMgr.setText(m_bootBtnSourceOnBoot, m_cfg.getBool("GENERAL", "source_on_start") ? _t("on", L"On") : _t("off", L"Off"));
|
||||
m_btnMgr.setText(m_bootBtnMultisource, m_cfg.getBool("GENERAL", "multisource") ? _t("on", L"On") : _t("off", L"Off"));
|
||||
|
||||
m_btnMgr.show(m_bootLblCategoryOnBoot);
|
||||
m_btnMgr.show(m_bootBtnCategoryOnBoot);
|
||||
|
||||
m_btnMgr.show(m_bootLblSourceOnBoot);
|
||||
m_btnMgr.show(m_bootBtnSourceOnBoot);
|
||||
|
||||
m_btnMgr.show(m_bootLblMultisource);
|
||||
m_btnMgr.show(m_bootBtnMultisource);
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,6 +264,7 @@ void CMenu::_textBoot(void)
|
||||
m_btnMgr.setText(m_bootLblAsyncNet, _t("cfgp3", L"Init network on boot"));
|
||||
m_btnMgr.setText(m_bootLblCategoryOnBoot, _t("cfgd7", L"Show categories on boot"));
|
||||
m_btnMgr.setText(m_bootLblSourceOnBoot, _t("cfgbt5", L"Show source menu on boot"));
|
||||
m_btnMgr.setText(m_bootLblMultisource, _t("cfgbt6", L"Enable Multisource Features"));
|
||||
m_btnMgr.setText(m_bootBtnBack, _t("cfg10", L"Back"));
|
||||
}
|
||||
|
||||
@ -281,6 +298,9 @@ void CMenu::_initBoot(void)
|
||||
m_bootLblSourceOnBoot = _addLabel("BOOT/SOURCE_ON_START", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_bootBtnSourceOnBoot = _addButton("BOOT/SOURCE_ON_START_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
|
||||
|
||||
m_bootLblMultisource = _addLabel("BOOT/MULTISOURCE", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_bootBtnMultisource = _addButton("BOOT/MULTISOURCE_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
|
||||
|
||||
_setHideAnim(m_bootLblTitle, "BOOT/TITLE", 0, -200, 0.f, 1.f);
|
||||
_setHideAnim(m_bootBtnBack, "BOOT/BACK_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_bootLblPage, "BOOT/PAGE_BTN", 0, 0, 1.f, -1.f);
|
||||
@ -306,6 +326,9 @@ void CMenu::_initBoot(void)
|
||||
_setHideAnim(m_bootLblSourceOnBoot, "BOOT/SOURCE_ON_START", -200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_bootBtnSourceOnBoot, "BOOT/SOURCE_ON_START_BTN", 200, 0, 1.f, 0.f);
|
||||
|
||||
_setHideAnim(m_bootLblMultisource, "BOOT/MULTISOURCE", -200, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_bootBtnMultisource, "BOOT/MULTISOURCE_BTN", 200, 0, 1.f, 0.f);
|
||||
|
||||
hideBoot(true, true);
|
||||
_textBoot();
|
||||
}
|
||||
|
@ -563,13 +563,17 @@ void CMenu::_game(bool launch)
|
||||
currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", 1);
|
||||
break;
|
||||
default:
|
||||
_checkForSinglePlugin();
|
||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
if(enabledPluginsCount == 1)
|
||||
{
|
||||
char PluginMagicWord[9];
|
||||
memset(PluginMagicWord, 0, sizeof(PluginMagicWord));
|
||||
strncpy(PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
|
||||
currentPartition = m_cfg.getInt("PLUGINS/PARTITION", PluginMagicWord, 1);
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition);
|
||||
}
|
||||
currentPartition = m_cfg.getInt(PLUGIN_DOMAIN, "partition", 1);
|
||||
break;
|
||||
}
|
||||
/* Get Banner Title for Playlog */
|
||||
CurrentBanner.ClearBanner();
|
||||
|
@ -509,7 +509,7 @@ int CMenu::main(void)
|
||||
//Events to Switch off/on nand emu
|
||||
else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnUsb) || m_btnMgr.selected(m_mainBtnDML)|| m_btnMgr.selected(m_mainBtnEmu) || m_btnMgr.selected(m_mainBtnHomebrew))
|
||||
{
|
||||
if(m_cfg.getBool("GENERAL", "b_on_mode_to_source", false))
|
||||
if(m_cfg.getBool("GENERAL", "b_on_mode_to_source", true))
|
||||
{
|
||||
_hideMain();
|
||||
if(!_Source()) //Different source selected
|
||||
@ -1148,8 +1148,19 @@ void CMenu::_setPartition(s8 direction)
|
||||
else
|
||||
{
|
||||
m_cfg.setInt(_domainFromView(), "partition", currentPartition);
|
||||
_checkForSinglePlugin();
|
||||
vector<bool> plugin_list = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
if(enabledPluginsCount == 1)
|
||||
{
|
||||
u8 i = 0;
|
||||
for(i = 0; i < enabledPluginsCount; ++i)
|
||||
{
|
||||
if(plugin_list[i] == true)
|
||||
break;
|
||||
}
|
||||
char PluginMagicWord[9];
|
||||
memset(PluginMagicWord, 0, sizeof(PluginMagicWord));
|
||||
strncpy(PluginMagicWord, fmt("%08x", m_plugin.getPluginMagic(i)), 8);
|
||||
m_cfg.setInt("PLUGINS/PARTITION", PluginMagicWord, currentPartition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void CMenu::_updatePluginCheckboxes(void)
|
||||
m_btnMgr.hide(m_pluginBtn[i]);
|
||||
m_btnMgr.hide(m_pluginLblCat[i]);
|
||||
}
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
/* ALL Button */
|
||||
if(EnabledPlugins.size() == 0)
|
||||
m_pluginBtn[0] = m_pluginBtnCats[0];
|
||||
@ -153,9 +153,9 @@ void CMenu::_PluginSettings()
|
||||
{
|
||||
if(i == 0)
|
||||
{
|
||||
bool EnableAll = m_plugin.GetEnabledPlugins(m_cfg).size();
|
||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
for(u8 j = 0; m_plugin.PluginExist(j); j++)
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, EnableAll ? 2 : 1);
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, (enabledPluginsCount == 0) ? 2 : 1);
|
||||
}
|
||||
else
|
||||
m_plugin.SetEnablePlugin(m_cfg, i+IteratorHelp-1);
|
||||
|
@ -107,9 +107,11 @@ void CMenu::_updateSourceBtns(void)
|
||||
|
||||
if(btnSource == "")
|
||||
continue;
|
||||
else if(m_multisource == false)
|
||||
ImgName = m_source.getString(fmt("BUTTON_%i", i),"image", "").c_str();
|
||||
else if(btnSource == "allplugins")
|
||||
{
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
if(EnabledPlugins.size() == 0)
|
||||
{
|
||||
sourceBtn = i;
|
||||
@ -282,7 +284,7 @@ bool CMenu::_Source()
|
||||
}
|
||||
if(selectedBtns == 0)
|
||||
m_cfg.setBool(WII_DOMAIN, "source", true);
|
||||
|
||||
|
||||
u8 sourceCount = 0;
|
||||
if(m_cfg.getBool(WII_DOMAIN, "source", false))
|
||||
sourceCount++;
|
||||
@ -302,7 +304,8 @@ bool CMenu::_Source()
|
||||
m_btnMgr.up();
|
||||
else if(BTN_DOWN_PRESSED)
|
||||
m_btnMgr.down();
|
||||
else if((BTN_LEFT_PRESSED && source_Pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
||||
else if(((m_multisource?BTN_LEFT_PRESSED:BTN_MINUS_PRESSED) && source_Pages > 1)
|
||||
|| (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageM)))
|
||||
{
|
||||
source_curPage--;
|
||||
if(source_curPage < 1)
|
||||
@ -311,7 +314,8 @@ bool CMenu::_Source()
|
||||
m_btnMgr.click(m_sourceBtnPageM);
|
||||
_updateSourceBtns();
|
||||
}
|
||||
else if((BTN_RIGHT_PRESSED && source_Pages > 1) || (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
||||
else if(((m_multisource?BTN_RIGHT_PRESSED:BTN_PLUS_PRESSED) && source_Pages > 1)
|
||||
|| (BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnPageP)))
|
||||
{
|
||||
source_curPage++;
|
||||
if(source_curPage > source_Pages)
|
||||
@ -370,7 +374,7 @@ bool CMenu::_Source()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((BTN_A_PRESSED || BTN_PLUS_PRESSED) && sourceIniLoaded)
|
||||
else if((BTN_A_PRESSED || (BTN_PLUS_PRESSED && m_multisource)) && sourceIniLoaded)
|
||||
{
|
||||
// check actual source menu buttons
|
||||
j = (source_curPage - 1) * 12;
|
||||
@ -378,188 +382,177 @@ bool CMenu::_Source()
|
||||
{
|
||||
if(m_btnMgr.selected(m_sourceBtnSource[i]))
|
||||
{
|
||||
string source = m_source.getString(fmt("BUTTON_%i", i + j), "source", "");
|
||||
if(source == "wii" && BTN_A_PRESSED)
|
||||
const char *btn_selected = fmt("BUTTON_%i", i + j);
|
||||
gprintf("%s\n", btn_selected);
|
||||
string source = m_source.getString(btn_selected, "source", "");
|
||||
gprintf("%s\n", source.c_str());
|
||||
if(BTN_A_PRESSED)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(WII_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
m_catStartPage = 1;
|
||||
if(source == "wii")
|
||||
{
|
||||
m_cfg.setBool(WII_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
}
|
||||
else if(source == "dml")
|
||||
{
|
||||
if(!m_show_dml && !m_devo_installed)
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(GC_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
}
|
||||
}
|
||||
else if(source == "emunand")
|
||||
{
|
||||
if(!show_channel)
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
}
|
||||
}
|
||||
else if(source == "realnand")
|
||||
{
|
||||
if(!show_channel)
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
}
|
||||
}
|
||||
else if(source == "homebrew")
|
||||
{
|
||||
if(!show_homebrew || (!parental_homebrew && m_locked))
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
}
|
||||
}
|
||||
else if(source == "allplugins")
|
||||
{
|
||||
if(!show_emu)
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
for(k = 0; k < numPlugins; ++k)
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 2); /* force enable */
|
||||
}
|
||||
}
|
||||
else if(source == "plugin")
|
||||
{
|
||||
if(!show_emu)
|
||||
_showSourceNotice();
|
||||
else
|
||||
{
|
||||
magicNums.clear();
|
||||
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
||||
if(!magicNums.empty())
|
||||
{
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", true);
|
||||
for(k = 0; k < numPlugins; ++k)
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 1); /* force disable */
|
||||
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
||||
{
|
||||
s8 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16));
|
||||
if(exist >= 0)
|
||||
m_plugin.SetEnablePlugin(m_cfg, exist, 2);
|
||||
}
|
||||
}
|
||||
m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1);
|
||||
int layout = m_source.getInt(btn_selected, "emuflow", 0);
|
||||
if(layout > 0)
|
||||
m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout);
|
||||
int category = m_source.getInt(btn_selected, "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;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if(source == "wii" && BTN_PLUS_PRESSED)
|
||||
else
|
||||
{
|
||||
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)
|
||||
if(source == "wii")
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(GC_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
m_cfg.setBool(WII_DOMAIN, "source", !m_cfg.getBool(WII_DOMAIN, "source"));
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED)
|
||||
else if(source == "dml")
|
||||
{
|
||||
updateSource = true;
|
||||
m_cfg.setBool(GC_DOMAIN, "source", !m_cfg.getBool(GC_DOMAIN, "source"));
|
||||
if(m_show_dml || m_devo_installed)
|
||||
m_cfg.setBool(GC_DOMAIN, "source", !m_cfg.getBool(GC_DOMAIN, "source"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(source == "emunand")
|
||||
{
|
||||
if(!show_channel) _showSourceNotice();
|
||||
else
|
||||
else if(source == "emunand")
|
||||
{
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
||||
if(BTN_A_PRESSED)
|
||||
if(show_channel)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateSource = true;
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", false);
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", !m_cfg.getBool(CHANNEL_DOMAIN, "source"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(source == "realnand")
|
||||
{
|
||||
if(!show_channel) _showSourceNotice();
|
||||
else
|
||||
else if(source == "realnand")
|
||||
{
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", true);
|
||||
if(BTN_A_PRESSED)
|
||||
if(show_channel)
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateSource = true;
|
||||
m_cfg.setBool(CHANNEL_DOMAIN, "disable", 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)
|
||||
else if(source == "homebrew")
|
||||
{
|
||||
_clearSources();
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", true);
|
||||
m_catStartPage = m_source.getInt(fmt("BUTTON_%i", i + j), "cat_page", 1);
|
||||
exitSource = true;
|
||||
if(show_homebrew && (parental_homebrew || !m_locked))
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", !m_cfg.getBool(HOMEBREW_DOMAIN, "source"));
|
||||
}
|
||||
else if(BTN_PLUS_PRESSED)
|
||||
else if(source == "allplugins")
|
||||
{
|
||||
updateSource = true;
|
||||
m_cfg.setBool(HOMEBREW_DOMAIN, "source", !m_cfg.getBool(HOMEBREW_DOMAIN, "source"));
|
||||
if(show_emu)
|
||||
{
|
||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
for(j = 0; m_plugin.PluginExist(j); ++j) /* opposite */
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, (enabledPluginsCount == 0) ? 2 : 1);
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", (enabledPluginsCount == 0) ? true : false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(source == "allplugins")
|
||||
{
|
||||
if(!show_emu) _showSourceNotice();
|
||||
else if(BTN_A_PRESSED)
|
||||
else if(source == "plugin")
|
||||
{
|
||||
_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(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;
|
||||
}
|
||||
if (source == "plugin")
|
||||
{
|
||||
if(!show_emu) _showSourceNotice();
|
||||
else
|
||||
{
|
||||
magicNums.clear();
|
||||
magicNums = m_source.getStrings(fmt("BUTTON_%i", i + j), "magic", ',');
|
||||
if (magicNums.size() > 0)
|
||||
{
|
||||
if(BTN_A_PRESSED)
|
||||
if(show_emu)
|
||||
{
|
||||
magicNums.clear();
|
||||
magicNums = m_source.getStrings(btn_selected, "magic", ',');
|
||||
if(!magicNums.empty())
|
||||
{
|
||||
_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++)
|
||||
for(vector<string>::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++)
|
||||
{
|
||||
string magic = *itr;
|
||||
u32 sourceMagic = strtoul(magic.c_str(), NULL, 16);
|
||||
for (k = 0; k < numPlugins; ++k)
|
||||
u32 cur_magic = strtoul(itr->c_str(), NULL, 16);
|
||||
s8 exist = m_plugin.GetPluginPosition(cur_magic);
|
||||
if(exist >= 0)
|
||||
{
|
||||
if (sourceMagic == m_plugin.getPluginMagic(k))
|
||||
m_plugin.SetEnablePlugin(m_cfg, k, 2);
|
||||
bool enabled = m_plugin.GetEnableStatus(m_cfg, cur_magic);
|
||||
m_plugin.SetEnablePlugin(m_cfg, exist, enabled ? 1 : 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
_checkForSinglePlugin();
|
||||
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);
|
||||
}
|
||||
m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
|
||||
m_cfg.setBool(PLUGIN_DOMAIN, "source", enabledPluginsCount > 0 ? true : false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -153,7 +153,17 @@ void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
|
||||
}
|
||||
}
|
||||
|
||||
const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg)
|
||||
bool Plugin::GetEnableStatus(Config &cfg, u32 magic)
|
||||
{
|
||||
if((Plugin_Pos = GetPluginPosition(magic)) >= 0)
|
||||
{
|
||||
strncpy(PluginMagicWord, fmt("%08x", magic), 8);
|
||||
return cfg.getBool(PLUGIN_INI_DEF, PluginMagicWord, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg, u8 *num)
|
||||
{
|
||||
enabledPlugins.clear();
|
||||
u8 enabledPluginsNumber = 0;
|
||||
@ -170,6 +180,8 @@ const vector<bool> &Plugin::GetEnabledPlugins(Config &cfg)
|
||||
}
|
||||
if(enabledPluginsNumber == Plugins.size())
|
||||
enabledPlugins.clear();
|
||||
if(num != NULL)
|
||||
*num = enabledPluginsNumber;
|
||||
return enabledPlugins;
|
||||
}
|
||||
|
||||
|
@ -59,12 +59,13 @@ public:
|
||||
u32 GetBannerSoundSize();
|
||||
const char *GetDolName(u32 magic);
|
||||
const char *GetCoverFolderName(u32 magic);
|
||||
bool GetEnableStatus(Config &cfg, u32 magic);
|
||||
string GenerateCoverLink(dir_discHdr gameHeader, const string& constURL, Config &Checksums);
|
||||
wstringEx GetPluginName(u8 pos);
|
||||
u32 getPluginMagic(u8 pos);
|
||||
bool PluginExist(u8 pos);
|
||||
void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0);
|
||||
const vector<bool> &GetEnabledPlugins(Config &cfg);
|
||||
const vector<bool> &GetEnabledPlugins(Config &cfg, u8 *num);
|
||||
vector<string> CreateArgs(const char *device, const char *path,
|
||||
const char *title, const char *loader, u32 title_len_no_ext, u32 magic);
|
||||
void init(const string& m_pluginsDir);
|
||||
|
Loading…
Reference in New Issue
Block a user