summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/GameFile.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2019-02-23 19:18:16 +0100
committerJosJuice <josjuice@gmail.com>2019-02-25 19:55:46 +0100
commit9df763b4acd8857fdcd3a919d4bd9ce6f4447e53 (patch)
treebbe1b7bd28b7620f735fdd78411decae859f16ca /Source/Core/UICommon/GameFile.cpp
parent8842a0f402ffe60a80ce7894bfd36afd039009fc (diff)
TitleDatabase: Don't merge multiple languages into same map
Instead of selecting languages based on the user config at the time of TitleDatabase creation and merging the different languages into one map for GC and one map for Wii, have one map for each language, and have the caller supply the language they want. This makes us not need the IsGCTitle function, which is inaccurate for IDs that start with D.
Diffstat (limited to 'Source/Core/UICommon/GameFile.cpp')
-rw-r--r--Source/Core/UICommon/GameFile.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp
index ed62d69ce4..b963450cc7 100644
--- a/Source/Core/UICommon/GameFile.cpp
+++ b/Source/Core/UICommon/GameFile.cpp
@@ -50,7 +50,7 @@ static const std::string EMPTY_STRING;
static bool UseGameCovers()
{
// We ifdef this out on Android because accessing the config before emulation start makes us crash.
-// The Android GUI doesn't support covers anyway, so this doesn't make us lose out on functionality.
+// The Android GUI handles covers in Java anyway, so this doesn't make us lose any functionality.
#ifdef ANDROID
return false;
#else
@@ -58,6 +58,17 @@ static bool UseGameCovers()
#endif
}
+DiscIO::Language GameFile::GetConfigLanguage() const
+{
+#ifdef ANDROID
+ // TODO: Make the Android app load the config at app start instead of emulation start
+ // so that we can access the user's preference here
+ return DiscIO::Language::English;
+#else
+ return SConfig::GetInstance().GetCurrentLanguage(DiscIO::IsWii(m_platform));
+#endif
+}
+
bool operator==(const GameBanner& lhs, const GameBanner& rhs)
{
return std::tie(lhs.buffer, lhs.width, lhs.height) == std::tie(rhs.buffer, rhs.width, rhs.height);
@@ -94,15 +105,7 @@ const std::string& GameFile::Lookup(DiscIO::Language language,
const std::string&
GameFile::LookupUsingConfigLanguage(const std::map<DiscIO::Language, std::string>& strings) const
{
-#ifdef ANDROID
- // TODO: Make the Android app load the config at app start instead of emulation start
- // so that we can access the user's preference here
- const DiscIO::Language language = DiscIO::Language::English;
-#else
- const bool wii = DiscIO::IsWii(m_platform);
- const DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(wii);
-#endif
- return Lookup(language, strings);
+ return Lookup(GetConfigLanguage(), strings);
}
GameFile::GameFile(const std::string& path)
@@ -422,7 +425,7 @@ void GameFile::CustomBannerCommit()
const std::string& GameFile::GetName(const Core::TitleDatabase& title_database) const
{
- const std::string& custom_name = title_database.GetTitleName(m_gametdb_id);
+ const std::string& custom_name = title_database.GetTitleName(m_gametdb_id, GetConfigLanguage());
return custom_name.empty() ? GetName() : custom_name;
}