CommonHostInterface: Prefer serial from database, not image

This commit is contained in:
Connor McLaughlin 2021-04-17 20:06:23 +10:00
parent 2ece7d19c1
commit 8ad0f78ef7
2 changed files with 7 additions and 5 deletions

View file

@ -2861,15 +2861,19 @@ void CommonHostInterface::GetGameInfo(const char* path, CDImage* image, std::str
} }
else else
{ {
if (image)
*code = System::GetGameCodeForImage(image, true);
GameDatabase database; GameDatabase database;
GameDatabaseEntry database_entry; GameDatabaseEntry database_entry;
if (database.Load() && database.GetEntryForDisc(image, &database_entry)) if (database.Load() && database.GetEntryForDisc(image, &database_entry))
{
*code = std::move(database_entry.serial);
*title = std::move(database_entry.title); *title = std::move(database_entry.title);
}
else else
{
*title = System::GetTitleForPath(path); *title = System::GetTitleForPath(path);
if (image)
*code = System::GetGameCodeForImage(image, true);
}
} }
} }

View file

@ -102,8 +102,6 @@ public:
const GameListEntry* GetEntryForPath(const char* path) const; const GameListEntry* GetEntryForPath(const char* path) const;
const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const; const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const;
bool GetGameCodeAndTitleFromDatabase(const char* path, std::string* code, std::string* title);
void SetCacheFilename(std::string filename) { m_cache_filename = std::move(filename); } void SetCacheFilename(std::string filename) { m_cache_filename = std::move(filename); }
void SetUserCompatibilityListFilename(std::string filename) void SetUserCompatibilityListFilename(std::string filename)