mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-28 12:51:52 +01:00
-changed categories_v4.ini one last time. Sorry but this should speed up wiiflow when you use categories and I've already created a dol here - http://www.mediafire.com/download.php?om9to9n77h2stmfto use to convert old cat 4 ini to new cat 4 ini format.
- replacing strings of 0's and 1's with ASCII characters 33 on up. So if you have a game in category 1 and you have 20 categories, instead of 110000000000000000000 all you will see is ! (ASCII character 33) which is way shorter and will take wiiflow much less time to read. Also if a game isn't in any category there will be nothing after the = . - also added categories for individual plugins. Wiiflow checks to see if only one plugin is selected and if so then uses the categories for that one plugin. So for example you can have categories for your movies when you only use the mplayerce plugin.
This commit is contained in:
parent
46b386112e
commit
8301e6dfd2
@ -1542,17 +1542,23 @@ void CMenu::_initCF(void)
|
||||
}
|
||||
}
|
||||
|
||||
m_max_categories = m_cat.getInt(fmt("%s/GENERAL", domain), "numcategories", 6);
|
||||
string catDef = "1";
|
||||
catDef.append(m_max_categories - 1, '0');
|
||||
string catSettings = m_cat.getString(fmt("%s/GENERAL", domain), "categories", catDef).c_str();
|
||||
if (catSettings.length() < m_max_categories)
|
||||
// check for single plugin selected
|
||||
u8 pos = 0;
|
||||
u8 enabledPluginsCount = 0;
|
||||
if(m_current_view == COVERFLOW_EMU && EnabledPlugins.size() != 0)
|
||||
{
|
||||
char PluginMagicWord[9];
|
||||
for(u8 i = 0; i < EnabledPlugins.size(); i++)
|
||||
{
|
||||
catSettings.append((m_max_categories - catSettings.length()), '0');
|
||||
m_cat.setString(fmt("%s/GENERAL", domain), "categories", catSettings);
|
||||
snprintf(PluginMagicWord, sizeof(PluginMagicWord), "%08x", m_plugin.getPluginMagic(i));
|
||||
if(m_cfg.getBool("PLUGIN", PluginMagicWord, true))
|
||||
{
|
||||
pos = i;
|
||||
enabledPluginsCount++;
|
||||
}
|
||||
}
|
||||
const char *categories = m_cat.getString(fmt("%s/GENERAL", domain), "categories").c_str();
|
||||
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < m_gameList.size(); ++i)
|
||||
{
|
||||
string id;
|
||||
@ -1600,7 +1606,7 @@ void CMenu::_initCF(void)
|
||||
{
|
||||
int ageRated = min(max(gameAgeList.getInt(domain, id), 0), 19);
|
||||
|
||||
if(ageRated == 0 && (m_current_view == COVERFLOW_USB || m_current_view == COVERFLOW_CHANNEL))
|
||||
if(ageRated == 0 && (m_gameList[i].type == TYPE_WII_GAME || m_gameList[i].type == TYPE_CHANNEL))
|
||||
{
|
||||
GameXMLInfo gameinfo;
|
||||
if(gametdb.IsLoaded() && gametdb.GetGameXMLInfo(id.c_str(), &gameinfo))
|
||||
@ -1672,54 +1678,99 @@ void CMenu::_initCF(void)
|
||||
&& (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false))
|
||||
&& !ageLocked)
|
||||
{
|
||||
string idcats = m_cat.getString(domain, id, catDef).c_str();
|
||||
if (idcats.length() < m_max_categories)
|
||||
string catDomain;
|
||||
switch(m_gameList[i].type)
|
||||
{
|
||||
idcats.append((m_max_categories - idcats.length()), '0');
|
||||
m_cat.setString(domain, id, idcats);
|
||||
case TYPE_CHANNEL:
|
||||
catDomain = "NAND";
|
||||
break;
|
||||
case TYPE_HOMEBREW:
|
||||
catDomain = "HOMEBREW";
|
||||
break;
|
||||
case TYPE_GC_GAME:
|
||||
catDomain = "DML";
|
||||
break;
|
||||
case TYPE_PLUGIN:
|
||||
catDomain = "EMULATOR";
|
||||
break;
|
||||
default:
|
||||
catDomain = "GAMES";
|
||||
}
|
||||
if(categories[0] == '0')// if '1' skip checking cats and show all games
|
||||
if(enabledPluginsCount == 1)
|
||||
{
|
||||
const char *idCats = m_cat.getString(domain, id).c_str();
|
||||
catDomain = (m_plugin.GetPluginName(pos)).toUTF8();
|
||||
if(m_gameList[i].settings[0] != m_plugin.getPluginMagic(pos))
|
||||
continue;
|
||||
}
|
||||
const char *requiredCats = m_cat.getString(fmt("%s/GENERAL", catDomain.c_str()), "required_categories").c_str();
|
||||
const char *selectedCats = m_cat.getString(fmt("%s/GENERAL", catDomain.c_str()), "selected_categories").c_str();
|
||||
const char *hiddenCats = m_cat.getString(fmt("%s/GENERAL", catDomain.c_str()), "hidden_categories").c_str();
|
||||
u8 numReqCats = strlen(requiredCats);
|
||||
u8 numSelCats = strlen(selectedCats);
|
||||
u8 numHidCats = strlen(hiddenCats);
|
||||
|
||||
if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games
|
||||
{
|
||||
const char *idCats = m_cat.getString(catDomain, id).c_str();
|
||||
u8 numIdCats = strlen(idCats);
|
||||
bool inaCat = false;
|
||||
bool inHiddenCat = false;
|
||||
bool noHiddenCats = true;
|
||||
bool SelectedCats = false;
|
||||
int reqCount = 0;
|
||||
int reqMatch = 0;
|
||||
|
||||
for(u8 j = 1; j < m_max_categories; ++j)
|
||||
if(numIdCats != 0)
|
||||
{
|
||||
if(categories[j] == '3')
|
||||
for(u8 j = 0; j < numIdCats; ++j)
|
||||
{
|
||||
reqCount++;
|
||||
if(idCats[j] == '1')
|
||||
reqMatch++;
|
||||
inaCat = true;
|
||||
}
|
||||
else if(categories[j] == '1')
|
||||
{
|
||||
SelectedCats = true;
|
||||
if(idCats[j] == '1')
|
||||
inaCat = true;
|
||||
}
|
||||
else if(categories[j] == '2')
|
||||
{
|
||||
noHiddenCats = false;
|
||||
if(idCats[j] == '1')
|
||||
inHiddenCat = true;
|
||||
int k = (static_cast<int>(idCats[j])) - 32;
|
||||
if(k <= 0)
|
||||
continue;
|
||||
bool match = false;
|
||||
if(numReqCats != 0)
|
||||
{
|
||||
for(u8 l = 0; l < numReqCats; ++l)
|
||||
{
|
||||
if(k == (static_cast<int>(requiredCats[l]) - 32))
|
||||
{
|
||||
match = true;
|
||||
reqMatch++;
|
||||
inaCat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(match)
|
||||
continue;
|
||||
if(numSelCats != 0)
|
||||
{
|
||||
for(u8 l = 0; l < numSelCats; ++l)
|
||||
{
|
||||
if(k == (static_cast<int>(selectedCats[l]) - 32))
|
||||
{
|
||||
match = true;
|
||||
inaCat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(match)
|
||||
continue;
|
||||
if(numHidCats != 0)
|
||||
{
|
||||
for(u8 l = 0; l < numHidCats; ++l)
|
||||
{
|
||||
if(k == (static_cast<int>(hiddenCats[l]) - 32))
|
||||
inHiddenCat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//continue; means don't add game to list (don't show)
|
||||
if(inHiddenCat)
|
||||
continue;
|
||||
if(reqCount != reqMatch)
|
||||
if(numReqCats != reqMatch)
|
||||
continue;
|
||||
if(!inaCat)
|
||||
{
|
||||
if(noHiddenCats)
|
||||
if(numHidCats == 0)
|
||||
continue;
|
||||
else if(SelectedCats)
|
||||
else if(numSelCats > 0)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -2450,18 +2501,18 @@ void CMenu::_cleanupDefaultFont()
|
||||
string CMenu::_getId()
|
||||
{
|
||||
string id;
|
||||
if(m_current_view != COVERFLOW_EMU && m_current_view != COVERFLOW_HOMEBREW)
|
||||
if(!NoGameID(m_cf.getHdr()->type))
|
||||
id = m_cf.getId();
|
||||
else
|
||||
{
|
||||
dir_discHdr *hdr = m_cf.getHdr();
|
||||
string tempname(hdr->path);
|
||||
if(m_current_view == COVERFLOW_HOMEBREW)
|
||||
if(hdr->type == TYPE_HOMEBREW)
|
||||
{
|
||||
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
|
||||
id = tempname;
|
||||
}
|
||||
else if(m_current_view == COVERFLOW_EMU)
|
||||
else if(hdr->type == TYPE_PLUGIN)
|
||||
{
|
||||
if(!m_plugin.isScummVM(hdr->settings[0]))
|
||||
{
|
||||
|
@ -922,6 +922,8 @@ private:
|
||||
void _updateSourceBtns(void);
|
||||
void _updatePluginCheckboxes(void);
|
||||
void _updateCheckboxes(void);
|
||||
void _getIDCats(void);
|
||||
void _setIDCats(void);
|
||||
void _setBg(const STexture &tex, const STexture &lqTex);
|
||||
void _updateBg(void);
|
||||
void _drawBg(void);
|
||||
|
@ -23,6 +23,7 @@ u8 curPage;
|
||||
u8 lastBtn;
|
||||
const char *catSettings;
|
||||
string id;
|
||||
string catDomain;
|
||||
bool gameSet;
|
||||
|
||||
void CMenu::_hideCategorySettings(bool instant)
|
||||
@ -87,79 +88,169 @@ void CMenu::_updateCheckboxes(void)
|
||||
int j = i + ((curPage - 1) * 10);
|
||||
if(j == m_max_categories)
|
||||
break;
|
||||
if(m_categories[0] == '1' && !gameSet)
|
||||
m_btnMgr.show(m_categoryBtnCat[i]);
|
||||
else
|
||||
switch(m_categories[j])
|
||||
{
|
||||
switch(m_categories[j])
|
||||
{
|
||||
case '0':
|
||||
m_btnMgr.show(m_categoryBtnCat[i]);
|
||||
break;
|
||||
case '1':
|
||||
m_btnMgr.show(m_categoryBtnCats[i]);
|
||||
break;
|
||||
case '2':
|
||||
m_btnMgr.show(m_categoryBtnCatHid[i]);
|
||||
break;
|
||||
default:
|
||||
m_btnMgr.show(m_categoryBtnCatReq[i]);
|
||||
break;
|
||||
}
|
||||
case '0':
|
||||
m_btnMgr.show(m_categoryBtnCat[i]);
|
||||
break;
|
||||
case '1':
|
||||
m_btnMgr.show(m_categoryBtnCats[i]);
|
||||
break;
|
||||
case '2':
|
||||
m_btnMgr.show(m_categoryBtnCatHid[i]);
|
||||
break;
|
||||
default:
|
||||
m_btnMgr.show(m_categoryBtnCatReq[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString(fmt("%s/GENERAL", _domainFromView()), fmt("cat%d",j), wfmt(L"Category %i",j).c_str()));
|
||||
m_btnMgr.setText(m_categoryLblCat[i], m_cat.getWString(fmt("%s/GENERAL", catDomain.c_str()), fmt("cat%d",j), wfmt(L"Category %i",j).c_str()));
|
||||
m_btnMgr.show(m_categoryLblCat[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMenu::_getIDCats(void)
|
||||
{
|
||||
id = _getId();
|
||||
const char *idCats = m_cat.getString(catDomain, id, "").c_str();
|
||||
memset(&m_categories, '0', m_max_categories);
|
||||
u8 numIdCats = strlen(idCats);
|
||||
if(numIdCats != 0)
|
||||
{
|
||||
for(u8 j = 0; j < numIdCats; ++j)
|
||||
{
|
||||
int k = (static_cast<int>(idCats[j])) - 32;
|
||||
m_categories[k] = '1';
|
||||
}
|
||||
}
|
||||
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
|
||||
}
|
||||
|
||||
void CMenu::_setIDCats(void)
|
||||
{
|
||||
string newIdCats = "";
|
||||
for(int i = 1; i < m_max_categories; i++)
|
||||
{
|
||||
if(m_categories[i] == '1')
|
||||
{
|
||||
char cCh = static_cast<char>( i + 32);
|
||||
newIdCats = newIdCats + cCh;
|
||||
}
|
||||
}
|
||||
m_cat.setString(catDomain, id, newIdCats);
|
||||
}
|
||||
|
||||
void CMenu::_CategorySettings(bool fromGameSet)
|
||||
{
|
||||
SetupInput();
|
||||
curPage = 1;
|
||||
gameSet = fromGameSet;
|
||||
if(fromGameSet)
|
||||
|
||||
catDomain = _domainFromView();
|
||||
u8 pos = 0;
|
||||
vector<bool> EnabledPlugins;
|
||||
if(m_current_view == COVERFLOW_EMU)
|
||||
{
|
||||
id = _getId();
|
||||
catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
|
||||
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
|
||||
EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
|
||||
if(EnabledPlugins.size() != 0)
|
||||
{
|
||||
char PluginMagicWord[9];
|
||||
u8 enabledPluginsCount = 0;
|
||||
for(u8 i = 0; i < EnabledPlugins.size(); i++)
|
||||
{
|
||||
snprintf(PluginMagicWord, sizeof(PluginMagicWord), "%08x", m_plugin.getPluginMagic(i));
|
||||
if(m_cfg.getBool("PLUGIN", PluginMagicWord, true))
|
||||
{
|
||||
pos = i;
|
||||
enabledPluginsCount++;
|
||||
}
|
||||
}
|
||||
if(enabledPluginsCount == 1)
|
||||
catDomain = (m_plugin.GetPluginName(pos)).toUTF8();
|
||||
}
|
||||
}
|
||||
m_max_categories = m_cat.getInt(fmt("%s/GENERAL", catDomain.c_str()), "numcategories", 6);
|
||||
if(fromGameSet)
|
||||
_getIDCats();
|
||||
else
|
||||
{
|
||||
catSettings = m_cat.getString(fmt("%s/GENERAL", _domainFromView()), "categories").c_str();
|
||||
const char *requiredCats = m_cat.getString(fmt("%s/GENERAL", catDomain.c_str()), "required_categories").c_str();
|
||||
const char *selectedCats = m_cat.getString(fmt("%s/GENERAL", catDomain.c_str()), "selected_categories").c_str();
|
||||
const char *hiddenCats = m_cat.getString(fmt("%s/GENERAL", catDomain.c_str()), "hidden_categories").c_str();
|
||||
u8 numReqCats = strlen(requiredCats);
|
||||
u8 numSelCats = strlen(selectedCats);
|
||||
u8 numHidCats = strlen(hiddenCats);
|
||||
memset(&m_categories, '0', m_max_categories);
|
||||
|
||||
if(numReqCats != 0)
|
||||
{
|
||||
for(u8 j = 0; j < numReqCats; ++j)
|
||||
{
|
||||
int k = (static_cast<int>(requiredCats[j])) - 32;
|
||||
m_categories[k] = '3';
|
||||
}
|
||||
}
|
||||
if(numSelCats != 0)
|
||||
{
|
||||
for(u8 j = 0; j < numSelCats; ++j)
|
||||
{
|
||||
int k = (static_cast<int>(selectedCats[j])) - 32;
|
||||
m_categories[k] = '1';
|
||||
}
|
||||
}
|
||||
if(numHidCats != 0)
|
||||
{
|
||||
for(u8 j = 0; j < numHidCats; ++j)
|
||||
{
|
||||
int k = (static_cast<int>(hiddenCats[j])) - 32;
|
||||
m_categories[k] = '2';
|
||||
}
|
||||
}
|
||||
m_btnMgr.setText(m_categoryLblTitle, _t("cat1", L"Select Categories"));
|
||||
}
|
||||
memset(&m_categories, '0', m_max_categories);
|
||||
memcpy(&m_categories, catSettings, m_max_categories);
|
||||
_showCategorySettings();
|
||||
|
||||
while(!m_exit)
|
||||
{
|
||||
_mainLoopCommon();
|
||||
m_cf.tick();
|
||||
if(!m_btnMgr.selected(lastBtn))
|
||||
m_btnMgr.noHover(false);
|
||||
|
||||
if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnBack)))
|
||||
{
|
||||
char newCatSettings[m_max_categories + 1];
|
||||
memset(&newCatSettings, 0, sizeof(newCatSettings));
|
||||
memcpy(&newCatSettings, &m_categories, sizeof(m_categories));
|
||||
if(!fromGameSet)
|
||||
{
|
||||
newCatSettings[0] = '1';
|
||||
for(u8 i = 1; i < m_max_categories; i++)
|
||||
string newReqCats = "";
|
||||
string newSelCats = "";
|
||||
string newHidCats = "";
|
||||
for(int i = 1; i < m_max_categories; i++)
|
||||
{
|
||||
if(newCatSettings[i] != '0')
|
||||
if(m_categories[i] == '1')
|
||||
{
|
||||
newCatSettings[0] = '0';
|
||||
break;
|
||||
char cCh = static_cast<char>( i + 32);
|
||||
newSelCats = newSelCats + cCh;
|
||||
}
|
||||
else if(m_categories[i] == '2')
|
||||
{
|
||||
char cCh = static_cast<char>( i + 32);
|
||||
newHidCats = newHidCats + cCh;
|
||||
}
|
||||
else if(m_categories[i] == '3')
|
||||
{
|
||||
char cCh = static_cast<char>( i + 32);
|
||||
newReqCats = newReqCats + cCh;
|
||||
}
|
||||
}
|
||||
m_cat.setString(fmt("%s/GENERAL", _domainFromView()), "categories", newCatSettings);
|
||||
m_cat.setString(fmt("%s/GENERAL", catDomain.c_str()), "selected_categories", newSelCats);
|
||||
m_cat.setString(fmt("%s/GENERAL", catDomain.c_str()), "hidden_categories", newHidCats);
|
||||
m_cat.setString(fmt("%s/GENERAL", catDomain.c_str()), "required_categories", newReqCats);
|
||||
}
|
||||
else
|
||||
m_cat.setString(_domainFromView(), id, newCatSettings);
|
||||
//m_cat.save();
|
||||
_setIDCats();
|
||||
|
||||
m_cat.save();
|
||||
break;
|
||||
}
|
||||
else if(BTN_UP_PRESSED)
|
||||
@ -168,36 +259,20 @@ void CMenu::_CategorySettings(bool fromGameSet)
|
||||
m_btnMgr.down();
|
||||
if(BTN_PLUS_PRESSED && fromGameSet)
|
||||
{
|
||||
char newCatSettings[m_max_categories + 1];
|
||||
memset(&newCatSettings, 0, sizeof(newCatSettings));
|
||||
memcpy(&newCatSettings, &m_categories, sizeof(m_categories));
|
||||
m_cat.setString(_domainFromView(), id, newCatSettings);
|
||||
_setIDCats();
|
||||
_hideCategorySettings();
|
||||
m_cf.right();
|
||||
curPage = 1;
|
||||
id = _getId();
|
||||
catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
|
||||
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
|
||||
|
||||
memset(&m_categories, '0', m_max_categories);
|
||||
memcpy(&m_categories, catSettings, m_max_categories);
|
||||
_getIDCats();
|
||||
_showCategorySettings();
|
||||
}
|
||||
if(BTN_MINUS_PRESSED && fromGameSet)
|
||||
{
|
||||
char newCatSettings[m_max_categories + 1];
|
||||
memset(&newCatSettings, 0, sizeof(newCatSettings));
|
||||
memcpy(&newCatSettings, &m_categories, sizeof(m_categories));
|
||||
m_cat.setString(_domainFromView(), id, newCatSettings);
|
||||
_setIDCats();
|
||||
_hideCategorySettings();
|
||||
m_cf.left();
|
||||
curPage = 1;
|
||||
id = _getId();
|
||||
catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
|
||||
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
|
||||
|
||||
memset(&m_categories, '0', m_max_categories);
|
||||
memcpy(&m_categories, catSettings, m_max_categories);
|
||||
_getIDCats();
|
||||
_showCategorySettings();
|
||||
}
|
||||
if((BTN_LEFT_PRESSED && m_max_categories>11) || (BTN_A_PRESSED && m_btnMgr.selected(m_categoryBtnPageM)))
|
||||
@ -243,6 +318,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
|
||||
else if(m_btnMgr.selected(m_categoryBtnCatReq[i]))
|
||||
lastBtn = m_categoryBtnCatReq[i];
|
||||
m_btnMgr.noHover(true);
|
||||
|
||||
int j = i + ((curPage - 1) * 10);
|
||||
if(fromGameSet)
|
||||
{
|
||||
@ -258,25 +334,20 @@ void CMenu::_CategorySettings(bool fromGameSet)
|
||||
m_btnMgr.hide(m_categoryBtnCats[i], true);
|
||||
m_btnMgr.hide(m_categoryBtnCatHid[i], true);
|
||||
m_btnMgr.hide(m_categoryBtnCatReq[i], true);
|
||||
if(m_categories[0] =='1' && !fromGameSet)
|
||||
m_btnMgr.show(m_categoryBtnCat[i]);
|
||||
else
|
||||
switch(m_categories[j])
|
||||
{
|
||||
switch(m_categories[j])
|
||||
{
|
||||
case '0':
|
||||
m_btnMgr.show(m_categoryBtnCat[i]);
|
||||
break;
|
||||
case '1':
|
||||
m_btnMgr.show(m_categoryBtnCats[i]);
|
||||
break;
|
||||
case '2':
|
||||
m_btnMgr.show(m_categoryBtnCatHid[i]);
|
||||
break;
|
||||
default:
|
||||
m_btnMgr.show(m_categoryBtnCatReq[i]);
|
||||
break;
|
||||
}
|
||||
case '0':
|
||||
m_btnMgr.show(m_categoryBtnCat[i]);
|
||||
break;
|
||||
case '1':
|
||||
m_btnMgr.show(m_categoryBtnCats[i]);
|
||||
break;
|
||||
case '2':
|
||||
m_btnMgr.show(m_categoryBtnCatHid[i]);
|
||||
break;
|
||||
default:
|
||||
m_btnMgr.show(m_categoryBtnCatReq[i]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user