mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-28 12:51:52 +01:00
-added plugin selection menu in global settings, if in
plugin coverflow it will replace the nand emu button, in this memu you can select which plugin should be displayed, it will work no matter which sort is set, you can select more than one emulator at the time of course KNOWN ISSUE: -background music is missing
This commit is contained in:
parent
60e103b1bf
commit
88c4eed3c3
@ -434,6 +434,8 @@ void CMenu::init(void)
|
||||
m_favorites = m_cfg.getBool(domain, "favorites", false);
|
||||
m_max_categories = m_cat.getInt("GENERAL", "numcategories", 21);
|
||||
|
||||
m_plugins = 0;
|
||||
|
||||
m_cfg.setString("GAMERCARD", "gamercards", "wiinnertag|dutag");
|
||||
m_cfg.getString("GAMERCARD", "wiinnertag_url", WIINNERTAG_URL);
|
||||
m_cfg.getString("GAMERCARD", "wiinnertag_key", "");
|
||||
@ -1025,11 +1027,12 @@ void CMenu::_buildMenus(void)
|
||||
_initCFThemeMenu(theme);
|
||||
_initGameSettingsMenu(theme);
|
||||
_initCheatSettingsMenu(theme);
|
||||
_initPluginSettingsMenu(theme);
|
||||
_initCategorySettingsMenu(theme);
|
||||
_initSystemMenu(theme);
|
||||
_initGameInfoMenu(theme);
|
||||
_initNandEmuMenu(theme);
|
||||
|
||||
|
||||
_loadCFCfg(theme);
|
||||
}
|
||||
|
||||
@ -1454,6 +1457,9 @@ void CMenu::_initCF(void)
|
||||
|
||||
m_cf.clear();
|
||||
m_cf.reserve(m_gameList.size());
|
||||
safe_vector<bool> EnabledPlugins;
|
||||
if(m_current_view == COVERFLOW_EMU)
|
||||
EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
|
||||
m_gamelistdump = m_cfg.getBool(domain, "dump_list", true);
|
||||
if(m_gamelistdump) m_dump.load(fmt("%s/titlesdump.ini", m_settingsDir.c_str()));
|
||||
@ -1463,31 +1469,33 @@ void CMenu::_initCF(void)
|
||||
for (u32 i = 0; i < m_gameList.size(); ++i)
|
||||
{
|
||||
u64 chantitle = m_gameList[i].hdr.chantitle;
|
||||
if (m_current_view == COVERFLOW_CHANNEL && chantitle == HBC_108) strncpy((char *) m_gameList[i].hdr.id, "JODI", 6);
|
||||
|
||||
if (m_current_view == COVERFLOW_CHANNEL && chantitle == HBC_108)
|
||||
strncpy((char *) m_gameList[i].hdr.id, "JODI", 6);
|
||||
if (m_current_view == COVERFLOW_EMU)
|
||||
{
|
||||
string tempname(m_gameList[i].path);
|
||||
tempname.erase(0, tempname.find_first_of('/')+1);
|
||||
string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
|
||||
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||
if(tempname.find_last_of('.') != string::npos)
|
||||
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
|
||||
id = dirName+tempname;
|
||||
}
|
||||
else id = string((const char *)m_gameList[i].hdr.id, m_current_view == COVERFLOW_CHANNEL ? 4 : 6);
|
||||
string idcats = m_cat.getString("CATEGORIES", id, "").c_str();
|
||||
if (idcats.length() < 21 && idcats.length() > 0)
|
||||
{
|
||||
idcats.append((21-idcats.length()), '0');
|
||||
m_cat.setString("CATEGORIES", id, idcats);
|
||||
}
|
||||
{
|
||||
string tempname(m_gameList[i].path);
|
||||
tempname.erase(0, tempname.find_first_of('/')+1);
|
||||
string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
|
||||
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||
if(tempname.find_last_of('.') != string::npos)
|
||||
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
|
||||
id = dirName+tempname;
|
||||
}
|
||||
else
|
||||
id = string((const char *)m_gameList[i].hdr.id, m_current_view == COVERFLOW_CHANNEL ? 4 : 6);
|
||||
string idcats = m_cat.getString("CATEGORIES", id, "").c_str();
|
||||
if (idcats.length() < 21 && idcats.length() > 0)
|
||||
{
|
||||
idcats.append((21-idcats.length()), '0');
|
||||
m_cat.setString("CATEGORIES", id, idcats);
|
||||
}
|
||||
if ((!m_favorites || m_gcfg1.getBool("FAVORITES", id, false)) && (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false)))
|
||||
{
|
||||
if (catviews[0] == '0')
|
||||
{
|
||||
const char *idcats = m_cat.getString("CATEGORIES", id, "").c_str();
|
||||
if (strlen(idcats) == 0) continue;
|
||||
if (strlen(idcats) == 0)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
bool idinacat=0;
|
||||
@ -1508,7 +1516,19 @@ void CMenu::_initCF(void)
|
||||
string coverFolder(m_plugin.GetCoverFolderName(m_gameList[i].hdr.magic));
|
||||
//if(tempname.find_last_of('.') != string::npos)
|
||||
// tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
if(EnabledPlugins.size() == 0) //all plugins
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
else
|
||||
{
|
||||
for(u8 j = 0; j < EnabledPlugins.size(); j++)
|
||||
{
|
||||
if(EnabledPlugins[j] == true && m_gameList[i].hdr.magic == m_plugin.getPluginMagic(j))
|
||||
{
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s/%s.png", m_picDir.c_str(), coverFolder.c_str(), tempname.c_str()), fmt("%s/%s/%s.png", m_boxPicDir.c_str(), coverFolder.c_str(), tempname.c_str()), playcount, lastPlayed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_current_view != COVERFLOW_HOMEBREW)
|
||||
m_cf.addItem(&m_gameList[i], fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), playcount, lastPlayed);
|
||||
|
@ -141,6 +141,7 @@ private:
|
||||
STexture m_gameSettingsBg;
|
||||
STexture m_gameBgLQ;
|
||||
STexture m_mainBgLQ;
|
||||
STexture m_pluginBg;
|
||||
STexture m_categoryBg;
|
||||
//
|
||||
u32 m_errorLblMessage;
|
||||
@ -193,8 +194,8 @@ private:
|
||||
u32 m_configLblPartition;
|
||||
u32 m_configBtnPartitionP;
|
||||
u32 m_configBtnPartitionM;
|
||||
u32 m_configLblNandEmu;
|
||||
u32 m_configBtnNandEmu;
|
||||
u32 m_configLblCfg4;
|
||||
u32 m_configBtnCfg4;
|
||||
u32 m_configLblUser[4];
|
||||
u32 m_configAdvLblTheme;
|
||||
u32 m_configAdvLblCurTheme;
|
||||
@ -553,14 +554,26 @@ private:
|
||||
u32 m_categoryBtnCats[21];
|
||||
u32 m_categoryLblUser[4];
|
||||
u8 m_max_categories;
|
||||
// NandEmulation menu
|
||||
// Plugin menu
|
||||
u32 m_pluginLblPage;
|
||||
u32 m_pluginBtnPageM;
|
||||
u32 m_pluginBtnPageP;
|
||||
u32 m_pluginBtnBack;
|
||||
u32 m_pluginLblTitle;
|
||||
u32 m_pluginLblCat[21];
|
||||
u32 m_pluginBtn[21];
|
||||
u32 m_pluginBtnCat[21];
|
||||
u32 m_pluginBtnCats[21];
|
||||
u32 m_pluginLblUser[4];
|
||||
u8 m_plugins;
|
||||
// NandEmulation menu
|
||||
std::string m_saveExtGameId;
|
||||
bool m_nandext;
|
||||
bool m_fulldump;
|
||||
bool m_sgdump;
|
||||
bool m_saveall;
|
||||
bool m_forceext;
|
||||
//int m_saveExtMode;
|
||||
//int m_saveExtMode;
|
||||
u32 m_nandemuLblTitle;
|
||||
u32 m_nandemuBtnBack;
|
||||
u32 m_nandemuLblEmulationVal;
|
||||
@ -832,11 +845,13 @@ private:
|
||||
void _initGameSettingsMenu(SThemeData &theme);
|
||||
void _initCheatSettingsMenu(SThemeData &theme);
|
||||
void _initCheatButtons();
|
||||
void _initPluginSettingsMenu(SThemeData &theme);
|
||||
void _initCategorySettingsMenu(SThemeData &theme);
|
||||
void _initSystemMenu(SThemeData &theme);
|
||||
void _initGameInfoMenu(SThemeData &theme);
|
||||
void _initNandEmuMenu(CMenu::SThemeData &theme);
|
||||
//
|
||||
void _textPluginSettings(void);
|
||||
void _textCategorySettings(void);
|
||||
void _textCheatSettings(void);
|
||||
void _textSystem(void);
|
||||
@ -876,6 +891,7 @@ private:
|
||||
void _hideWBFS(bool instant = false);
|
||||
void _hideCFTheme(bool instant = false);
|
||||
void _hideGameSettings(bool instant = false);
|
||||
void _hidePluginSettings(bool instant = false);
|
||||
void _hideCategorySettings(bool instant = false);
|
||||
void _hideSystem(bool instant = false);
|
||||
void _hideGameInfo(bool instant = false);
|
||||
@ -897,6 +913,7 @@ private:
|
||||
void _showSettings();
|
||||
void _showCode(void);
|
||||
void _showAbout(void);
|
||||
void _showPluginSettings(void);
|
||||
void _showCategorySettings(void);
|
||||
void _showCheatSettings(void);
|
||||
void _showSystem(void);
|
||||
@ -905,6 +922,7 @@ private:
|
||||
void _showCFTheme(u32 curParam, int version, bool wide);
|
||||
void _showGameSettings(void);
|
||||
void _showCheatDownload(void);
|
||||
void _updatePluginCheckboxes(void);
|
||||
void _updateCheckboxes(void);
|
||||
void _setBg(const STexture &tex, const STexture &lqTex);
|
||||
void _updateBg(void);
|
||||
@ -941,6 +959,7 @@ private:
|
||||
void _gameinfo(void);
|
||||
void _gameSettings(void);
|
||||
void _CheatSettings();
|
||||
void _PluginSettings();
|
||||
void _CategorySettings(bool fromGameSet=false);
|
||||
//
|
||||
void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false);
|
||||
|
@ -33,8 +33,8 @@ void CMenu::_hideConfig(bool instant)
|
||||
m_btnMgr.hide(m_configLblParental, instant);
|
||||
m_btnMgr.hide(m_configBtnUnlock, instant);
|
||||
m_btnMgr.hide(m_configBtnSetCode, instant);
|
||||
m_btnMgr.hide(m_configLblNandEmu, instant);
|
||||
m_btnMgr.hide(m_configBtnNandEmu, instant);
|
||||
m_btnMgr.hide(m_configLblCfg4, instant);
|
||||
m_btnMgr.hide(m_configBtnCfg4, instant);
|
||||
for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
|
||||
if (m_configLblUser[i] != -1u)
|
||||
m_btnMgr.hide(m_configLblUser[i], instant);
|
||||
@ -79,8 +79,8 @@ void CMenu::_showConfig(void)
|
||||
|
||||
m_btnMgr.setText(m_configLblPartition, (string)partitionname);
|
||||
|
||||
m_btnMgr.show(m_configLblNandEmu);
|
||||
m_btnMgr.show(m_configBtnNandEmu);
|
||||
m_btnMgr.show(m_configLblCfg4);
|
||||
m_btnMgr.show(m_configBtnCfg4);
|
||||
}
|
||||
m_btnMgr.show(m_configLblParental);
|
||||
m_btnMgr.show(m_locked ? m_configBtnUnlock : m_configBtnSetCode);
|
||||
@ -172,6 +172,8 @@ int CMenu::_config1(void)
|
||||
gprintf("Current Partition: %d\n", currentPartition);
|
||||
|
||||
_showConfig();
|
||||
_textConfig();
|
||||
|
||||
while (true)
|
||||
{
|
||||
change = _configCommon();
|
||||
@ -224,12 +226,15 @@ int CMenu::_config1(void)
|
||||
_enableNandEmu(true);
|
||||
_showConfig();
|
||||
}
|
||||
else if (m_btnMgr.selected(m_configBtnNandEmu))
|
||||
else if (m_btnMgr.selected(m_configBtnCfg4))
|
||||
{
|
||||
_cfNeedsUpdate();
|
||||
m_cf.stopCoverLoader(true);
|
||||
_hideConfig();
|
||||
_NandEmuCfg();
|
||||
if(m_current_view != COVERFLOW_EMU)
|
||||
_NandEmuCfg();
|
||||
else
|
||||
_PluginSettings();
|
||||
_showConfig();
|
||||
m_cf.startCoverLoader();
|
||||
}
|
||||
@ -274,8 +279,9 @@ void CMenu::_initConfigMenu(CMenu::SThemeData &theme)
|
||||
m_configLblPartition = _addLabel(theme, "CONFIG/PARTITION_BTN", theme.btnFont, L"", 456, 250, 88, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_configBtnPartitionM = _addPicButton(theme, "CONFIG/PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 400, 250, 56, 56);
|
||||
m_configBtnPartitionP = _addPicButton(theme, "CONFIG/PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
|
||||
m_configLblNandEmu = _addLabel(theme, "CONFIG/NANDEMU", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_configBtnNandEmu = _addButton(theme, "CONFIG/NANDEMU_BTN", theme.btnFont, L"", 400, 310, 200, 56, theme.btnFontColor);m_configLblPage = _addLabel(theme, "CONFIG/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_configLblCfg4 = _addLabel(theme, "CONFIG/CFG4", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_configBtnCfg4 = _addButton(theme, "CONFIG/CFG4_BTN", theme.btnFont, L"", 400, 310, 200, 56, theme.btnFontColor);
|
||||
m_configLblPage = _addLabel(theme, "CONFIG/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_configBtnPageM = _addPicButton(theme, "CONFIG/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56);
|
||||
m_configBtnPageP = _addPicButton(theme, "CONFIG/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56);
|
||||
m_configBtnBack = _addButton(theme, "CONFIG/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
|
||||
@ -291,8 +297,8 @@ void CMenu::_initConfigMenu(CMenu::SThemeData &theme)
|
||||
_setHideAnim(m_configLblPartition, "CONFIG/PARTITION_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_configBtnPartitionM, "CONFIG/PARTITION_MINUS", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_configBtnPartitionP, "CONFIG/PARTITION_PLUS", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_configLblNandEmu, "CONFIG/NANDEMU", 100, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_configBtnNandEmu, "CONFIG/NANDEMU_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_configLblCfg4, "CONFIG/CFG4", 100, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_configBtnCfg4, "CONFIG/CFG4_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_configBtnBack, "CONFIG/BACK_BTN", 0, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_configLblPage, "CONFIG/PAGE_BTN", 0, 0, 1.f, -1.f);
|
||||
_setHideAnim(m_configBtnPageM, "CONFIG/PAGE_MINUS", 0, 0, 1.f, -1.f);
|
||||
@ -311,6 +317,14 @@ void CMenu::_textConfig(void)
|
||||
m_btnMgr.setText(m_configBtnSetCode, _t("cfg7", L"Set code"));
|
||||
m_btnMgr.setText(m_configLblPartitionName, _t("cfgp1", L"Game Partition"));
|
||||
m_btnMgr.setText(m_configBtnBack, _t("cfg10", L"Back"));
|
||||
m_btnMgr.setText(m_configLblNandEmu, _t("cfg13", L"Nand emulation settings"));
|
||||
m_btnMgr.setText(m_configBtnNandEmu, _t("cfg14", L"Set"));
|
||||
if(m_current_view != COVERFLOW_EMU)
|
||||
{
|
||||
m_btnMgr.setText(m_configLblCfg4, _t("cfg13", L"Nand emulation settings"));
|
||||
m_btnMgr.setText(m_configBtnCfg4, _t("cfg14", L"Set"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_btnMgr.setText(m_configLblCfg4, _t("cfg15", L"Plugins"));
|
||||
m_btnMgr.setText(m_configBtnCfg4, _t("cfg16", L"Select"));
|
||||
}
|
||||
}
|
||||
|
227
source/menu/menu_plugin.cpp
Normal file
227
source/menu/menu_plugin.cpp
Normal file
@ -0,0 +1,227 @@
|
||||
#include "menu.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include <gccore.h>
|
||||
|
||||
u8 m_Plugins[21];
|
||||
u32 Plugin_curPage;
|
||||
u8 Plugin_lastBtn;
|
||||
|
||||
void CMenu::_hidePluginSettings(bool instant)
|
||||
{
|
||||
m_btnMgr.hide(m_pluginLblTitle, instant);
|
||||
m_btnMgr.hide(m_pluginBtnBack, instant);
|
||||
m_btnMgr.hide(m_pluginLblPage, instant);
|
||||
m_btnMgr.hide(m_pluginBtnPageM, instant);
|
||||
m_btnMgr.hide(m_pluginBtnPageP, instant);
|
||||
for(u32 i = 0; i < ARRAY_SIZE(m_pluginLblUser); ++i)
|
||||
{
|
||||
if(m_pluginLblUser[i] != -1u)
|
||||
m_btnMgr.hide(m_pluginLblUser[i], instant);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 21; ++i)
|
||||
{
|
||||
m_btnMgr.hide(m_pluginLblCat[i]);
|
||||
m_btnMgr.hide(m_pluginBtn[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_showPluginSettings(void)
|
||||
{
|
||||
_setBg(m_pluginBg, m_pluginBg);
|
||||
for(u32 i = 0; i < ARRAY_SIZE(m_pluginLblUser); ++i)
|
||||
{
|
||||
if(m_pluginLblUser[i] != -1u)
|
||||
m_btnMgr.show(m_pluginLblUser[i]);
|
||||
}
|
||||
m_btnMgr.show(m_pluginLblTitle);
|
||||
m_btnMgr.show(m_pluginBtnBack);
|
||||
_updatePluginCheckboxes();
|
||||
}
|
||||
|
||||
void CMenu::_updatePluginCheckboxes(void)
|
||||
{
|
||||
if(m_plugins > 10)
|
||||
{
|
||||
m_btnMgr.setText(m_pluginLblPage, wfmt(L"%i / 2", Plugin_curPage));
|
||||
m_btnMgr.show(m_pluginLblPage);
|
||||
m_btnMgr.show(m_pluginBtnPageM);
|
||||
m_btnMgr.show(m_pluginBtnPageP);
|
||||
}
|
||||
for(int i = 0; i < 21; ++i)
|
||||
{
|
||||
m_btnMgr.hide(m_pluginBtn[i]);
|
||||
m_btnMgr.hide(m_pluginLblCat[i]);
|
||||
}
|
||||
|
||||
safe_vector<bool> EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
if(Plugin_curPage == 1)
|
||||
{
|
||||
int j = 11;
|
||||
if(m_plugins < 11)
|
||||
j = m_plugins;
|
||||
for(u8 i = 0; i < j; ++i)
|
||||
{
|
||||
m_btnMgr.show(m_pluginLblCat[i]);
|
||||
if((EnabledPlugins.size() == 0) || (i != 0 && EnabledPlugins.size() >= i && EnabledPlugins[i - 1] == true))
|
||||
m_pluginBtn[i] = m_pluginBtnCats[i];
|
||||
else
|
||||
m_pluginBtn[i] = m_pluginBtnCat[i];
|
||||
m_btnMgr.show(m_pluginBtn[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 11; i < m_plugins; ++i)
|
||||
{
|
||||
m_btnMgr.show(m_pluginLblCat[i]);
|
||||
m_pluginBtn[i] = m_pluginBtnCat[i];
|
||||
m_btnMgr.show(m_pluginBtn[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMenu::_PluginSettings()
|
||||
{
|
||||
SetupInput();
|
||||
Plugin_curPage = 1;
|
||||
_textPluginSettings();
|
||||
_showPluginSettings();
|
||||
while(true)
|
||||
{
|
||||
_mainLoopCommon();
|
||||
if(!m_btnMgr.selected(Plugin_lastBtn))
|
||||
m_btnMgr.noHover(false);
|
||||
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
|
||||
{
|
||||
m_cfg.save();
|
||||
break;
|
||||
}
|
||||
else if(BTN_UP_PRESSED)
|
||||
m_btnMgr.up();
|
||||
else if(BTN_DOWN_PRESSED)
|
||||
m_btnMgr.down();
|
||||
if((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED) || (BTN_A_PRESSED && m_btnMgr.selected(m_pluginBtnPageM)))
|
||||
{
|
||||
Plugin_lastBtn = m_pluginBtnPageM;
|
||||
m_btnMgr.noHover(true);
|
||||
Plugin_curPage = Plugin_curPage == 1 ? 2 : 1;
|
||||
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
|
||||
m_btnMgr.click(m_pluginBtnPageM);
|
||||
_updatePluginCheckboxes();
|
||||
}
|
||||
else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED)) || (BTN_A_PRESSED && m_btnMgr.selected(m_pluginBtnPageP)))
|
||||
{
|
||||
Plugin_lastBtn = m_pluginBtnPageP;
|
||||
m_btnMgr.noHover(true);
|
||||
Plugin_curPage = Plugin_curPage == 1 ? 2 : 1;
|
||||
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
|
||||
m_btnMgr.click(m_pluginBtnPageP);
|
||||
_updatePluginCheckboxes();
|
||||
}
|
||||
if(BTN_A_PRESSED)
|
||||
{
|
||||
if(m_btnMgr.selected(m_pluginBtnBack))
|
||||
{
|
||||
m_cfg.save();
|
||||
break;
|
||||
}
|
||||
for(int i = 0; i < 21; ++i)
|
||||
{
|
||||
if(m_btnMgr.selected(m_pluginBtn[i]))
|
||||
{
|
||||
Plugin_lastBtn = m_pluginBtn[i];
|
||||
m_btnMgr.noHover(true);
|
||||
if(i == 0)
|
||||
{
|
||||
int j = 0;
|
||||
bool EnableAll = (m_plugin.GetEnabledPlugins(m_cfg).size());
|
||||
while(true)
|
||||
{
|
||||
if(m_plugin.PluginExist(j))
|
||||
m_plugin.SetEnablePlugin(m_cfg, j, EnableAll ? 2 : 1);
|
||||
else
|
||||
break;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_plugin.SetEnablePlugin(m_cfg, i - 1);
|
||||
_updatePluginCheckboxes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_hidePluginSettings();
|
||||
}
|
||||
|
||||
void CMenu::_initPluginSettingsMenu(CMenu::SThemeData &theme)
|
||||
{
|
||||
_addUserLabels(theme, m_pluginLblUser, ARRAY_SIZE(m_pluginLblUser), "PLUGIN");
|
||||
m_pluginBg = _texture(theme.texSet, "PLUGIN/BG", "texture", theme.bg);
|
||||
m_pluginLblTitle = _addTitle(theme, "PLUGIN/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
||||
m_pluginBtnBack = _addButton(theme, "PLUGIN/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
|
||||
m_pluginLblPage = _addLabel(theme, "PLUGIN/PAGE_BTN", theme.btnFont, L"", 256, 400, 100, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_pluginBtnPageM = _addPicButton(theme, "PLUGIN/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 200, 400, 56, 56);
|
||||
m_pluginBtnPageP = _addPicButton(theme, "PLUGIN/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 356, 400, 56, 56);
|
||||
m_pluginLblCat[0] = _addLabel(theme, "PLUGIN/PLUGIN_0", theme.lblFont, L"", 85, 390, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_pluginBtnCat[0] = _addPicButton(theme, "PLUGIN/PLUGIN_0_BTN", theme.checkboxoff, theme.checkboxoffs, 30, 390, 44, 48);
|
||||
m_pluginBtnCats[0] = _addPicButton(theme, "PLUGIN/PLUGIN_0_BTNS", theme.checkboxon, theme.checkboxons, 30, 390, 44, 48);
|
||||
for(int i = 1; i < 6; ++i)
|
||||
{ // Page 1
|
||||
m_pluginLblCat[i] = _addLabel(theme, fmt("PLUGIN/PLUGIN_%i", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_pluginBtnCat[i] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTN", i), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
|
||||
m_pluginBtnCats[i] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTNS", i), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
|
||||
// right half
|
||||
m_pluginLblCat[i+5] = _addLabel(theme, fmt("PLUGIN/PLUGIN_%i", i+5), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_pluginBtnCat[i+5] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTN", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
|
||||
m_pluginBtnCats[i+5] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTNS", i+5), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
|
||||
// Page 2
|
||||
m_pluginLblCat[i+10] = _addLabel(theme, fmt("PLUGIN/PLUGIN_%i", i+10), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_pluginBtnCat[i+10] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTN", i+10), theme.checkboxoff, theme.checkboxoffs, 30, (42+i*58), 44, 48);
|
||||
m_pluginBtnCats[i+10] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTNS", i+10), theme.checkboxon, theme.checkboxons, 30, (42+i*58), 44, 48);
|
||||
// right half
|
||||
m_pluginLblCat[i+15] = _addLabel(theme, fmt("PLUGIN/PLUGIN_%i", i+15), theme.txtFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_pluginBtnCat[i+15] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTN", i+15), theme.checkboxoff, theme.checkboxoffs, 325, (42+i*58), 44, 48);
|
||||
m_pluginBtnCats[i+15] = _addPicButton(theme, fmt("PLUGIN/PLUGIN_%i_BTNS", i+15), theme.checkboxon, theme.checkboxons, 325, (42+i*58), 44, 48);
|
||||
}
|
||||
_setHideAnim(m_pluginLblTitle, "PLUGIN/TITLE", 0, -200, 0.f, 1.f);
|
||||
_setHideAnim(m_pluginLblPage, "PLUGIN/PAGE_BTN", 0, 200, 1.f, 0.f);
|
||||
_setHideAnim(m_pluginBtnPageM, "PLUGIN/PAGE_MINUS", 0, 200, 1.f, 0.f);
|
||||
_setHideAnim(m_pluginBtnPageP, "PLUGIN/PAGE_PLUS", 0, 200, 1.f, 0.f);
|
||||
_setHideAnim(m_pluginBtnBack, "PLUGIN/BACK_BTN", 0, 200, 1.f, 0.f);
|
||||
for(int i = 0; i < 21; ++i)
|
||||
{
|
||||
_setHideAnim(m_pluginBtnCat[i], fmt("PLUGIN/PLUGIN_%i_BTN", i), 0, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_pluginBtnCats[i], fmt("PLUGIN/PLUGIN_%i_BTNS", i), 0, 0, 1.f, 0.f);
|
||||
_setHideAnim(m_pluginLblCat[i], fmt("PLUGIN/PLUGIN_%i", i), 0, 0, 1.f, 0.f);
|
||||
m_pluginBtn[i] = m_pluginBtnCat[i];
|
||||
}
|
||||
_hidePluginSettings(true);
|
||||
_textPluginSettings();
|
||||
}
|
||||
|
||||
void CMenu::_textPluginSettings(void)
|
||||
{
|
||||
m_btnMgr.setText(m_pluginLblTitle, _t("", L"Select Plugins"));
|
||||
m_btnMgr.setText(m_pluginBtnBack, _t("plugin_cd1", L"Back"));
|
||||
u8 i = 0;
|
||||
while(true)
|
||||
{
|
||||
if(i == 0)
|
||||
m_btnMgr.setText(m_pluginLblCat[i], _t("plugin_dl3", L"All"));
|
||||
else
|
||||
{
|
||||
if(m_plugin.PluginExist(i - 1))
|
||||
m_btnMgr.setText(m_pluginLblCat[i], m_plugin.GetPluginName(i - 1));
|
||||
else
|
||||
{
|
||||
m_plugins = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
@ -121,6 +121,63 @@ char* Plugin::GetCoverFolderName(u32 magic)
|
||||
return emptyChar;
|
||||
}
|
||||
|
||||
bool Plugin::PluginExist(u8 pos)
|
||||
{
|
||||
if(pos < Plugins.size())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
wstringEx Plugin::GetPluginName(u8 pos)
|
||||
{
|
||||
wstringEx tmpString;
|
||||
string PluginName(Plugins[pos].DolName);
|
||||
PluginName.erase(PluginName.end() - 4, PluginName.end());
|
||||
tmpString.fromUTF8(PluginName.c_str());
|
||||
return tmpString;
|
||||
}
|
||||
|
||||
void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
|
||||
{
|
||||
if(pos < Plugins.size())
|
||||
{
|
||||
char PluginMagicWord[8];
|
||||
snprintf(PluginMagicWord, sizeof(PluginMagicWord), "%08x", Plugins[pos].magicWord);
|
||||
if(ForceMode == 1)
|
||||
cfg.setBool("PLUGIN", PluginMagicWord, false);
|
||||
else if(ForceMode == 2)
|
||||
cfg.setBool("PLUGIN", PluginMagicWord, true);
|
||||
else
|
||||
cfg.setBool("PLUGIN", PluginMagicWord, cfg.getBool("PLUGIN", PluginMagicWord) ? false : true);
|
||||
}
|
||||
}
|
||||
|
||||
safe_vector<bool> Plugin::GetEnabledPlugins(Config &cfg)
|
||||
{
|
||||
safe_vector<bool> enabledPlugins;
|
||||
char PluginMagicWord[8];
|
||||
u8 enabledPluginsNumber = 0;
|
||||
for(u8 i = 0; i < Plugins.size(); i++)
|
||||
{
|
||||
snprintf(PluginMagicWord, sizeof(PluginMagicWord), "%08x", Plugins[i].magicWord);
|
||||
if(cfg.getBool("PLUGIN", PluginMagicWord, true))
|
||||
{
|
||||
enabledPluginsNumber++;
|
||||
enabledPlugins.push_back(true);
|
||||
}
|
||||
else
|
||||
enabledPlugins.push_back(false);
|
||||
}
|
||||
if(enabledPluginsNumber == Plugins.size())
|
||||
enabledPlugins.clear();
|
||||
return enabledPlugins;
|
||||
}
|
||||
|
||||
u32 Plugin::getPluginMagic(u8 pos)
|
||||
{
|
||||
return Plugins[pos].magicWord;
|
||||
}
|
||||
|
||||
safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
|
||||
{
|
||||
gprintf("Parsing scummvm.ini\n");
|
||||
|
@ -36,6 +36,11 @@ public:
|
||||
u32 GetBannerSoundSize();
|
||||
char* GetDolName(u32 magic);
|
||||
char* GetCoverFolderName(u32 magic);
|
||||
wstringEx GetPluginName(u8 pos);
|
||||
u32 getPluginMagic(u8 pos);
|
||||
bool PluginExist(u8 pos);
|
||||
void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0);
|
||||
safe_vector<bool> GetEnabledPlugins(Config &cfg);
|
||||
bool UseReturnLoader(u32 magic);
|
||||
void init(string);
|
||||
void Cleanup();
|
||||
|
Loading…
Reference in New Issue
Block a user