mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
DolphinWX: Fix sorting games by custom titles
The custom title reading code is moved so that custom titles are returned by GameListItem::GetName(). The comparison code is changed to use GetName() instead of GetName(DiscIO::IVolume::ELanguage). GetName(DiscIO::IVolume::ELanguage) must not return custom titles, because netplay relies on it returning the same name for all players.
This commit is contained in:
@ -83,13 +83,10 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
|
||||
sortData = -sortData;
|
||||
}
|
||||
|
||||
DiscIO::IVolume::ELanguage languageOne = SConfig::GetInstance().GetCurrentLanguage(iso1->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC);
|
||||
DiscIO::IVolume::ELanguage languageOther = SConfig::GetInstance().GetCurrentLanguage(iso2->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC);
|
||||
|
||||
switch (sortData)
|
||||
{
|
||||
case CGameListCtrl::COLUMN_TITLE:
|
||||
if (!strcasecmp(iso1->GetName(languageOne).c_str(), iso2->GetName(languageOther).c_str()))
|
||||
if (!strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()))
|
||||
{
|
||||
if (iso1->GetUniqueID() != iso2->GetUniqueID())
|
||||
return t * (iso1->GetUniqueID() > iso2->GetUniqueID() ? 1 : -1);
|
||||
@ -98,8 +95,7 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
|
||||
if (iso1->GetDiscNumber() != iso2->GetDiscNumber())
|
||||
return t * (iso1->GetDiscNumber() > iso2->GetDiscNumber() ? 1 : -1);
|
||||
}
|
||||
return strcasecmp(iso1->GetName(languageOne).c_str(),
|
||||
iso2->GetName(languageOther).c_str()) * t;
|
||||
return strcasecmp(iso1->GetName().c_str(), iso2->GetName().c_str()) * t;
|
||||
case CGameListCtrl::COLUMN_MAKER:
|
||||
return strcasecmp(iso1->GetCompany().c_str(), iso2->GetCompany().c_str()) * t;
|
||||
case CGameListCtrl::COLUMN_ID:
|
||||
@ -388,46 +384,6 @@ 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())
|
||||
{
|
||||
std::string line;
|
||||
|
||||
if (!std::getline(titlestxt, line) && titlestxt.eof())
|
||||
break;
|
||||
|
||||
const size_t equals_index = line.find('=');
|
||||
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(StripSpaces(line.substr(equals_index + 1)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
titlestxt.close();
|
||||
}
|
||||
|
||||
std::string title;
|
||||
IniFile gameini = SConfig::LoadGameIni(rISOFile.GetUniqueID(), rISOFile.GetRevision());
|
||||
if (gameini.GetIfExists("EmuState", "Title", &title))
|
||||
name = StrToWxStr(title);
|
||||
|
||||
int disc_number = rISOFile.GetDiscNumber() + 1;
|
||||
if (disc_number > 1 && name.Lower().find(wxString::Format("disc %i", disc_number)) == std::string::npos
|
||||
&& name.Lower().find(wxString::Format("disc%i", disc_number)) == std::string::npos)
|
||||
|
Reference in New Issue
Block a user