- added option to have separate plugin categories and normal (Wii) categories in categories_lite ini. Normal categories go under [GENERAL] and plugin categories go under [PLUGINS]. Plugin categories will show when viewing plugin games and normal categories will show when not viewing plugin games. The only problem is when you combine normal games with plugin games ... the categories menu will show plugin categories only. I haven't got a solution to that issue yet. If you have your plugin games currently working with the normal categories then don't worry they will still work. you don't have to copy the [GENERAL] section and rename it to [PLUGINS].

This commit is contained in:
Fledge68 2019-12-18 09:39:27 -06:00
parent 33859d443b
commit 27cbbbf8c0
5 changed files with 77 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 MiB

After

Width:  |  Height:  |  Size: 3.6 MiB

View File

@ -1993,18 +1993,18 @@ void CMenu::_initCF(void)
CoverFlow.clear();
CoverFlow.reserve(m_gameList.size());
string requiredCats = m_cat.getString("GENERAL", "required_categories", "");
string selectedCats = m_cat.getString("GENERAL", "selected_categories", "");
string hiddenCats = m_cat.getString("GENERAL", "hidden_categories", "");
u8 numReqCats = requiredCats.length();
u8 numSelCats = selectedCats.length();
u8 numHidCats = hiddenCats.length();
string requiredCats;
string selectedCats;
string hiddenCats;
char id[74];
char catID[64];
for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr)
{
requiredCats = m_cat.getString("GENERAL", "required_categories", "");
selectedCats = m_cat.getString("GENERAL", "selected_categories", "");
hiddenCats = m_cat.getString("GENERAL", "hidden_categories", "");
const char *favDomain = "FAVORITES";
const char *adultDomain = "ADULTONLY";
@ -2027,6 +2027,13 @@ void CMenu::_initCF(void)
}
else if(hdr->type == TYPE_PLUGIN)
{
if(m_cat.hasDomain("PLUGINS"))// if using new style categories_lite.ini
{
requiredCats = m_cat.getString("PLUGINS", "required_categories", "");
selectedCats = m_cat.getString("PLUGINS", "selected_categories", "");
hiddenCats = m_cat.getString("PLUGINS", "hidden_categories", "");
}
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
if(strrchr(hdr->path, '/') != NULL)
wcstombs(catID, hdr->title, 63);
@ -2043,6 +2050,10 @@ void CMenu::_initCF(void)
strcpy(catID, id);
}
u8 numReqCats = requiredCats.length();
u8 numSelCats = selectedCats.length();
u8 numHidCats = hiddenCats.length();
if((!m_favorites || m_gcfg1.getBool(favDomain, id, false))
&& (!m_locked || !m_gcfg1.getBool(adultDomain, id, false)))
{
@ -2289,7 +2300,7 @@ void CMenu::_initCF(void)
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND
ID = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
else
filename = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");
filename = m_cfg.getString("plugin_item", m_plugin.PluginMagicWord, "");// homebrew and plugins
}
else if(m_sourceflow && sm_numbers.size() > 0)
sourceNumber = stoi(sm_numbers[sm_numbers.size() - 1]);

View File

@ -1065,6 +1065,7 @@ private:
void _updateCheckboxes(void);
void _getGameCategories(void);
void _setGameCategories(void);
void _setCatGenDomain(void);
void _getCustomBgTex(void);
void _setMainBg(void);
void _setBg(const TexData &bgTex, const TexData &bglqTex);

View File

@ -22,6 +22,7 @@ u8 lastBtn;
char id[64];
const char *catDomain = NULL;
bool gameSet;
string genDomain;
void CMenu::_hideCategorySettings(bool instant)
{
@ -59,6 +60,40 @@ void CMenu::_showCategorySettings(void)
_updateCheckboxes();
}
void CMenu::_setCatGenDomain()
{
genDomain = "GENERAL";
if(!m_cat.hasDomain("PLUGINS"))// if still using old style categories_lite.ini set as "GENERAL" and return
return;
if(gameSet)
{
const dir_discHdr *hdr = CoverFlow.getHdr();
if(hdr->type == TYPE_PLUGIN)
genDomain = "PLUGINS";
}
else if(m_current_view & COVERFLOW_PLUGIN)
{
for(u8 i = 0; m_plugin.PluginExist(i); ++i)// only set "PLUGINS" for real plugins
{
if(m_plugin.GetEnableStatus(m_cfg, m_plugin.getPluginMagic(i)))
{
if(strncasecmp(m_plugin.PluginMagicWord, "4E47434D", 8) == 0)//NGCM
continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E574949", 8) == 0)//NWII
continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "4E414E44", 8) == 0)//NAND
continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "454E414E", 8) == 0)//EMUNAND
continue;
else if(strncasecmp(m_plugin.PluginMagicWord, "48425257", 8) == 0)//HBRW
continue;
else
genDomain = "PLUGINS";
}
}
}
}
void CMenu::_updateCheckboxes(void)
{
for(u8 i = 1; i < 11; ++i)
@ -77,6 +112,7 @@ void CMenu::_updateCheckboxes(void)
m_btnMgr.show(m_categoryBtnPageM);
m_btnMgr.show(m_categoryBtnPageP);
}
for(u8 i = 1; i < 11; ++i)
{
int j = i + ((curPage - 1) * 10);
@ -96,7 +132,7 @@ void CMenu::_updateCheckboxes(void)
default:
m_btnMgr.show(m_categoryBtnCatReq[i]);
}
m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString("GENERAL", fmt("cat%d",j), wfmt(L"Category %i",j).c_str()));
m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString(genDomain, fmt("cat%d",j), wfmt(L"Category %i",j).c_str()));
m_btnMgr.show(m_categoryLblCat[i]);
}
@ -174,8 +210,10 @@ void CMenu::_CategorySettings(bool fromGameSet)
if(m_source.loaded() && m_catStartPage > 0)
curPage = m_catStartPage;
_setCatGenDomain();
m_max_categories = m_cat.getInt("GENERAL", "numcategories", 6);
m_max_categories = m_cat.getInt(genDomain, "numcategories", 6);
if(curPage < 1 || curPage > (((m_max_categories - 2)/ 10) + 1))
curPage = 1;
m_categories.resize(m_max_categories, '0');
@ -187,9 +225,9 @@ void CMenu::_CategorySettings(bool fromGameSet)
}
else
{
string requiredCats = m_cat.getString("GENERAL", "required_categories", "");
string selectedCats = m_cat.getString("GENERAL", "selected_categories", "");
string hiddenCats = m_cat.getString("GENERAL", "hidden_categories", "");
string requiredCats = m_cat.getString(genDomain, "required_categories", "");
string selectedCats = m_cat.getString(genDomain, "selected_categories", "");
string hiddenCats = m_cat.getString(genDomain, "hidden_categories", "");
u8 numReqCats = requiredCats.length();
u8 numSelCats = selectedCats.length();
u8 numHidCats = hiddenCats.length();
@ -254,9 +292,9 @@ void CMenu::_CategorySettings(bool fromGameSet)
newReqCats = newReqCats + cCh;
}
}
m_cat.setString("GENERAL", "selected_categories", newSelCats);
m_cat.setString("GENERAL", "hidden_categories", newHidCats);
m_cat.setString("GENERAL", "required_categories", newReqCats);
m_cat.setString(genDomain, "selected_categories", newSelCats);
m_cat.setString(genDomain, "hidden_categories", newHidCats);
m_cat.setString(genDomain, "required_categories", newReqCats);
}
else
{

View File

@ -254,9 +254,17 @@ void CMenu::_showCF(bool refreshList)
/* setup categories and favorites for filtering the game list below */
if(m_clearCats)// false on boot up and if a source menu button selects a category
{
// do not clear hidden categories to keep games hidden
m_cat.remove("GENERAL", "selected_categories");
m_cat.remove("GENERAL", "required_categories");
if(m_autoboot_hdr.type == TYPE_PLUGIN && m_cat.hasDomain("PLUGINS"))
{
m_cat.remove("PLUGINS", "selected_categories");
m_cat.remove("PLUGINS", "required_categories");
}
else
{
// do not clear hidden categories to keep games hidden
m_cat.remove("GENERAL", "selected_categories");
m_cat.remove("GENERAL", "required_categories");
}
}
m_clearCats = true;// set to true for next source