- fixed custom_titles to use the new format of platform name and game ID. old format will be updated to new format so backup custom_titles before using this commit.

This commit is contained in:
Fledge68 2023-01-09 18:06:01 -06:00
parent c4b949acab
commit 2826ec575e
4 changed files with 24 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -273,6 +273,16 @@ void Config::remove(const std::string &domain, const std::string &key)
m_domains[upperCase(domain)].erase(lowerCase(key)); m_domains[upperCase(domain)].erase(lowerCase(key));
} }
void Config::removeCustomTitles(const std::string &domain, const std::string &key)
{
if (domain.empty() || key.empty()) return;
//gprintf("remove %s\n", key.c_str());
KeyMap::iterator i = m_groupCustomTitles.find(upperCase(domain));
if (i == m_groupCustomTitles.end()) return;
m_changed = true;
m_domains[i->second].erase(lowerCase(key));
}
void Config::setOptBool(const std::string &domain, const std::string &key, int val) void Config::setOptBool(const std::string &domain, const std::string &key, int val)
{ {
if (domain.empty() || key.empty()) return; if (domain.empty() || key.empty()) return;

View File

@ -46,6 +46,7 @@ public:
CColor getColor(const std::string &domain, const std::string &key, const CColor &defVal = CColor()); CColor getColor(const std::string &domain, const std::string &key, const CColor &defVal = CColor());
// Remove // Remove
void remove(const std::string &domain, const std::string &key); void remove(const std::string &domain, const std::string &key);
void removeCustomTitles(const std::string &domain, const std::string &key);
// //
const std::string &firstDomain(void); const std::string &firstDomain(void);
const std::string &nextDomain(void); const std::string &nextDomain(void);

View File

@ -267,7 +267,7 @@ static void Add_Plugin_Game(char *FullPath)
return; return;
} }
/* Get roms's title without the extra ()'s or []'s */ /* Get roms's filename without the extra ()'s or []'s */
string ShortName = m_plugin.GetRomName(FullPath); string ShortName = m_plugin.GetRomName(FullPath);
//gprintf("Add_Plugin_Game: fullName=%s, shortName=%s\n", FullPath, ShortName.c_str()); //gprintf("Add_Plugin_Game: fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
@ -291,7 +291,18 @@ static void Add_Plugin_Game(char *FullPath)
/* Get titles - Rom filename, custom title, and database xml title */ /* Get titles - Rom filename, custom title, and database xml title */
*strrchr(RomFilename, '.') = '\0';// remove extension *strrchr(RomFilename, '.') = '\0';// remove extension
string customTitle = CustomTitles.getStringCustomTitles(m_plugin.PluginMagicWord, RomFilename, ""); string customTitle;
customTitle = CustomTitles.getStringCustomTitles(m_plugin.PluginMagicWord, RomFilename, "");// old format
if(romID != "PLUGIN")
{
if(!customTitle.empty())
{
CustomTitles.setString(platformName, romID, customTitle);// convert old format to new format
CustomTitles.removeCustomTitles(m_plugin.PluginMagicWord, RomFilename);// remove old format
}
else
customTitle = CustomTitles.getString(platformName, romID, "");// new format
}
const char *gameTDB_Title = NULL; const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded() && customTitle.empty() && m_cacheList.usePluginDBTitles) if(gameTDB.IsLoaded() && customTitle.empty() && m_cacheList.usePluginDBTitles)