GUI/Qt: Prioritize serial in cover lookup

This commit is contained in:
refractionpcsx2 2022-05-27 11:03:10 +01:00
parent ce53b7adb1
commit c70afc24bd
1 changed files with 12 additions and 11 deletions

View File

@ -683,7 +683,17 @@ std::string GameList::GetCoverImagePath(const std::string& path, const std::stri
std::string cover_path;
for (const char* extension : extensions)
{
// use the file title if it differs (e.g. modded games)
// Prioritize lookup by serial (Most specific)
if (!serial.empty())
{
const std::string cover_filename(serial + extension);
cover_path = Path::Combine(EmuFolders::Covers, cover_filename);
if (FileSystem::FileExists(cover_path.c_str()))
return cover_path;
}
// Try file title (for modded games or specific like above)
const std::string_view file_title(Path::GetFileTitle(path));
if (!file_title.empty() && title != file_title)
{
@ -695,7 +705,7 @@ std::string GameList::GetCoverImagePath(const std::string& path, const std::stri
return cover_path;
}
// try the title
// Last resort, check the game title
if (!title.empty())
{
const std::string cover_filename(title + extension);
@ -703,15 +713,6 @@ std::string GameList::GetCoverImagePath(const std::string& path, const std::stri
if (FileSystem::FileExists(cover_path.c_str()))
return cover_path;
}
// then the code
if (!serial.empty())
{
const std::string cover_filename(serial + extension);
cover_path = Path::Combine(EmuFolders::Covers, cover_filename);
if (FileSystem::FileExists(cover_path.c_str()))
return cover_path;
}
}
cover_path.clear();