From c70afc24bdb182c542d7d87a747a3970c44911e1 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Fri, 27 May 2022 11:03:10 +0100 Subject: [PATCH] GUI/Qt: Prioritize serial in cover lookup --- pcsx2/Frontend/GameList.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pcsx2/Frontend/GameList.cpp b/pcsx2/Frontend/GameList.cpp index dcbdbc3fff..10c8e0cfda 100644 --- a/pcsx2/Frontend/GameList.cpp +++ b/pcsx2/Frontend/GameList.cpp @@ -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();