GameList: Use title name based on console language (#388)

This commit is contained in:
MythicalPlayz 2022-10-21 00:17:11 +02:00 committed by GitHub
parent dd1cb1cccf
commit c217b3ee32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 2 deletions

View File

@ -705,7 +705,13 @@ namespace CafeSystem
{ {
if (sLaunchModeIsStandalone) if (sLaunchModeIsStandalone)
return "Unknown Game"; return "Unknown Game";
return sGameInfo_ForegroundTitle.GetBase().GetMetaInfo()->GetShortName(GetConfig().console_language); std::string applicationName;
applicationName = sGameInfo_ForegroundTitle.GetBase().GetMetaInfo()->GetShortName(GetConfig().console_language);
if (applicationName.empty()) //Try to get the English Title
applicationName = sGameInfo_ForegroundTitle.GetBase().GetMetaInfo()->GetShortName(CafeConsoleLanguage::EN);
if (applicationName.empty()) //Unknown Game
applicationName = "Unknown Game";
return applicationName;
} }
std::string GetForegroundTitleArgStr() std::string GetForegroundTitleArgStr()

View File

@ -589,7 +589,15 @@ std::string TitleInfo::GetTitleName() const
{ {
cemu_assert_debug(m_isValid); cemu_assert_debug(m_isValid);
if (m_parsedMetaXml) if (m_parsedMetaXml)
return m_parsedMetaXml->GetShortName(CafeConsoleLanguage::EN); {
std::string titleNameCfgLanguage;
titleNameCfgLanguage = m_parsedMetaXml->GetShortName(GetConfig().console_language);
if (titleNameCfgLanguage.empty()) //Get English Title
titleNameCfgLanguage = m_parsedMetaXml->GetShortName(CafeConsoleLanguage::EN);
if (titleNameCfgLanguage.empty()) //Unknown Title
titleNameCfgLanguage = "Unknown Title";
return titleNameCfgLanguage;
}
if (m_cachedInfo) if (m_cachedInfo)
return m_cachedInfo->titleName; return m_cachedInfo->titleName;
cemu_assert_suspicious(); cemu_assert_suspicious();

View File

@ -931,6 +931,8 @@ void MainWindow::OnConsoleLanguage(wxCommandEvent& event)
default: default:
cemu_assert_debug(false); cemu_assert_debug(false);
} }
m_game_list->DeleteCachedStrings();
m_game_list->ReloadGameEntries(false);
g_config.Save(); g_config.Save();
} }

View File

@ -1139,3 +1139,8 @@ bool wxGameList::QueryIconForTitle(TitleId titleId, int& icon, int& iconSmall)
m_icon_cache_mtx.unlock(); m_icon_cache_mtx.unlock();
return true; return true;
} }
void wxGameList::DeleteCachedStrings()
{
m_name_cache.clear();
}

View File

@ -50,6 +50,7 @@ public:
bool IsVisible(long item) const; // only available in wxwidgets 3.1.3 bool IsVisible(long item) const; // only available in wxwidgets 3.1.3
void ReloadGameEntries(bool cached = false); void ReloadGameEntries(bool cached = false);
void DeleteCachedStrings();
long FindListItemByTitleId(uint64 title_id) const; long FindListItemByTitleId(uint64 title_id) const;
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);