This commit is contained in:
Fledge68 2022-09-07 10:00:42 -05:00
commit 67dc2fa7fb
5 changed files with 37 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -312,7 +312,6 @@ static void Add_Plugin_Game(char *FullPath)
m_cacheList.push_back(ListElement); m_cacheList.push_back(ListElement);
} }
/* notes: "description" is used as the title because it basically is the title */
/* the [GameDomain] is used as the path even though it isn't the path */ /* the [GameDomain] is used as the path even though it isn't the path */
/* the [GameDomain] is usually short without any '/' */ /* the [GameDomain] is usually short without any '/' */
/* in scummvm.ini the path is the path without the exe or main app file added on */ /* in scummvm.ini the path is the path without the exe or main app file added on */
@ -338,16 +337,24 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char
Config m_crc; Config m_crc;
if(platform != NULL) if(platform != NULL)
{
m_crc.load(fmt("%s/%s/%s.ini", datadir, platform, platform)); m_crc.load(fmt("%s/%s/%s.ini", datadir, platform, platform));
/* Load platform name.xml database to get game's info using the gameID */
gameTDB.OpenFile(fmt("%s/%s/%s.xml", datadir, platform, platform));
if(gameTDB.IsLoaded())
gameTDB.SetLanguageCode(gameTDB_Language.c_str());
}
const char *GameDomain = ini.firstDomain().c_str(); const char *GameDomain = ini.firstDomain().c_str();
while(1) while(1)
{ {
if(strlen(GameDomain) < 2) if(strlen(GameDomain) < 2)
break; break;
char GameName[64]; // GameName has to be at least as large as the longest key in m_crc,
// otherwise the game won't be found.
char GameName[128];
memset(GameName, 0, sizeof(GameName)); memset(GameName, 0, sizeof(GameName));
strncpy(GameName, ini.getString(GameDomain, "description").c_str(), 63); strncpy(GameName, ini.getString(GameDomain, "description").c_str(), sizeof(GameName)-1);
if(strlen(GameName) < 2 || strncasecmp(Device, ini.getString(GameDomain, "path").c_str(), 2) != 0) if(strlen(GameName) < 2 || strncasecmp(Device, ini.getString(GameDomain, "path").c_str(), 2) != 0)
{ {
GameDomain = ini.nextDomain().c_str(); GameDomain = ini.nextDomain().c_str();
@ -371,8 +378,20 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char
memset((void*)&ListElement, 0, sizeof(dir_discHdr)); memset((void*)&ListElement, 0, sizeof(dir_discHdr));
memcpy(ListElement.id, GameID.c_str(), 6); memcpy(ListElement.id, GameID.c_str(), 6);
mbstowcs(ListElement.title, GameName, 63);
const char *gameTDB_Title = NULL;
if(gameTDB.IsLoaded() && m_cacheList.usePluginDBTitles)
{
gameTDB.GetTitle(ListElement.id, gameTDB_Title, true);
}
if(gameTDB_Title != NULL && gameTDB_Title[0] != '\0')
mbstowcs(ListElement.title, gameTDB_Title, 63);
else
mbstowcs(ListElement.title, GameName, 63);
Asciify(ListElement.title);
strcpy(ListElement.path, GameDomain); strcpy(ListElement.path, GameDomain);
ListElement.settings[0] = m_cacheList.Magic; //scummvm magic ListElement.settings[0] = m_cacheList.Magic; //scummvm magic
ListElement.casecolor = m_cacheList.Color; ListElement.casecolor = m_cacheList.Color;
ListElement.type = TYPE_PLUGIN; ListElement.type = TYPE_PLUGIN;
@ -380,6 +399,7 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char
GameDomain = ini.nextDomain().c_str(); GameDomain = ini.nextDomain().c_str();
} }
m_crc.unload(); m_crc.unload();
CloseConfigs();
if(!this->empty() && !DBName.empty()) /* Write a new Cache */ if(!this->empty() && !DBName.empty()) /* Write a new Cache */
CCache(*this, DBName, SAVE); CCache(*this, DBName, SAVE);
} }

View File

@ -2578,6 +2578,7 @@ bool CMenu::_loadPluginList()
platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord); platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord);
m_cacheList.Color = m_plugin.GetCaseColor(i); m_cacheList.Color = m_plugin.GetCaseColor(i);
m_cacheList.Magic = m_plugin.GetPluginMagic(i); m_cacheList.Magic = m_plugin.GetPluginMagic(i);
m_cacheList.usePluginDBTitles = m_cfg.getBool(PLUGIN_DOMAIN, "database_titles", true);
m_cacheList.ParseScummvmINI(scummvm, DeviceName[currentPartition], m_pluginDataDir.c_str(), platformName.c_str(), cachedListFile, updateCache); m_cacheList.ParseScummvmINI(scummvm, DeviceName[currentPartition], m_pluginDataDir.c_str(), platformName.c_str(), cachedListFile, updateCache);
for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);

View File

@ -790,6 +790,7 @@ private:
// menu shows // menu shows
void _showMain(void); void _showMain(void);
void _showCF(bool refreshList = false); void _showCF(bool refreshList = false);
void _showTotalGames(const int numberOfGames);
void _showError(void); void _showError(void);
void _showConfigMain(void); void _showConfigMain(void);
void _showConfigGC(void); void _showConfigGC(void);

View File

@ -121,6 +121,13 @@ void CMenu::_showMain()
_showCF(m_refreshGameList); _showCF(m_refreshGameList);
} }
void CMenu::_showTotalGames(const int numberOfGames)
{
m_showtimer = 240;
m_btnMgr.setText(m_mainLblNotice, wfmt(_fmt("main7", L"Total Games: %i"), numberOfGames));
m_btnMgr.show(m_mainLblNotice);
}
void CMenu::_showCF(bool refreshList) void CMenu::_showCF(bool refreshList)
{ {
m_refreshGameList = false; m_refreshGameList = false;
@ -345,9 +352,7 @@ void CMenu::_showCF(bool refreshList)
if(m_sourceflow || m_current_view == COVERFLOW_HOMEBREW) if(m_sourceflow || m_current_view == COVERFLOW_HOMEBREW)
return; return;
m_showtimer = 240; _showTotalGames(CoverFlow.size());
m_btnMgr.setText(m_mainLblNotice, wfmt(_fmt("main7", L"Total Games: %i"), CoverFlow.size()));
m_btnMgr.show(m_mainLblNotice);
} }
int CMenu::main(void) int CMenu::main(void)
@ -577,6 +582,7 @@ int CMenu::main(void)
{ {
m_refreshGameList = false; m_refreshGameList = false;
_initCF(); _initCF();
_showTotalGames(CoverFlow.size());
} }
} }
else if(m_btnMgr.selected(m_mainBtnDVD)) else if(m_btnMgr.selected(m_mainBtnDVD))
@ -615,9 +621,7 @@ int CMenu::main(void)
m_favorites = !m_favorites; m_favorites = !m_favorites;
m_cfg.setBool(_domainFromView(), "favorites", m_favorites); m_cfg.setBool(_domainFromView(), "favorites", m_favorites);
_initCF(); _initCF();
m_showtimer = 240; _showTotalGames(CoverFlow.size());
m_btnMgr.setText(m_mainLblNotice, wfmt(_fmt("main7", L"Total Games: %i"), CoverFlow.size()));
m_btnMgr.show(m_mainLblNotice);
} }
else if(!CoverFlow.empty() && CoverFlow.select()) else if(!CoverFlow.empty() && CoverFlow.select())
{ {
@ -646,6 +650,7 @@ int CMenu::main(void)
{ {
m_refreshGameList = false; m_refreshGameList = false;
_initCF(); _initCF();
_showTotalGames(CoverFlow.size());
} }
else else
CoverFlow.cancel(); CoverFlow.cancel();