summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/GameFile.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2019-02-23 17:49:06 +0100
committerJosJuice <josjuice@gmail.com>2019-02-25 19:54:25 +0100
commit8842a0f402ffe60a80ce7894bfd36afd039009fc (patch)
tree63b17123d1238eeca41754711dd186a3c48689cc /Source/Core/UICommon/GameFile.cpp
parentd27036eb77a7cde0beea1760773dfd046dd2ca10 (diff)
Keep track of GameTDB ID separately from game ID
The difference between Dolphin's game IDs and GameTDB's game IDs is that GameTDB uses four characters for non-disc titles, whereas Dolphin uses six characters for all titles. This fixes: - TitleDatabase considering Datel discs to be NHL Hitz 2002 - Gecko code downloading not working for discs with IDs starting with P - Cover downloading mixing up discs with channels (e.g. Mario Kart Wii and Mario Kart Channel) and making extra HTTP requests. (Android was actually doing a better job at this than DolphinQt!)
Diffstat (limited to 'Source/Core/UICommon/GameFile.cpp')
-rw-r--r--Source/Core/UICommon/GameFile.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp
index d7cc55e2b7..ed62d69ce4 100644
--- a/Source/Core/UICommon/GameFile.cpp
+++ b/Source/Core/UICommon/GameFile.cpp
@@ -132,6 +132,7 @@ GameFile::GameFile(const std::string& path)
m_internal_name = volume->GetInternalName();
m_game_id = volume->GetGameID();
+ m_gametdb_id = volume->GetGameTDBID();
m_title_id = volume->GetTitleID().value_or(0);
m_maker_id = volume->GetMakerID();
m_revision = volume->GetRevision().value_or(0);
@@ -198,9 +199,8 @@ void GameFile::DownloadDefaultCover()
const auto cover_path = File::GetUserPath(D_COVERCACHE_IDX) + DIR_SEP;
- // If covers have already been downloaded, abort
- if (File::Exists(cover_path + m_game_id + ".png") ||
- File::Exists(cover_path + m_game_id.substr(0, 4) + ".png"))
+ // If the cover has already been downloaded, abort
+ if (File::Exists(cover_path + m_gametdb_id + ".png"))
return;
Common::HttpRequest request;
@@ -249,22 +249,13 @@ void GameFile::DownloadDefaultCover()
break;
}
- auto response = request.Get(StringFromFormat(COVER_URL, region_code.c_str(), m_game_id.c_str()));
+ auto response =
+ request.Get(StringFromFormat(COVER_URL, region_code.c_str(), m_gametdb_id.c_str()));
if (response)
{
File::WriteStringToFile(std::string(response.value().begin(), response.value().end()),
- cover_path + m_game_id + ".png");
- return;
- }
-
- response =
- request.Get(StringFromFormat(COVER_URL, region_code.c_str(), m_game_id.substr(0, 4).c_str()));
-
- if (response)
- {
- File::WriteStringToFile(std::string(response.value().begin(), response.value().end()),
- cover_path + m_game_id.substr(0, 4) + ".png");
+ cover_path + m_gametdb_id + ".png");
}
}
@@ -277,10 +268,7 @@ bool GameFile::DefaultCoverChanged()
std::string contents;
- File::ReadFileToString(cover_path + m_game_id + ".png", contents);
-
- if (contents.empty())
- File::ReadFileToString(cover_path + m_game_id.substr(0, 4).c_str() + ".png", contents);
+ File::ReadFileToString(cover_path + m_gametdb_id + ".png", contents);
if (contents.empty())
return false;
@@ -328,6 +316,7 @@ void GameFile::DoState(PointerWrap& p)
p.Do(m_descriptions);
p.Do(m_internal_name);
p.Do(m_game_id);
+ p.Do(m_gametdb_id);
p.Do(m_title_id);
p.Do(m_maker_id);
@@ -433,10 +422,7 @@ void GameFile::CustomBannerCommit()
const std::string& GameFile::GetName(const Core::TitleDatabase& title_database) const
{
- const auto type = m_platform == DiscIO::Platform::WiiWAD ?
- Core::TitleDatabase::TitleType::Channel :
- Core::TitleDatabase::TitleType::Other;
- const std::string& custom_name = title_database.GetTitleName(m_game_id, type);
+ const std::string& custom_name = title_database.GetTitleName(m_gametdb_id);
return custom_name.empty() ? GetName() : custom_name;
}