From 412e46b712f993989845fcf072215ced26345d8e Mon Sep 17 00:00:00 2001 From: Erik Kunze Date: Sat, 16 Jul 2022 14:08:50 +0200 Subject: [PATCH 1/2] This change causes the display of the number of games to reappear whenever it changes by filter (category, favourite). --- source/menu/menu.hpp | 1 + source/menu/menu_main.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 76a728ae..a16f4087 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -1061,6 +1061,7 @@ private: // void _showError(void); void _showMain(void); + void _showTotalGames(const int numberOfGames); void _showConfigCommon(const TexData & bg, int page); void _showConfig(void); void _showConfig3(void); diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 7d3678a4..00453693 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -121,6 +121,13 @@ void CMenu::_showMain() _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) { m_refreshGameList = false; @@ -345,9 +352,7 @@ void CMenu::_showCF(bool refreshList) if(m_sourceflow || m_current_view == COVERFLOW_HOMEBREW) return; - m_showtimer = 240; - m_btnMgr.setText(m_mainLblNotice, wfmt(_fmt("main7", L"Total Games: %i"), CoverFlow.size())); - m_btnMgr.show(m_mainLblNotice); + _showTotalGames(CoverFlow.size()); } int CMenu::main(void) @@ -577,6 +582,7 @@ int CMenu::main(void) { m_refreshGameList = false; _initCF(); + _showTotalGames(CoverFlow.size()); } } else if(m_btnMgr.selected(m_mainBtnDVD)) @@ -615,6 +621,7 @@ int CMenu::main(void) m_favorites = !m_favorites; m_cfg.setBool(_domainFromView(), "favorites", m_favorites); _initCF(); + _showTotalGames(CoverFlow.size()); } else if(!CoverFlow.empty() && CoverFlow.select()) { @@ -643,6 +650,7 @@ int CMenu::main(void) { m_refreshGameList = false; _initCF(); + _showTotalGames(CoverFlow.size()); } else CoverFlow.cancel(); From 6e3669ae65ec2198ad9d9923894002c5263cf7ea Mon Sep 17 00:00:00 2001 From: Erik Kunze Date: Mon, 8 Aug 2022 20:23:23 +0200 Subject: [PATCH 2/2] Make use of GamesTDB for ScummVM titles to get localisation of the title. --- source/list/ListGenerator.cpp | 30 +++++++++++++++++++++++++----- source/menu/menu.cpp | 1 + 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/source/list/ListGenerator.cpp b/source/list/ListGenerator.cpp index db7f059e..f86a9eaf 100644 --- a/source/list/ListGenerator.cpp +++ b/source/list/ListGenerator.cpp @@ -280,7 +280,7 @@ static void Add_Plugin_Game(char *FullPath) } if(romID.empty()) romID = "PLUGIN"; - //gprintf("romID=%s\n", romID.c_str()); + gprintf("Add_Plugin_Game: romID='%s'\n", romID.c_str()); /* add rom to list */ memset((void*)&ListElement, 0, sizeof(dir_discHdr)); @@ -312,7 +312,6 @@ static void Add_Plugin_Game(char *FullPath) 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 usually short without any '/' */ /* 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; if(platform != NULL) + { 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(); while(1) { if(strlen(GameDomain) < 2) 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)); - 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) { 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)); 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); + ListElement.settings[0] = m_cacheList.Magic; //scummvm magic ListElement.casecolor = m_cacheList.Color; ListElement.type = TYPE_PLUGIN; @@ -380,6 +399,7 @@ void ListGenerator::ParseScummvmINI(Config &ini, const char *Device, const char GameDomain = ini.nextDomain().c_str(); } m_crc.unload(); + CloseConfigs(); if(!this->empty() && !DBName.empty()) /* Write a new Cache */ CCache(*this, DBName, SAVE); } diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index b205a836..5f2eae4b 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -2589,6 +2589,7 @@ bool CMenu::_loadPluginList() platformName = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord); m_cacheList.Color = m_plugin.GetCaseColor(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); for(vector::iterator tmp_itr = m_cacheList.begin(); tmp_itr != m_cacheList.end(); tmp_itr++) m_gameList.push_back(*tmp_itr);