From c2bbcdd16c015e47a18cd0193fca69c821108685 Mon Sep 17 00:00:00 2001 From: Stevoisiak Date: Thu, 19 Mar 2015 22:37:41 -0400 Subject: [PATCH 1/3] Read custom titles from wiitdb.txt if titles.txt is not found --- Source/Core/DolphinWX/GameListCtrl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 1b967a5f7c..5983238240 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -388,9 +388,16 @@ void CGameListCtrl::InsertItemInReportView(long _Index) wxString name = StrToWxStr(rISOFile.GetName()); + // Attempt to load game titles from titles.txt + // http://www.gametdb.com/Wii/Downloads std::ifstream titlestxt; OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "titles.txt", std::ios::in); + if (!titlestxt.is_open()) + { + OpenFStream(titlestxt, File::GetUserPath(D_LOAD_IDX) + "wiitdb.txt", std::ios::in); + } + if (titlestxt.is_open() && rISOFile.GetUniqueID().size() > 3) { while (!titlestxt.eof()) From 90167abe0fb7a3dd0ec142096dff14efef192685 Mon Sep 17 00:00:00 2001 From: Stevoisiak Date: Sat, 21 Mar 2015 17:31:29 -0400 Subject: [PATCH 2/3] Improve parsing custom game titles from titles.txt Read game ID based on position of the "=" sign, rather than assuming game IDs are 6 characters in length. --- Source/Core/DolphinWX/GameListCtrl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 5983238240..f997b2a9e7 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -407,9 +407,10 @@ void CGameListCtrl::InsertItemInReportView(long _Index) if (!std::getline(titlestxt, line) && titlestxt.eof()) break; - if (line.substr(0,rISOFile.GetUniqueID().size()) == rISOFile.GetUniqueID()) + const size_t equals_index = line.find('='); + if (line.substr(0, equals_index - 1) == rISOFile.GetUniqueID()) { - name = StrToWxStr(line.substr(rISOFile.GetUniqueID().size() + 3)); + name = StrToWxStr(line.substr(equals_index + 2)); break; } } From afc1398fbd46a3b9d04eb0aab186b3d944c8becb Mon Sep 17 00:00:00 2001 From: Stevoisiak Date: Sun, 22 Mar 2015 19:48:52 -0400 Subject: [PATCH 3/3] Fix reading custom titles from WAD files --- Source/Core/DolphinWX/GameListCtrl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index f997b2a9e7..7e2f769e90 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -408,9 +408,15 @@ void CGameListCtrl::InsertItemInReportView(long _Index) break; const size_t equals_index = line.find('='); - if (line.substr(0, equals_index - 1) == rISOFile.GetUniqueID()) + std::string game_id = rISOFile.GetUniqueID(); + + // Ignore publisher ID for WAD files + if (rISOFile.GetPlatform() == DiscIO::IVolume::WII_WAD) + game_id.erase(game_id.size() - 2); + + if (line.substr(0, equals_index - 1) == game_id) { - name = StrToWxStr(line.substr(equals_index + 2)); + name = StrToWxStr(StripSpaces(line.substr(equals_index + 1))); break; } }