diff --git a/src/frontend-common/game_list.cpp b/src/frontend-common/game_list.cpp index 84c65c9be..838638db6 100644 --- a/src/frontend-common/game_list.cpp +++ b/src/frontend-common/game_list.cpp @@ -1151,6 +1151,22 @@ std::string GameList::GetCoverImagePathForEntry(const GameListEntry* entry) cons PathString cover_path; for (const char* extension : extensions) { + // use the file title if it differs (e.g. modded games) + const std::string_view file_title = System::GetTitleForPath(entry->path.c_str()); + if (!file_title.empty() && entry->title != file_title) + { + cover_path.Clear(); + cover_path.AppendString(g_host_interface->GetUserDirectory().c_str()); + cover_path.AppendCharacter(FS_OSPATH_SEPERATOR_CHARACTER); + cover_path.AppendString("covers"); + cover_path.AppendCharacter(FS_OSPATH_SEPERATOR_CHARACTER); + cover_path.AppendString(file_title.data(), static_cast(file_title.size())); + cover_path.AppendCharacter('.'); + cover_path.AppendString(extension); + if (FileSystem::FileExists(cover_path)) + return std::string(cover_path.GetCharArray()); + } + // try the title if (!entry->title.empty()) { @@ -1168,22 +1184,6 @@ std::string GameList::GetCoverImagePathForEntry(const GameListEntry* entry) cons if (FileSystem::FileExists(cover_path)) return std::string(cover_path.GetCharArray()); } - - // and the file title if it differs - const std::string_view file_title = System::GetTitleForPath(entry->path.c_str()); - if (!file_title.empty() && entry->title != file_title) - { - cover_path.Clear(); - cover_path.AppendString(g_host_interface->GetUserDirectory().c_str()); - cover_path.AppendCharacter(FS_OSPATH_SEPERATOR_CHARACTER); - cover_path.AppendString("covers"); - cover_path.AppendCharacter(FS_OSPATH_SEPERATOR_CHARACTER); - cover_path.AppendString(file_title.data(), static_cast(file_title.size())); - cover_path.AppendCharacter('.'); - cover_path.AppendString(extension); - if (FileSystem::FileExists(cover_path)) - return std::string(cover_path.GetCharArray()); - } } return std::string();