- fix for issue #318. favorites and adult_only in gameconfig1 and categories in categories_lite will now use the platform name and game ID if using the plugin database files. if either the platform name or game ID are not available we will still use old method of plugin magic and game title. With new method if old plugin magic and game title is found it will be converted to platform name and game ID. because of this it is recommended to backup gameconfig1 and categories_lite just in case you have issues with new WFL and need to go back to old WFL.

Titlesdump.ini has also been updated to new method and will now include output of the filtered game list for plugins. Set [GENERAL] dump_list=yes before starting WFL. set it to 'no' when done dumping your lists.
This commit is contained in:
Fledge68 2023-01-08 17:25:45 -06:00
parent 4be2d6efda
commit c4b949acab
5 changed files with 217 additions and 146 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -2018,88 +2018,124 @@ void CMenu::_initCF(void)
CoverFlow.clear(); CoverFlow.clear();
CoverFlow.reserve(m_gameList.size()); CoverFlow.reserve(m_gameList.size());
string requiredCats; char cfgKey1[74];
string selectedCats; char cfgKey2[74];
string hiddenCats; char catKey1[64];
char id[74]; char catKey2[64];
char catID[64];
// filter list based on categories and favorites // filter list based on categories, favorites, and adult only
for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr) for(vector<dir_discHdr>::iterator hdr = m_gameList.begin(); hdr != m_gameList.end(); ++hdr)
{ {
requiredCats = m_cat.getString("GENERAL", "required_categories", ""); if(m_sourceflow && !m_source.getBool(sfmt("button_%i", hdr->settings[0]), "hidden", false))
selectedCats = m_cat.getString("GENERAL", "selected_categories", "");
hiddenCats = m_cat.getString("GENERAL", "hidden_categories", "");
const char *favDomain = "FAVORITES";
const char *adultDomain = "ADULTONLY";
memset(id, 0, 74);
memset(catID, 0, 64);
if(m_sourceflow)
{ {
if(m_source.getBool(sfmt("button_%i", hdr->settings[0]), "hidden", false) == false) CoverFlow.addItem(&(*hdr), 0, 0);// no filtering for sourceflow
CoverFlow.addItem(&(*hdr), 0, 0);
continue; continue;
} }
else if(hdr->type == TYPE_HOMEBREW)
string favDomain = "FAVORITES";
string adultDomain = "ADULTONLY";
if(hdr->type == TYPE_PLUGIN)
{ {
wcstombs(id, hdr->title, 63); favDomain = "FAVORITES_PLUGINS";
strcpy(catID, id); adultDomain = "ADULTONLY_PLUGINS";
} }
// 1 is the one used. 2 is a temp copied to 1.
string catDomain1 = "";
string catDomain2 = "";
memset(catKey1, 0, 64);
memset(catKey2, 0, 64);
memset(cfgKey1, 0, 74);
memset(cfgKey2, 0, 74);
if(hdr->type == TYPE_HOMEBREW)
wcstombs(cfgKey1, hdr->title, 63);// uses title which is the folder name in apps.
else if(hdr->type == TYPE_PLUGIN) else if(hdr->type == TYPE_PLUGIN)
{ {
if(m_cat.hasDomain("PLUGINS"))// if using new style categories_lite.ini strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
// old pre 5.4.4 method which uses plugin magic/title of game
if(strrchr(hdr->path, '/') != NULL)
wcstombs(catKey1, hdr->title, 63);
else
memcpy(catKey1, hdr->path, 63);// scummvm
strcpy(cfgKey1, fmt("%s/%s", m_plugin.PluginMagicWord, catKey1));
// if game has an id from the plugin database we use the new method which uses platform name/id
if(strcmp(hdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
{
strcpy(cfgKey2, fmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), hdr->id));
if(m_gcfg1.has(favDomain, cfgKey1) && !m_gcfg1.has(favDomain, cfgKey2))// convert old [DOMAIN] key= to new [DOMAIN] key=
{
m_gcfg1.setString(favDomain, cfgKey2, m_gcfg1.getString(favDomain, cfgKey1));
m_gcfg1.remove(favDomain, cfgKey1);// remove old method from cfg1
}
if(m_gcfg1.has(adultDomain, cfgKey1) && !m_gcfg1.has(adultDomain, cfgKey2))// convert old [DOMAIN] key= to new [DOMAIN] key=
{
m_gcfg1.setString(adultDomain, cfgKey2, m_gcfg1.getString(adultDomain, cfgKey1));
m_gcfg1.remove(adultDomain, cfgKey1);// remove old method from cfg1
}
strcpy(cfgKey1, cfgKey2);// copy 2 temp to 1 to use.
}
}
else // wii, gc, channels
strcpy(cfgKey1, hdr->id);
if((!m_favorites || m_gcfg1.getBool(favDomain, cfgKey1, false))
&& (!m_locked || !m_gcfg1.getBool(adultDomain, cfgKey1, false)))
{
string requiredCats = m_cat.getString("GENERAL", "required_categories", "");
string selectedCats = m_cat.getString("GENERAL", "selected_categories", "");
string hiddenCats = m_cat.getString("GENERAL", "hidden_categories", "");
if(hdr->type == TYPE_PLUGIN && m_cat.hasDomain("PLUGINS"))// if using the optional PLUGINS domain for categories_lite.ini
{ {
requiredCats = m_cat.getString("PLUGINS", "required_categories", ""); requiredCats = m_cat.getString("PLUGINS", "required_categories", "");
selectedCats = m_cat.getString("PLUGINS", "selected_categories", ""); selectedCats = m_cat.getString("PLUGINS", "selected_categories", "");
hiddenCats = m_cat.getString("PLUGINS", "hidden_categories", ""); hiddenCats = m_cat.getString("PLUGINS", "hidden_categories", "");
} }
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); u8 numReqCats = requiredCats.length();
if(strrchr(hdr->path, '/') != NULL) u8 numSelCats = selectedCats.length();
wcstombs(catID, hdr->title, 63); u8 numHidCats = hiddenCats.length();
else
strncpy(catID, hdr->path, 63);// scummvm
strcpy(id, m_plugin.PluginMagicWord);
strcat(id, fmt("/%s", catID));
favDomain = "FAVORITES_PLUGINS";
adultDomain = "ADULTONLY_PLUGINS";
}
else // wii, gc, channels
{
strcpy(id, hdr->id);
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)))
{
string catDomain = "";
if(hdr->type == TYPE_CHANNEL) if(hdr->type == TYPE_CHANNEL)
catDomain = "NAND"; catDomain1 = "NAND";
else if(hdr->type == TYPE_EMUCHANNEL) else if(hdr->type == TYPE_EMUCHANNEL)
catDomain = "CHANNELS"; catDomain1 = "CHANNELS";
else if(hdr->type == TYPE_GC_GAME) else if(hdr->type == TYPE_GC_GAME)
catDomain = "GAMECUBE"; catDomain1 = "GAMECUBE";
else if(hdr->type == TYPE_WII_GAME) else if(hdr->type == TYPE_WII_GAME)
catDomain = "WII"; catDomain1 = "WII";
else if(hdr->type == TYPE_HOMEBREW) else if(hdr->type == TYPE_HOMEBREW)
catDomain = "HOMEBREW"; catDomain1 = "HOMEBREW";
else else //hdr->type == TYPE_PLUGIN
catDomain = m_plugin.PluginMagicWord; {
// old categories method use [MAGIC] and game title as the key.
catDomain1 = m_plugin.PluginMagicWord;
// catKey1 already set above
// if game has an id from the plugin database we use the new method which uses [platform name] and id as the key
if(strcmp(hdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
{
catDomain2 = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);
strcpy(catKey2, hdr->id);
if(m_cat.has(catDomain1, catKey1) && !m_cat.has(catDomain2, catKey2))// convert old [DOMAIN] key= to new [DOMAIN] key=
{
m_cat.setString(catDomain2, catKey2, m_cat.getString(catDomain1, catKey1));
m_cat.remove(catDomain1, catKey1);// remove old method from categories cfg
}
strcpy(catKey1, catKey2);// copy 2 temp to 1 to use.
catDomain1 = catDomain2;
}
}
if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games if(numReqCats != 0 || numSelCats != 0 || numHidCats != 0) // if all 0 skip checking cats and show all games
{ {
string idCats= m_cat.getString(catDomain, catID, ""); string idCats= m_cat.getString(catDomain1, catKey1, "");
u8 numIdCats = idCats.length(); u8 numIdCats = idCats.length();
if(numIdCats == 0) if(numIdCats == 0)
m_cat.remove(catDomain, catID); m_cat.remove(catDomain1, catKey1);
bool inaCat = false; bool inaCat = false;
bool inHiddenCat = false; bool inHiddenCat = false;
int reqMatch = 0; int reqMatch = 0;
@ -2162,41 +2198,23 @@ void CMenu::_initCF(void)
} }
} }
if(dumpGameLst && !NoGameID(hdr->type)) if(dumpGameLst && (!NoGameID(hdr->type) || (hdr->type == TYPE_PLUGIN && strcmp(hdr->id, "PLUGIN") != 0)))
{ dump.setWString(catDomain1, catKey1, hdr->title);
const char *domain = NULL;
switch(hdr->type)
{
case TYPE_CHANNEL:
domain = "NAND";
break;
case TYPE_EMUCHANNEL:
domain = "CHANNELS";
break;
case TYPE_GC_GAME:
domain = "GAMECUBE";
break;
default:
domain = "WII";
break;
}
dump.setWString(domain, id, hdr->title);
}
if(hdr->type == TYPE_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(hdr->settings[0]))) if(hdr->type == TYPE_PLUGIN && m_plugin.GetEnabledStatus(m_plugin.GetPluginPosition(hdr->settings[0])))
CoverFlow.addItem(&(*hdr), 0, 0); CoverFlow.addItem(&(*hdr), 0, 0);
else else
{ {
int playcount = m_gcfg1.getInt("PLAYCOUNT", id, 0); int playcount = m_gcfg1.getInt("PLAYCOUNT", cfgKey1, 0);
unsigned int lastPlayed = m_gcfg1.getUInt("LASTPLAYED", id, 0); unsigned int lastPlayed = m_gcfg1.getUInt("LASTPLAYED", cfgKey1, 0);
CoverFlow.addItem(&(*hdr), playcount, lastPlayed); CoverFlow.addItem(&(*hdr), playcount, lastPlayed);
} }
} }
/* remove them if false to keep file short */ /* remove them if false to keep file short */
if(!m_gcfg1.getBool(favDomain, id)) if(!m_gcfg1.getBool(favDomain, cfgKey1))
m_gcfg1.remove(favDomain, id); m_gcfg1.remove(favDomain, cfgKey1);
if(!m_gcfg1.getBool(adultDomain, id)) if(!m_gcfg1.getBool(adultDomain, cfgKey1))
m_gcfg1.remove(adultDomain, id); m_gcfg1.remove(adultDomain, cfgKey1);
} }
if(CoverFlow.empty()) if(CoverFlow.empty())
@ -2208,7 +2226,7 @@ void CMenu::_initCF(void)
if(dumpGameLst) if(dumpGameLst)
{ {
dump.save(true); dump.save(true);
m_cfg.setBool("GENERAL", "dump_list", false); //m_cfg.setBool("GENERAL", "dump_list", false);
} }
/*********************** sort coverflow list ***********************/ /*********************** sort coverflow list ***********************/

View File

@ -14,7 +14,7 @@ TexData m_categoryBg;
vector<char> m_categories; vector<char> m_categories;
static u8 curPage; static u8 curPage;
char id[64]; char id[64];
const char *catDomain = NULL; string catDomain;
bool gameSet; bool gameSet;
string genDomain; string genDomain;
@ -134,6 +134,7 @@ void CMenu::_updateCatCheckboxes(void)
void CMenu::_getGameCategories(void) void CMenu::_getGameCategories(void)
{ {
const dir_discHdr *hdr = CoverFlow.getHdr(); const dir_discHdr *hdr = CoverFlow.getHdr();
/* get the domain text [TEXT] */
switch(hdr->type) switch(hdr->type)
{ {
case TYPE_CHANNEL: case TYPE_CHANNEL:
@ -152,20 +153,27 @@ void CMenu::_getGameCategories(void)
catDomain = "WII"; catDomain = "WII";
break; break;
default: default:
catDomain = m_plugin.PluginMagicWord; if(strcmp(hdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
catDomain = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);// console/platform from platform.ini
else
catDomain = m_plugin.PluginMagicWord;// no platform.ini - we use plugin magic
} }
/* get KEY text (before =) */
memset(id, 0, 64); memset(id, 0, 64);
if(NoGameID(hdr->type)) if(hdr->type == TYPE_HOMEBREW)
wcstombs(id, hdr->title, sizeof(id) - 1);//we use title(folder) because no ID and filenames are all boot.dol or boot.elf
else if(hdr->type == TYPE_PLUGIN && strcmp(hdr->id, "PLUGIN") == 0)// no ID from plugin database files
{ {
if(strrchr(hdr->path, '/') != NULL) if(strrchr(hdr->path, '/') != NULL)
wcstombs(id, hdr->title, sizeof(id) - 1); wcstombs(id, hdr->title, sizeof(id) - 1);// without ID we can't use database files. title is the rom filename without extension or custom title.
else else
strcpy(id, hdr->path);// scummvm memcpy(id, hdr->path, 63);// scummvm
} }
else else
strcpy(id, hdr->id); strcpy(id, hdr->id);// wii, gc, channels, and plugin games with an ID from database files
/* get the game's categories uing the domain and key */
const char *gameCats = m_cat.getString(catDomain, id, "").c_str(); const char *gameCats = m_cat.getString(catDomain, id, "").c_str();
if(strlen(gameCats) > 0) if(strlen(gameCats) > 0)
{ {

View File

@ -162,9 +162,18 @@ void CMenu::_hideConfigGame(bool instant)
void CMenu::_showConfigGame() void CMenu::_showConfigGame()
{ {
vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|'); vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|');
bool b;
string adultDomain;
if(GameHdr->type == TYPE_PLUGIN)
adultDomain = "ADULTONLY_PLUGINS";
else
adultDomain = "ADULTONLY";
u8 i; u8 i;
string id; string id;
char gameTitle[64]; char gameTitle[64];
memset(gameTitle, 0 , 64);
if(GameHdr->type == TYPE_HOMEBREW) if(GameHdr->type == TYPE_HOMEBREW)
{ {
@ -174,18 +183,20 @@ void CMenu::_showConfigGame()
else if(GameHdr->type == TYPE_PLUGIN) else if(GameHdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8);
if(strrchr(GameHdr->path, '/') != NULL) // if game has an id from the plugin database we use the new method which uses platform name/id
if(strcmp(GameHdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
id =sfmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), GameHdr->id);
else // old pre 5.4.4 method which uses plugin magic/title of game
{ {
wcstombs(gameTitle, GameHdr->title, 63); if(strrchr(GameHdr->path, '/') != NULL)
id = string(m_plugin.PluginMagicWord) + "/" + string(gameTitle); wcstombs(gameTitle, GameHdr->title, 63);
else
memcpy(gameTitle, GameHdr->path, 63);// scummvm
id = sfmt("%s/%s", m_plugin.PluginMagicWord, gameTitle);
} }
else
id = string(m_plugin.PluginMagicWord) + "/" + GameHdr->path;
} }
else else
{
id = GameHdr->id; id = GameHdr->id;
}
_setBg(m_gameSettingsBg, m_gameSettingsBg); _setBg(m_gameSettingsBg, m_gameSettingsBg);
for(i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i) for(i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
@ -203,10 +214,10 @@ void CMenu::_showConfigGame()
{ {
m_configGameMaxPgs = 1; m_configGameMaxPgs = 1;
m_btnMgr.setText(m_configLbl1, _t("cfgg58", L"Adult only")); m_btnMgr.setText(m_configLbl1, _t("cfgg58", L"Adult only"));
if(GameHdr->type == TYPE_PLUGIN) b = m_gcfg1.getBool(adultDomain, id, false);
m_btnMgr.setText(m_configBtn1, m_gcfg1.getBool("ADULTONLY_PLUGINS", id, false) ? _t("yes", L"Yes") : _t("no", L"No")); if(!b)
else m_gcfg1.remove(adultDomain, id);
m_btnMgr.setText(m_configBtn1, m_gcfg1.getBool("ADULTONLY", id, false) ? _t("yes", L"Yes") : _t("no", L"No")); m_btnMgr.setText(m_configBtn1, b ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.show(m_configLbl1); m_btnMgr.show(m_configLbl1);
m_btnMgr.show(m_configBtn1); m_btnMgr.show(m_configBtn1);
@ -228,7 +239,10 @@ void CMenu::_showConfigGame()
if(m_configGamePage == 1) if(m_configGamePage == 1)
{ {
m_btnMgr.setText(m_configLbl1, _t("cfgg58", L"Adult only")); m_btnMgr.setText(m_configLbl1, _t("cfgg58", L"Adult only"));
m_btnMgr.setText(m_configBtn1, m_gcfg1.getBool("ADULTONLY", id, false) ? _t("yes", L"Yes") : _t("no", L"No")); b = m_gcfg1.getBool(adultDomain, id, false);
if(!b)
m_gcfg1.remove(adultDomain, id);
m_btnMgr.setText(m_configBtn1, b ? _t("yes", L"Yes") : _t("no", L"No"));
m_btnMgr.setText(m_configLbl2, _t("cfgg10", L"IOS")); m_btnMgr.setText(m_configLbl2, _t("cfgg10", L"IOS"));
i = m_gcfg2.getUInt(id, "ios", 0); i = m_gcfg2.getUInt(id, "ios", 0);
@ -430,10 +444,16 @@ void CMenu::_configGame(const dir_discHdr *hdr, bool disc)
vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|'); vector<string> custom_servers = stringToVector(m_cfg.getString("custom_servers", "servers"), '|');
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
GameHdr = hdr;// set for global use in other fuctions GameHdr = hdr;// set for global use in other fuctions
string adultDomain;
if(hdr->type == TYPE_PLUGIN)
adultDomain = "ADULTONLY_PLUGINS";
else
adultDomain = "ADULTONLY";
u8 i; u8 i;
string id; string id;
//s8 direction; //s8 direction;
char gameTitle[64]; char gameTitle[64];
memset(gameTitle, 0 , 64);
if(GameHdr->type == TYPE_HOMEBREW) if(GameHdr->type == TYPE_HOMEBREW)
{ {
@ -443,18 +463,20 @@ void CMenu::_configGame(const dir_discHdr *hdr, bool disc)
else if(GameHdr->type == TYPE_PLUGIN) else if(GameHdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", GameHdr->settings[0]), 8);
if(strrchr(GameHdr->path, '/') != NULL) // if game has an id from the plugin database we use the new method which uses platform name/id
if(strcmp(GameHdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
id =sfmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), GameHdr->id);
else // old pre 5.4.4 method which uses plugin magic/title of game
{ {
wcstombs(gameTitle, GameHdr->title, 63); if(strrchr(GameHdr->path, '/') != NULL)
id = string(m_plugin.PluginMagicWord) + "/" + string(gameTitle); wcstombs(gameTitle, GameHdr->title, 63);
else
memcpy(gameTitle, GameHdr->path, 63);// scummvm
id = sfmt("%s/%s", m_plugin.PluginMagicWord, gameTitle);
} }
else
id = string(m_plugin.PluginMagicWord) + "/" + GameHdr->path;
} }
else else
{
id = GameHdr->id; id = GameHdr->id;
}
m_configGamePage = 1; m_configGamePage = 1;
_showConfigGame(); _showConfigGame();
@ -502,11 +524,11 @@ void CMenu::_configGame(const dir_discHdr *hdr, bool disc)
} }
else else
{ {
if(GameHdr->type == TYPE_PLUGIN) m_gcfg1.setBool(adultDomain, id, !m_gcfg1.getBool(adultDomain, id, false));
m_gcfg1.setBool("ADULTONLY_PLUGINS", id, !m_gcfg1.getBool("ADULTONLY_PLUGINS", id, false)); bool b = m_gcfg1.getBool(adultDomain, id);
else if(!b)
m_gcfg1.setBool("ADULTONLY", id, !m_gcfg1.getBool("ADULTONLY", id, false)); m_gcfg1.remove(adultDomain, id);
m_btnMgr.setText(m_configBtn1, m_gcfg1.getBool("ADULTONLY", id, false) ? _t("yes", L"Yes") : _t("no", L"No")); m_btnMgr.setText(m_configBtn1, b ? _t("yes", L"Yes") : _t("no", L"No"));
} }
} }
else if(m_btnMgr.selected(m_configBtn2)) else if(m_btnMgr.selected(m_configBtn2))

View File

@ -208,27 +208,31 @@ void CMenu::_game(bool launch)
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr)); memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));
_setCurrentItem(hdr); _setCurrentItem(hdr);
char id[74]; char gcfg1Key[74];
char catID[64]; char gameTitle[64];
memset(id, 0, 74); memset(gcfg1Key, 0, sizeof(gcfg1Key));
memset(catID, 0, 64); memset(gameTitle, 0, sizeof(gameTitle));
if(hdr->type == TYPE_HOMEBREW) if(hdr->type == TYPE_HOMEBREW)
wcstombs(id, hdr->title, 63); wcstombs(gcfg1Key, hdr->title, 63);// uses title which is the folder name in apps.
else if(hdr->type == TYPE_PLUGIN) else if(hdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
if(strrchr(hdr->path, '/') != NULL)
wcstombs(catID, hdr->title, 63); // if game has an id from the plugin database we use the new method which uses platform name/id
else if(strcmp(hdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
strcpy(catID, hdr->path);// scummvm strncpy(gcfg1Key, fmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), hdr->id), 73);
strcpy(id, m_plugin.PluginMagicWord); else // old pre 5.4.4 method which uses plugin magic/title of game
strcat(id, fmt("/%s", catID)); {
} if(strrchr(hdr->path, '/') != NULL)
else wcstombs(gameTitle, hdr->title, 63);
{ else
strcpy(id, hdr->id); memcpy(gameTitle, hdr->path, 63);// scummvm
strncpy(gcfg1Key, fmt("%s/%s", m_plugin.PluginMagicWord, gameTitle), 73);
}
} }
else // wii, gc, channels
strcpy(gcfg1Key, hdr->id);
m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false); m_zoom_banner = m_cfg.getBool(_domainFromView(), "show_full_banner", false);
@ -432,9 +436,17 @@ void CMenu::_game(bool launch)
else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)) else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff))
{ {
if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_PLUGIN)
m_gcfg1.setBool("FAVORITES_PLUGINS", id, !m_gcfg1.getBool("FAVORITES_PLUGINS", id, false)); {
m_gcfg1.setBool("FAVORITES_PLUGINS", gcfg1Key, !m_gcfg1.getBool("FAVORITES_PLUGINS", gcfg1Key, false));
if(!m_gcfg1.getBool("FAVORITES_PLUGINS", gcfg1Key, false))
m_gcfg1.remove("FAVORITES_PLUGINS", gcfg1Key);
}
else else
m_gcfg1.setBool("FAVORITES", id, !m_gcfg1.getBool("FAVORITES", id, false)); {
m_gcfg1.setBool("FAVORITES", gcfg1Key, !m_gcfg1.getBool("FAVORITES", gcfg1Key, false));
if(!m_gcfg1.getBool("FAVORITES", gcfg1Key, false))
m_gcfg1.remove("FAVORITES", gcfg1Key);
}
if(m_favorites) if(m_favorites)
m_refreshGameList = true; m_refreshGameList = true;
} }
@ -549,25 +561,30 @@ void CMenu::_game(bool launch)
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header
_setCurrentItem(hdr); _setCurrentItem(hdr);
memset(id, 0, 74); memset(gcfg1Key, 0, sizeof(gcfg1Key));
memset(catID, 0, 64); memset(gameTitle, 0, sizeof(gameTitle));
if(hdr->type == TYPE_HOMEBREW) if(hdr->type == TYPE_HOMEBREW)
wcstombs(id, hdr->title, 64); wcstombs(gcfg1Key, hdr->title, 63);// uses title which is the folder name in apps.
else if(hdr->type == TYPE_PLUGIN) else if(hdr->type == TYPE_PLUGIN)
{ {
strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8); strncpy(m_plugin.PluginMagicWord, fmt("%08x", hdr->settings[0]), 8);
if(strrchr(hdr->path, '/') != NULL)
wcstombs(catID, hdr->title, 63); // if game has an id from the plugin database we use the new method which uses platform name/id
else if(strcmp(hdr->id, "PLUGIN") != 0 && !m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "").empty())
strcpy(catID, hdr->path);// scummvm strncpy(gcfg1Key, fmt("%s/%s", m_platform.getString("PLUGINS", m_plugin.PluginMagicWord).c_str(), hdr->id), 73);
strcpy(id, m_plugin.PluginMagicWord); else // old pre 5.4.4 method which uses plugin magic/title of game
strcat(id, fmt("/%s", catID)); {
} if(strrchr(hdr->path, '/') != NULL)
else wcstombs(gameTitle, hdr->title, 63);
{ else
strcpy(id, hdr->id); memcpy(gameTitle, hdr->path, 63);// scummvm
strncpy(gcfg1Key, fmt("%s/%s", m_plugin.PluginMagicWord, gameTitle), 73);
}
} }
else // wii, gc, channels
strcpy(gcfg1Key, hdr->id);
if(m_newGame) if(m_newGame)
{ {
m_newGame = false; m_newGame = false;
@ -614,9 +631,15 @@ void CMenu::_game(bool launch)
m_btnMgr.show(m_gameBtnCategories); m_btnMgr.show(m_gameBtnCategories);
bool b; bool b;
if(hdr->type == TYPE_PLUGIN) if(hdr->type == TYPE_PLUGIN)
b = m_gcfg1.getBool("FAVORITES_PLUGINS", id, false); {
b = m_gcfg1.getBool("FAVORITES_PLUGINS", gcfg1Key, false);
if(!b) m_gcfg1.remove("FAVORITES_PLUGINS", gcfg1Key);
}
else else
b = m_gcfg1.getBool("FAVORITES", id, false); {
b = m_gcfg1.getBool("FAVORITES", gcfg1Key, false);
if(!b) m_gcfg1.remove("FAVORITES", gcfg1Key);
}
m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff); m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff);
m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn); m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser); ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser); ++i)