mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
GameList: Prioritize game title cover image over database title
This commit is contained in:
parent
6e7f1501b5
commit
90997d4a8b
|
@ -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<u32>(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<u32>(file_title.size()));
|
||||
cover_path.AppendCharacter('.');
|
||||
cover_path.AppendString(extension);
|
||||
if (FileSystem::FileExists(cover_path))
|
||||
return std::string(cover_path.GetCharArray());
|
||||
}
|
||||
}
|
||||
|
||||
return std::string();
|
||||
|
|
Loading…
Reference in a new issue