- added source menu setup via Home button while view source menu. Setup includes hide buttons, link buttons to plugins, and set roms path of plugins.

- organized main settings pg 10 thru 13 better.
This commit is contained in:
Fledge68 2020-08-24 17:58:09 -05:00
parent 493f62f295
commit e0445a0cc0
14 changed files with 648 additions and 81 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

@ -1,6 +1,6 @@
#define APP_NAME "WiiFlow WFL"
#define APP_VERSION "5.4.7"
#define APP_VERSION "5.4.7 beta 1"
#define APP_DATA_DIR "wiiflow"
#define APPS_DIR "apps/wiiflow"

View File

@ -106,7 +106,7 @@ bool CMenu::init(bool usb_mounted)
{
SoundHandle.Init();
m_gameSound.SetVoice(1);
/* Clear Playlog */
/* Clear Playlog to prevent wiiflow from being added to it */
Playlog_Delete();
/* Find the first partition with apps/wiiflow folder */
@ -1256,6 +1256,7 @@ void CMenu::_buildMenus(void)
_initExplorer();
_initBoot();
_initPathsMenu();
_initCheckboxesMenu();
_loadCFCfg();
}
@ -1964,6 +1965,7 @@ void CMenu::_updateText(void)
_textCoverBanner();
_textExplorer();
_textWad();
_textCheckboxesMenu();
}
const wstringEx CMenu::_fmt(const char *key, const wchar_t *def)
@ -2002,12 +2004,9 @@ void CMenu::_initCF(void)
if(m_sourceflow)
{
if(m_source.getBool(sfmt("button_%i", hdr->settings[0]), "hidden", false) == false)
CoverFlow.addItem(&(*hdr), 0, 0);
continue;
/*strcpy(tmp1, "source/");
wcstombs(tmp2, hdr->title, 64);
strcat(tmp1, tmp2);
id = tmp1;*/
}
else if(hdr->type == TYPE_HOMEBREW)
{

View File

@ -192,6 +192,7 @@ private:
TexData m_config4Bg;
TexData m_configAdvBg;
TexData m_configSndBg;
TexData m_config7Bg;
TexData m_cheatBg;
TexData m_downloadBg;
TexData m_gameinfoBg;
@ -330,6 +331,20 @@ private:
s16 m_configScreenBtnTVYM;
s16 m_configScreenBtnTVYP;
s16 m_configScreenLblUser[4];
s16 m_config7Lbl1;
s16 m_config7Lbl2;
s16 m_config7Lbl3;
s16 m_config7Lbl4;
s16 m_config7Btn1;
s16 m_config7Btn2;
s16 m_config7Btn3;
s16 m_config7Btn4;
s16 m_config7Lbl4Val;
s16 m_config7Btn4M;
s16 m_config7Btn4P;
s16 m_config7LblUser[4];
//Download menu
s16 m_downloadPrioVal;
enum CoverPrio
@ -950,6 +965,7 @@ private:
void _initExplorer();
void _initWad();
void _initPathsMenu();
void _initCheckboxesMenu();
//
void _textSource(void);
void _textCfgSrc(void);
@ -982,6 +998,7 @@ private:
void _textExplorer(void);
void _textWad(void);
void _textPaths(void);
void _textCheckboxesMenu(void);
//
void _hideCheatSettings(bool instant = false);
void _hideError(bool instant = false);
@ -1020,6 +1037,8 @@ private:
void _hideExplorer(bool instant = false);
void _hideWad(bool instant = false);
void _hidePaths(bool instant = false);
void _hideCheckboxesMenu(bool instant = false);
void _hideSM_Editor(bool instant = false);
//
void _showError(void);
void _showMain(void);
@ -1056,6 +1075,8 @@ private:
void _showExplorer(void);
void _showWad(void);
void _showPaths(void);
void _showCheckboxesMenu(void);
void _showSM_Editor(void);
void _showCF(bool refreshList = false);
void _refreshExplorer(s8 direction = 0);
@ -1063,7 +1084,9 @@ private:
void _updateSourceBtns(void);
void _updatePluginText(void);
void _updatePluginCheckboxes(void);
void _updateCheckboxesText(void);
void _updateCheckboxes(void);
void _updateCatCheckboxes(void);
void _getGameCategories(void);
void _setGameCategories(void);
void _setCatGenDomain(void);
@ -1119,6 +1142,8 @@ private:
void _CfgSrc();
void _CfgHB();
void _PluginSettings();
void _checkboxesMenu(u8 md);
void _SM_Editor();
void _CategorySettings(bool fromGameSet = false);
bool _Home();
bool _ExitTo();

View File

@ -57,7 +57,7 @@ void CMenu::_showCategorySettings(void)
m_btnMgr.show(m_categoryLblTitle);
m_btnMgr.show(m_categoryBtnClear);
m_btnMgr.show(m_categoryBtnBack);
_updateCheckboxes();
_updateCatCheckboxes();
}
void CMenu::_setCatGenDomain()
@ -98,7 +98,7 @@ void CMenu::_setCatGenDomain()
}
}
void CMenu::_updateCheckboxes(void)
void CMenu::_updateCatCheckboxes(void)
{
for(u8 i = 1; i < 11; ++i)
{
@ -343,7 +343,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
curPage = ((m_max_categories - 2) / 10) + 1;
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
m_btnMgr.click(m_categoryBtnPageM);
_updateCheckboxes();
_updateCatCheckboxes();
}
else if((BTN_RIGHT_PRESSED && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageP)))
{
@ -354,7 +354,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
curPage = 1;
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
m_btnMgr.click(m_categoryBtnPageP);
_updateCheckboxes();
_updateCatCheckboxes();
}
if(BTN_A_PRESSED)
{
@ -373,7 +373,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
}
if(!hiddenCat)
m_categories.at(0) = '1';
_updateCheckboxes();
_updateCatCheckboxes();
}
for(u8 i = 1; i < 11; ++i)
{

View File

@ -3,24 +3,6 @@
using namespace std;
s16 m_config7Lbl1;
s16 m_config7Lbl2;
s16 m_config7Lbl3;
s16 m_config7Lbl4;
s16 m_config7Btn1;
s16 m_config7Btn2;
s16 m_config7Btn3;
s16 m_config7Btn4;
s16 m_config7Lbl4Val;
s16 m_config7Btn4M;
s16 m_config7Btn4P;
s16 m_config7LblUser[4];
TexData m_config7Bg;
void CMenu::_hideConfig7(bool instant)
{
_hideConfigCommon(instant);
@ -118,8 +100,8 @@ void CMenu::_showConfig7(int curPage)
}
else if(curPage == 10)
{
m_btnMgr.setText(m_config7Lbl1, _t("cfg713", L"Use HQ covers"));
m_btnMgr.setText(m_config7Btn1, m_cfg.getBool("GENERAL", "cover_use_hq") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl1, _t("cfg728", L"Upsample music to 48khz"));
m_btnMgr.setText(m_config7Btn1, m_cfg.getBool("general", "resample_to_48khz", true) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl2, _t("cfg714", L"Display music title"));
m_btnMgr.setText(m_config7Btn2, m_cfg.getBool("GENERAL", "display_music_info") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl3, _t("cfg715", L"Randomize music"));
@ -131,8 +113,8 @@ void CMenu::_showConfig7(int curPage)
{
m_btnMgr.setText(m_config7Lbl1, _t("cfg717", L"Random game boot or select"));
m_btnMgr.setText(m_config7Btn1, m_cfg.getBool("GENERAL", "random_select") ? _t("select", L"Select") : _t("boot", L"Boot"));
m_btnMgr.setText(m_config7Lbl2, _t("cfg718", L"Source Menu on start"));
m_btnMgr.setText(m_config7Btn2, m_cfg.getBool("GENERAL", "source_on_start") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl2, _t("cfg725", L"Shutdown to idle standby"));
m_btnMgr.setText(m_config7Btn2, m_cfg.getBool("general", "idle_standby", false) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl3, _t("cfg720", L"Play GC banner sound"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool(GC_DOMAIN, "play_banner_sound") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl4, _t("cfg721", L"Play GC default sound"));
@ -142,12 +124,12 @@ void CMenu::_showConfig7(int curPage)
{
m_btnMgr.setText(m_config7Lbl1, _t("cfg722", L"Homebrew settings"));
m_btnMgr.setText(m_config7Btn1, _t("cfg14", L"Set"));
m_btnMgr.setText(m_config7Lbl2, _t("cfg723", L"Source menu settings"));
m_btnMgr.setText(m_config7Lbl2, _t("cfg723", L"Sourceflow settings"));
m_btnMgr.setText(m_config7Btn2, _t("cfg14", L"Set"));
m_btnMgr.setText(m_config7Lbl3, _t("cfg724", L"Lock coverflow layouts"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool("general", "cf_locked") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl4, _t("cfg725", L"Shutdown to idle standby"));
m_btnMgr.setText(m_config7Btn4, m_cfg.getBool("general", "idle_standby", false) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl3, _t("cfg718", L"Source Menu on start"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool("GENERAL", "source_on_start") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl4, _t("cfg727", L"Use Plugin Database Titles"));
m_btnMgr.setText(m_config7Btn4, m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true) ? _t("yes", L"Yes") : _t("no", L"No"));
}
else // page 13
{
@ -155,10 +137,10 @@ void CMenu::_showConfig7(int curPage)
m_btnMgr.setText(m_config7Btn1, m_cfg.getBool(WII_DOMAIN, "fix480p", false) ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_config7Lbl2, _t("cfg726", L"Covers Box Mode"));
m_btnMgr.setText(m_config7Btn2, m_cfg.getBool("general", "box_mode", false) ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_config7Lbl3, _t("cfg727", L"Use Plugin Database Titles"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl4, _t("cfg728", L"Upsample music to 48khz"));
m_btnMgr.setText(m_config7Btn4, m_cfg.getBool("general", "resample_to_48khz", true) ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl3, _t("cfg713", L"Use HQ covers"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool("GENERAL", "cover_use_hq") ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_config7Lbl4, _t("cfg724", L"Lock coverflow layouts"));
m_btnMgr.setText(m_config7Btn4, m_cfg.getBool("general", "cf_locked") ? _t("yes", L"Yes") : _t("no", L"No"));
}
}
@ -260,8 +242,12 @@ int CMenu::_config7(int curPage)
{
if(m_btnMgr.selected(m_config7Btn1))
{
m_cfg.setBool("GENERAL", "cover_use_hq", !m_cfg.getBool("GENERAL", "cover_use_hq"));
m_btnMgr.setText(m_config7Btn1, m_cfg.getBool("GENERAL", "cover_use_hq") ? _t("yes", L"Yes") : _t("no", L"No"));
bool val = !m_cfg.getBool("general", "resample_to_48khz");
m_cfg.setBool("general", "resample_to_48khz", val);
m_btnMgr.setText(m_config7Btn1, val ? _t("yes", L"Yes") : _t("no", L"No"));
MusicPlayer.SetResampleSetting(val);
MusicPlayer.Stop();
MusicPlayer.LoadCurrentFile();
}
else if(m_btnMgr.selected(m_config7Btn2))
{
@ -293,8 +279,9 @@ int CMenu::_config7(int curPage)
}
else if(m_btnMgr.selected(m_config7Btn2))
{
m_cfg.setBool("GENERAL", "source_on_start", !m_cfg.getBool("GENERAL", "source_on_start"));
m_btnMgr.setText(m_config7Btn2, m_cfg.getBool("GENERAL", "source_on_start") ? _t("yes", L"Yes") : _t("no", L"No"));
bool val = !m_cfg.getBool("general", "idle_standby");
m_cfg.setBool("general", "idle_standby", val);
m_btnMgr.setText(m_config7Btn2, val ? _t("yes", L"Yes") : _t("no", L"No"));
}
else if(m_btnMgr.selected(m_config7Btn3))
{
@ -325,15 +312,13 @@ int CMenu::_config7(int curPage)
}
else if(m_btnMgr.selected(m_config7Btn3))
{
bool val = !m_cfg.getBool("general", "cf_locked");
m_cfg.setBool("general", "cf_locked", val);
m_btnMgr.setText(m_config7Btn3, val ? _t("yes", L"Yes") : _t("no", L"No"));
CFLocked = val;
m_cfg.setBool("GENERAL", "source_on_start", !m_cfg.getBool("GENERAL", "source_on_start"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool("GENERAL", "source_on_start") ? _t("yes", L"Yes") : _t("no", L"No"));
}
else if(m_btnMgr.selected(m_config7Btn4))
{
bool val = !m_cfg.getBool("general", "idle_standby");
m_cfg.setBool("general", "idle_standby", val);
bool val = !m_cfg.getBool(PLUGIN_DOMAIN, "database_titles");
m_cfg.setBool(PLUGIN_DOMAIN, "database_titles", val);
m_btnMgr.setText(m_config7Btn4, val ? _t("yes", L"Yes") : _t("no", L"No"));
}
}
@ -345,26 +330,23 @@ int CMenu::_config7(int curPage)
m_cfg.setBool(WII_DOMAIN, "fix480p", val);
m_btnMgr.setText(m_config7Btn1, val ? _t("on", L"On") : _t("off", L"Off"));
}
if(m_btnMgr.selected(m_config7Btn2))
else if(m_btnMgr.selected(m_config7Btn2))
{
bool val = !m_cfg.getBool("general", "box_mode");
m_cfg.setBool("general", "box_mode", val);
m_btnMgr.setText(m_config7Btn2, val ? _t("on", L"On") : _t("off", L"Off"));
}
if(m_btnMgr.selected(m_config7Btn3))
else if(m_btnMgr.selected(m_config7Btn3))
{
bool val = !m_cfg.getBool(PLUGIN_DOMAIN, "database_titles");
m_cfg.setBool(PLUGIN_DOMAIN, "database_titles", val);
m_btnMgr.setText(m_config7Btn3, val ? _t("yes", L"Yes") : _t("no", L"No"));
m_cfg.setBool("GENERAL", "cover_use_hq", !m_cfg.getBool("GENERAL", "cover_use_hq"));
m_btnMgr.setText(m_config7Btn3, m_cfg.getBool("GENERAL", "cover_use_hq") ? _t("yes", L"Yes") : _t("no", L"No"));
}
if(m_btnMgr.selected(m_config7Btn4))
else if(m_btnMgr.selected(m_config7Btn4))
{
bool val = !m_cfg.getBool("general", "resample_to_48khz");
m_cfg.setBool("general", "resample_to_48khz", val);
bool val = !m_cfg.getBool("general", "cf_locked");
m_cfg.setBool("general", "cf_locked", val);
m_btnMgr.setText(m_config7Btn4, val ? _t("yes", L"Yes") : _t("no", L"No"));
MusicPlayer.SetResampleSetting(val);
MusicPlayer.Stop();
MusicPlayer.LoadCurrentFile();
CFLocked = val;
}
}
}

View File

@ -180,7 +180,7 @@ void CMenu::_initCfgSrc(void)
void CMenu::_textCfgSrc(void)
{
m_btnMgr.setText(m_cfgsrcLblTitle, _t("cfgsm1", L"Source Menu Settings"));
m_btnMgr.setText(m_cfgsrcLblTitle, _t("cfgsm1", L"Sourceflow Settings"));
m_btnMgr.setText(m_cfgsrcLblEnableSF, _t("cfgsm3", L"Enable Sourceflow"));
m_btnMgr.setText(m_cfgsrcLblSmallbox, _t("cfgsm4", L"Sourceflow Smallbox"));
m_btnMgr.setText(m_cfgsrcLblBoxMode, _t("cfghb4", L"Box Mode"));

View File

@ -462,14 +462,23 @@ int CMenu::main(void)
{
if(m_sourceflow)//back to base tier or exit sourceflow
{
if(!_srcTierBack(true))// if already on base tier exit sourceflow
/*if(!_srcTierBack(true))// if already on base tier exit sourceflow
{
_restoreSrcTiers();
m_sourceflow = false;
}
_getCustomBgTex();
_setMainBg();
_showCF(true);//refresh coverflow or sourceflow list
_showCF(true);//refresh coverflow or sourceflow list*/
_hideMain();
_SM_Editor();
if(BTN_B_HELD)
{
bheld = true;
bUsed = true;
}
_setMainBg();
_showCF(true);
}
else
{

View File

@ -0,0 +1,499 @@
#include "menu.hpp"
#include "gui/text.hpp"
#include <string.h>
#include <gccore.h>
#include <cmath>
u8 CB_curPage;
u8 CB_numPages;
u8 max_checkbox;
u8 mode;
u8 curSource;
// Checkboxes menu
TexData m_checkboxesBg;
s16 m_checkboxesLblUser[4];
s16 m_checkboxesLblPage;
s16 m_checkboxesBtnPageM;
s16 m_checkboxesBtnPageP;
s16 m_checkboxesBtnBack;
s16 m_checkboxesLblTitle;
s16 m_checkboxLblTxt[11];
s16 m_checkboxBtn[11];
s16 m_checkboxBtnOff[11];
s16 m_checkboxBtnOn[11];
void CMenu::_hideCheckboxesMenu(bool instant)
{
m_btnMgr.hide(m_checkboxesLblTitle, instant);
m_btnMgr.hide(m_checkboxesBtnBack, instant);
m_btnMgr.hide(m_checkboxesLblPage, instant);
m_btnMgr.hide(m_checkboxesBtnPageM, instant);
m_btnMgr.hide(m_checkboxesBtnPageP, instant);
for(u8 i = 0; i < ARRAY_SIZE(m_checkboxesLblUser); ++i)
if(m_checkboxesLblUser[i] != -1)
m_btnMgr.hide(m_checkboxesLblUser[i], instant);
for(u8 i = 0; i < 11; ++i)
{
m_btnMgr.hide(m_checkboxLblTxt[i]);
m_btnMgr.hide(m_checkboxBtn[i]);
}
}
void CMenu::_showCheckboxesMenu(void)
{
_setBg(m_checkboxesBg, m_checkboxesBg);
for(u8 i = 0; i < ARRAY_SIZE(m_checkboxesLblUser); ++i)
if(m_checkboxesLblUser[i] != -1)
m_btnMgr.show(m_checkboxesLblUser[i]);
if(mode == 1)
m_btnMgr.setText(m_checkboxesLblTitle, _t("smedit1", L"Hide Sources"));
else if(mode == 2)
m_btnMgr.setText(m_checkboxesLblTitle, _t("smedit2", L"Choose Source"));
else if(mode == 3)
m_btnMgr.setText(m_checkboxesLblTitle, _t("smedit3", L"Choose Plugin"));
else
m_btnMgr.setText(m_checkboxesLblTitle, _t("smedit4", L"Choose Plugins"));
m_btnMgr.show(m_checkboxesLblTitle);
m_btnMgr.show(m_checkboxesBtnBack);
_updateCheckboxes();
}
void CMenu::_updateCheckboxesText(void)
{
u32 firstCheckbox= (CB_curPage - 1) * 10;
for(u8 i = 1; i < min(firstCheckbox + 10, (u32)max_checkbox) - firstCheckbox + 1; i++)
{
if(mode == 1 || mode == 2)
{
string button = sfmt("button_%i", firstCheckbox + i - 1);
m_btnMgr.setText(m_checkboxLblTxt[i], m_source.getWString(button, "title", button));
}
else if(mode == 3 || mode == 4)
{
m_btnMgr.setText(m_checkboxLblTxt[i], m_plugin.GetPluginName(firstCheckbox + i - 1));
}
}
}
void CMenu::_updateCheckboxes(void)
{
if(max_checkbox > 10)
{
m_btnMgr.setText(m_checkboxesLblPage, wfmt(L"%i / %i", CB_curPage, CB_numPages));
m_btnMgr.show(m_checkboxesLblPage);
m_btnMgr.show(m_checkboxesBtnPageM);
m_btnMgr.show(m_checkboxesBtnPageP);
}
for(int i = 0; i < 11; ++i)
{
m_btnMgr.hide(m_checkboxBtn[i]);
m_btnMgr.hide(m_checkboxLblTxt[i]);
}
vector<string> magicNums;
if(mode == 4)
{
magicNums = m_source.getStrings(sfmt("button_%i", curSource), "magic", ',');
}
u32 firstCheckbox = (CB_curPage - 1) * 10;
for(u8 i = 1; i < min(firstCheckbox + 10, (u32)max_checkbox) - firstCheckbox + 1; ++i)
{
if(mode == 1)
{
if(m_source.getBool(sfmt("button_%i", firstCheckbox + i - 1), "hidden", false))
m_checkboxBtn[i] = m_checkboxBtnOn[i];
else
m_checkboxBtn[i] = m_checkboxBtnOff[i];
}
else if(mode == 2)
{
m_checkboxBtn[i] = m_checkboxBtnOff[i];// all sources off
}
else if(mode == 3)
{
m_checkboxBtn[i] = m_checkboxBtnOff[i];// all plugins off
}
else
{
bool found = false;
string pluginMagic = sfmt("%08x", m_plugin.GetPluginMagic(firstCheckbox + i - 1));
if(magicNums.size() > 0)
{
for(u8 j = 0; j < magicNums.size(); j++)
{
string tmp = lowerCase(magicNums[j]);
if(tmp == pluginMagic)
{
found = true;
break;
}
}
if(found)
m_checkboxBtn[i] = m_checkboxBtnOn[i];
else
m_checkboxBtn[i] = m_checkboxBtnOff[i];
}
}
m_btnMgr.show(m_checkboxBtn[i]);
m_btnMgr.show(m_checkboxLblTxt[i]);
}
}
void CMenu::_checkboxesMenu(u8 md)
{
mode = md;
if(mode == 1 || mode == 2)
max_checkbox = m_max_source_btn + 1;
else
{
max_checkbox = 0;
while(m_plugin.PluginExist(max_checkbox)) max_checkbox++;
}
CB_curPage = 1;
CB_numPages = (max_checkbox / 10) + 1;
SetupInput();
_showCheckboxesMenu();
_updateCheckboxesText();
while(!m_exit)
{
_mainLoopCommon();
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_checkboxesBtnBack)))
{
if(mode == 4)
{
m_btnMgr.setText(m_checkboxesLblTitle, _t("smedit2", L"Choose Source"));
mode = 2;
max_checkbox = m_max_source_btn;
CB_curPage = (curSource + 1) / 10 + 1;
CB_numPages = (max_checkbox / 10) + 1;
_updateCheckboxes();
_updateCheckboxesText();
}
else
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_checkboxesBtnPageM)))
{
CB_curPage--;
if(CB_curPage == 0)
CB_curPage = CB_numPages;
if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
m_btnMgr.click(m_checkboxesBtnPageM);
_updateCheckboxes();
_updateCheckboxesText();
}
else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED)) || (BTN_A_PRESSED && m_btnMgr.selected(m_checkboxesBtnPageP)))
{
CB_curPage++;
if(CB_curPage > CB_numPages)
CB_curPage = 1;
if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
m_btnMgr.click(m_checkboxesBtnPageP);
_updateCheckboxes();
_updateCheckboxesText();
}
if(BTN_A_PRESSED)
{
u32 firstCheckbox = (CB_curPage - 1) * 10;
for(u8 i = 1; i <= min(firstCheckbox + 10, (u32)max_checkbox) - firstCheckbox + 1; ++i)
{
if(m_btnMgr.selected(m_checkboxBtn[i]))
{
if(mode == 1)
{
string button = sfmt("button_%i", firstCheckbox + i - 1);
bool val = !m_source.getBool(button, "hidden", false);
m_source.setBool(button, "hidden", val);
_updateCheckboxes();
m_btnMgr.setSelected(m_checkboxBtn[i]);
break;
}
else if(mode == 2)
{
string source = m_source.getString(sfmt("button_%i", firstCheckbox + i - 1), "source", "");
if(source != "plugin")
{
_hideCheckboxesMenu();
error(_t("smediterr", L"Not allowed!"));
_showCheckboxesMenu();
}
else
{
mode = 4;
curSource = firstCheckbox + i - 1;
max_checkbox = 0;
while(m_plugin.PluginExist(max_checkbox)) max_checkbox++;
CB_curPage = 1;
CB_numPages = (max_checkbox / 10) + 1;
_updateCheckboxes();
_updateCheckboxesText();
m_btnMgr.setText(m_checkboxesLblTitle, _t("smedit4", L"Choose Plugins"));
}
}
else if(mode == 4)
{
bool found = false;
string newMagics;
string pluginMagic = sfmt("%08x", m_plugin.GetPluginMagic(firstCheckbox + i - 1));
string button = sfmt("button_%i", curSource);
vector<string> magicNums = m_source.getStrings(button, "magic", ',');
if(magicNums.size() > 0)
{
for(u8 j = 0; j < magicNums.size(); j++)
{
string tmp = lowerCase(magicNums[j]);
if(tmp == pluginMagic)
{
found = true;// and don't add it
}
else
{
if(j == 0)
newMagics = magicNums[0];
else
newMagics.append(',' + magicNums[j]);
}
}
}
if(!found)// add it if not found
{
if(newMagics.empty())
newMagics = pluginMagic;
else
newMagics.append(',' + pluginMagic);
}
if(!newMagics.empty())// to make sure at least one plugin is selected
m_source.setString(button, "magic", newMagics);
_updateCheckboxes();
}
else if(mode == 3)
{
_hideCheckboxesMenu();
u8 pos = firstCheckbox + i - 1;
bool plugin_ok = true;
strncpy(m_plugin.PluginMagicWord, fmt("%08x", m_plugin.GetPluginMagic(pos)), 8);
if(strncasecmp(m_plugin.PluginMagicWord, "484252", 6) == 0)//HBRW
plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM
plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII
plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND
plugin_ok = false;
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//ENAN
plugin_ok = false;
if(!plugin_ok)
{
error(_t("smediterr", L"Not allowed!"));
}
else
{
int romsPartition = m_plugin.GetRomPartition(pos);
if(romsPartition < 0)
romsPartition = m_cfg.getInt(PLUGIN_DOMAIN, "partition", 0);
string romsDir(fmt("%s:/%s", DeviceName[romsPartition], m_plugin.GetRomDir(pos)));
const char *path = _FolderExplorer(romsDir.c_str());
if(strlen(path) > 0)
{
Config m_plugin_cfg;
m_plugin_cfg.load(m_plugin.GetPluginPath(pos).c_str());
if(m_plugin_cfg.loaded())
{
if(strncmp(path, "sd:/", 4) == 0)
{
romsPartition = 0;
m_plugin_cfg.setInt(PLUGIN, "rompartition", 0);
m_plugin.SetRomPartition(pos, 0);
}
else
{
romsPartition = atoi(path + 3);
m_plugin_cfg.setInt(PLUGIN, "rompartition", romsPartition);
m_plugin.SetRomPartition(pos, romsPartition);
}
string rd = sfmt("%s", strchr(path, '/') + 1);
m_plugin_cfg.setString(PLUGIN, "romdir", rd);
m_plugin.SetRomDir(pos, rd);
m_plugin_cfg.save(true);
string cachedListFile(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[romsPartition], m_plugin.PluginMagicWord));
fsop_deleteFile(cachedListFile.c_str());
}
}
}
_showCheckboxesMenu();
}
}
}
}
}
m_source.save();
_hideCheckboxesMenu();
}
void CMenu::_initCheckboxesMenu()
{
_addUserLabels(m_checkboxesLblUser, ARRAY_SIZE(m_checkboxesLblUser), "CHECKBOX");
m_checkboxesBg = _texture("CHECKBOX/BG", "texture", theme.bg, false);
m_checkboxesLblTitle = _addLabel("CHECKBOX/TITLE", theme.titleFont, L"", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
m_checkboxesBtnBack = _addButton("CHECKBOX/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_checkboxesLblPage = _addLabel("CHECKBOX/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_checkboxesBtnPageM = _addPicButton("CHECKBOX/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 48, 48);
m_checkboxesBtnPageP = _addPicButton("CHECKBOX/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 172, 400, 48, 48);
_setHideAnim(m_checkboxesLblTitle, "CHECKBOX/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_checkboxesLblPage, "CHECKBOX/PAGE_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_checkboxesBtnPageM, "CHECKBOX/PAGE_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_checkboxesBtnPageP, "CHECKBOX/PAGE_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_checkboxesBtnBack, "CHECKBOX/BACK_BTN", 0, 0, 1.f, -1.f);
/* init checkboxes only here to be used in all menu's */
m_checkboxBtnOff[0] = _addPicButton("CHECKBOX/CHECKBOX_0_OFF", theme.checkboxoff, theme.checkboxoffs, 270, 394, 44, 48);
m_checkboxBtnOn[0] = _addPicButton("CHECKBOX/CHECKBOX_0_ON", theme.checkboxon, theme.checkboxons, 270, 394, 44, 48);
m_checkboxLblTxt[0] = _addLabel("CHECKBOX/CHECKBOX_0_TXT", theme.lblFont, L"", 325, 397, 100, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
for(int i = 1; i < 6; ++i)
{ // Page 1
m_checkboxBtnOff[i] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_OFF", i), theme.checkboxoff, theme.checkboxoffs, 30, (39+i*58), 44, 48);
m_checkboxBtnOn[i] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_ON", i), theme.checkboxon, theme.checkboxons, 30, (39+i*58), 44, 48);
m_checkboxLblTxt[i] = _addLabel(fmt("CHECKBOX/CHECKBOX_%i_TXT", i), theme.lblFont, L"", 85, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
// right half
m_checkboxBtnOff[i+5] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_OFF", i+5), theme.checkboxoff, theme.checkboxoffs, 325, (39+i*58), 44, 48);
m_checkboxBtnOn[i+5] = _addPicButton(fmt("CHECKBOX/CHECKBOX_%i_ON", i+5), theme.checkboxon, theme.checkboxons, 325, (39+i*58), 44, 48);
m_checkboxLblTxt[i+5] = _addLabel(fmt("CHECKBOX/CHECKBOX_%i_TXT", i+5), theme.lblFont, L"", 380, (42+i*58), 230, 48, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
}
for(u8 i = 0; i < 11; ++i)
{
_setHideAnim(m_checkboxBtnOff[i], fmt("CHECKBOX/CHECKBOX_%i_OFF", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_checkboxBtnOn[i], fmt("CHECKBOX/CHECKBOX_%i_ON", i), 0, 0, 1.f, 0.f);
_setHideAnim(m_checkboxLblTxt[i], fmt("CHECKBOX/CHECKBOX_%i_TXT", i), 0, 0, 1.f, 0.f);
m_checkboxBtn[i] = m_checkboxBtnOff[i];
}
_hideCheckboxesMenu(true);
_textCheckboxesMenu();
}
void CMenu::_textCheckboxesMenu(void)
{
m_btnMgr.setText(m_checkboxesBtnBack, _t("cd1", L"Back"));
m_btnMgr.setText(m_checkboxLblTxt[0], _t("dl25", L"All"));
}
/********************************************************************************************************************/
void CMenu::_hideSM_Editor(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
m_btnMgr.hide(m_configBtnBack, instant);
m_btnMgr.hide(m_config7Lbl1, instant);
m_btnMgr.hide(m_config7Btn1, instant);
m_btnMgr.hide(m_config7Lbl2, instant);
m_btnMgr.hide(m_config7Btn2, instant);
m_btnMgr.hide(m_config7Lbl3, instant);
m_btnMgr.hide(m_config7Btn3, instant);
//m_btnMgr.hide(m_config7Lbl4, instant);
//m_btnMgr.hide(m_config7Btn4, instant);
for(u8 i = 0; i < ARRAY_SIZE(m_config7LblUser); ++i)
if(m_config7LblUser[i] != -1)
m_btnMgr.hide(m_config7LblUser[i], instant);
}
void CMenu::_showSM_Editor()
{
m_btnMgr.hide(m_config7Lbl1, true);
m_btnMgr.hide(m_config7Btn1, true);
m_btnMgr.hide(m_config7Lbl2, true);
m_btnMgr.hide(m_config7Btn2, true);
m_btnMgr.hide(m_config7Lbl3, true);
m_btnMgr.hide(m_config7Btn3, true);
//m_btnMgr.hide(m_config7Lbl4, true);
//m_btnMgr.hide(m_config7Btn4, true);
_setBg(m_config7Bg, m_config7Bg);
for(u32 i = 0; i < ARRAY_SIZE(m_config7LblUser); ++i)
if(m_config7LblUser[i] != -1)
m_btnMgr.show(m_config7LblUser[i]);
m_btnMgr.show(m_configLblTitle);
m_btnMgr.show(m_configBtnBack);
m_btnMgr.show(m_config7Lbl1);
m_btnMgr.show(m_config7Btn1);
m_btnMgr.show(m_config7Lbl2);
m_btnMgr.show(m_config7Btn2);
m_btnMgr.show(m_config7Lbl3);
m_btnMgr.show(m_config7Btn3);
//m_btnMgr.show(m_config7Lbl4);
//m_btnMgr.show(m_config7Btn4);
m_btnMgr.setText(m_config7Lbl1, _t("smedit5", L"Hide source buttons"));
m_btnMgr.setText(m_config7Btn1, _t("cfg14", L"Set"));
m_btnMgr.setText(m_config7Lbl2, _t("smedit6", L"Link source buttons to plugins"));
m_btnMgr.setText(m_config7Btn2, _t("cfg14", L"Set"));
m_btnMgr.setText(m_config7Lbl3, _t("smedit7", L"Set plugin ROMs path"));
m_btnMgr.setText(m_config7Btn3, _t("cfg14", L"Set"));
//m_btnMgr.setText(m_config7Lbl4, _t("smedit8", L"Sourceflow settings"));
//m_btnMgr.setText(m_config7Btn4, _t("cfg14", L"Set"));
}
void CMenu::_SM_Editor()
{
m_btnMgr.setText(m_configLblTitle, _t("smedit9", L"Source Menu Setup"));// edit sources
SetupInput();
_showSM_Editor();
while(!m_exit)
{
_mainLoopCommon();
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_configBtnBack)))
{
break;
}
else if(BTN_UP_PRESSED)
m_btnMgr.up();
else if(BTN_DOWN_PRESSED)
m_btnMgr.down();
if(BTN_A_PRESSED)
{
if(m_btnMgr.selected(m_config7Btn1))
{
_hideSM_Editor();
_checkboxesMenu(1);
_showSM_Editor();
}
else if(m_btnMgr.selected(m_config7Btn2))
{
_hideSM_Editor();
_checkboxesMenu(2);
_showSM_Editor();
}
else if(m_btnMgr.selected(m_config7Btn3))
{
_hideSM_Editor();
_checkboxesMenu(3);
_showSM_Editor();
}
/*else if(m_btnMgr.selected(m_config7Btn4))
{
_hideSM_Editor();
_CfgSrc();
_showSM_Editor();
}*/
}
}
_hideSM_Editor();
m_btnMgr.setText(m_configLblTitle, _t("cfg1", L"Settings"));
}

View File

@ -17,6 +17,7 @@ bool exitSource = false;
static u8 i, j;
int curPage;
int numPages;
vector<u8> nonHiddenSources;
vector<string> magicNums;
char btn_selected[16];
@ -213,8 +214,23 @@ void CMenu::_srcTierLoad(string fn)
}
if(!m_sourceflow)
{
curPage = stoi(sm_numbers[sm_numbers.size() - 1]) / 12 + 1;
numPages = (m_max_source_btn / 12) + 1;
nonHiddenSources.clear();
for(i = 0; i <= m_max_source_btn; i++)
{
if(!m_source.getBool(sfmt("BUTTON_%i", i), "hidden", false))
nonHiddenSources.push_back(i);
}
u8 num = stoi(sm_numbers[sm_numbers.size() - 1]);
curPage = 1;
for(i = 0; i < nonHiddenSources.size(); i++)
{
if(nonHiddenSources[i] == num)
{
curPage = i / 12 + 1;
break;
}
}
numPages = (nonHiddenSources.size() / 12) + 1;
}
}
@ -257,6 +273,7 @@ void CMenu::_getSFlowBgTex(void)
}
}
// *******************************************************************************************
/* end of sourceflow stuff - start of source menu stuff */
void CMenu::_hideSource(bool instant)
{
@ -308,12 +325,12 @@ void CMenu::_updateSourceBtns(void)
j = (curPage - 1) * 12;
for(i = j; i < (j + 12); ++i)
{
if(i > m_max_source_btn)
if(i >= nonHiddenSources.size())
m_btnMgr.hide(m_sourceBtnSource[i -j]);
else
{
memset(current_btn, 0, 16);
strncpy(current_btn, fmt("BUTTON_%i", i), 15);
strncpy(current_btn, fmt("BUTTON_%i", nonHiddenSources[i]), 15);
string btnSource = m_source.getString(current_btn, "source", "");
if(btnSource == "")
continue;
@ -358,9 +375,9 @@ bool CMenu::_Source()
while(!m_exit)
{
_mainLoopCommon();
if(BTN_HOME_PRESSED || BTN_B_PRESSED)
if(BTN_B_PRESSED)
{
if(!_srcTierBack(BTN_HOME_PRESSED))
if(!_srcTierBack(false))
{
_restoreSrcTiers();
break;
@ -368,7 +385,14 @@ bool CMenu::_Source()
else
_updateSourceBtns();
}
if(BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack))
else if(BTN_HOME_PRESSED)
{
_hideSource();
_SM_Editor();
_showSource();
_updateSourceBtns();
}
else if(BTN_A_PRESSED && m_btnMgr.selected(m_sourceBtnBack))
{
_restoreSrcTiers();
break;

View File

@ -71,7 +71,7 @@ void Plugin::init(const string& m_pluginsDir)
m_plugin_cfg.load(iniFile->c_str());
if(m_plugin_cfg.loaded())
{
m_plugin.AddPlugin(m_plugin_cfg);
m_plugin.AddPlugin(m_plugin_cfg, *iniFile);
}
m_plugin_cfg.unload();
}
@ -84,9 +84,10 @@ void Plugin::Cleanup()
Plugins.clear();
}
void Plugin::AddPlugin(Config &plugin)
void Plugin::AddPlugin(Config &plugin, const string &iniPath)
{
PluginOptions NewPlugin;
NewPlugin.path = iniPath;
NewPlugin.DolName = plugin.getString(PLUGIN, "dolFile");
NewPlugin.coverFolder = plugin.getString(PLUGIN, "coverFolder");
NewPlugin.magic = strtoul(plugin.getString(PLUGIN, "magic").c_str(), NULL, 16);
@ -123,6 +124,11 @@ u8 Plugin::GetPluginPosition(u32 magic)
return 255;
}
string Plugin::GetPluginPath(u8 pos)
{
return Plugins[pos].path;
}
u32 Plugin::GetPluginMagic(u8 pos)
{
return Plugins[pos].magic;
@ -167,11 +173,21 @@ int Plugin::GetRomPartition(u8 pos)
return -1;
}
void Plugin::SetRomPartition(u8 pos, int part)
{
Plugins[pos].romPartition = part;
}
const char *Plugin::GetRomDir(u8 pos)
{
return Plugins[pos].romDir.c_str();
}
void Plugin::SetRomDir(u8 pos, const string &rd)
{
Plugins[pos].romDir = rd;
}
const string& Plugin::GetFileTypes(u8 pos)
{
return Plugins[pos].fileTypes;

View File

@ -41,6 +41,7 @@ using namespace std;
struct PluginOptions
{
string path;
u32 magic;
u32 caseColor;
int romPartition;
@ -66,17 +67,20 @@ public:
const char *GetDolName(u32 magic);
const char *GetCoverFolderName(u32 magic);
const char *GetRomDir(u8 pos);
void SetRomDir(u8 pos, const string &rd);
string GetRomName(const char *FullPath);
string GetRomId(char *romPath, u32 Magic, Config &m_crc, const char *datadir, const char *platform, const char *name);
int GetRomPartition(u8 pos);
void SetRomPartition(u8 pos, int part);
const string& GetFileTypes(u8 pos);
wstringEx GetPluginName(u8 pos);
string GetPluginPath(u8 pos);
u32 GetPluginMagic(u8 pos);
u8 GetPluginPosition(u32 magic);
s8 GetBoxMode(u8 pos);
void init(const string& m_pluginsDir);
void AddPlugin(Config &plugin);
void AddPlugin(Config &plugin, const string &iniPath);
void Cleanup();
bool GetEnabledStatus(u8 pos);
void SetEnablePlugin(u8 pos, u8 ForceMode = 0);

View File

@ -64,7 +64,7 @@ cfg719=Mount SD only
cfg720=Play GC banner sound
cfg721=Play GC default sound
cfg722=Homebrew settings
cfg723=Source menu settings
cfg723=Sourceflow settings
cfg724=Lock coverflow layouts
cfg725=Shutdown to idle standby
cfg726=Covers Box Mode
@ -231,7 +231,7 @@ cfgs1=Music volume
cfgs2=GUI sound volume
cfgs3=Coverflow sound volume
cfgs4=Game sound volume
cfgsm1=Source Menu Settings
cfgsm1=Sourceflow Settings
cfgsm3=Enable Sourceflow
cfgsm4=Sourceflow Smallbox
cfgsm5=Clear Sourceflow Cache
@ -453,6 +453,15 @@ shutdown1=Shutdown how?
shutdown2=Full Shutdown
shutdown3=Standby
Shutdown4=Cancel
smedit1=Hide Sources
smedit2=Choose Source
smedit3=Choose Plugin
smedit4=Choose Plugins
smedit5=Hide source buttons
smedit6=Link source buttons to plugins
smedit7=Set plugin ROMs path
smedit9=Source Menu Setup
smediterr=Not allowed!
snes=Super Nintendo
stup1=Select Source
translation_author=