@@ -2026,28 +2026,29 @@ void GameList::ReloadMemcardTimestampCache()
20262026 entry.serial [sizeof (entry.serial ) - 1 ] = 0 ;
20272027}
20282028
2029- std::string GameList::GetGameIconPath (std::string_view serial, std::string_view path, u32 achievements_game_id )
2029+ std::string GameList::GetGameIconPath (const GameList::Entry* entry )
20302030{
20312031 std::string ret;
20322032
20332033 std::string fallback_path;
2034- if (achievements_game_id != 0 )
2034+ if (entry-> achievements_game_id != 0 )
20352035 {
2036- fallback_path = GetAchievementGameBadgePath (achievements_game_id);
2036+ fallback_path = GetAchievementGameBadgePath (entry-> achievements_game_id );
20372037 if (!fallback_path.empty () && PreferAchievementGameBadgesForIcons ())
20382038 return (ret = std::move (fallback_path));
20392039 }
20402040
2041- if (serial.empty ())
2041+ if (entry-> serial .empty ())
20422042 return (ret = std::move (fallback_path));
20432043
20442044 // might exist already, or the user used a custom icon
2045- ret = Path::Combine (EmuFolders::GameIcons, TinyString::from_format (" {}.png" , serial));
2045+ ret = Path::Combine (EmuFolders::GameIcons, TinyString::from_format (" {}.png" , entry-> serial ));
20462046 if (FileSystem::FileExists (ret.c_str ()))
20472047 return ret;
20482048
20492049 MemoryCardType type;
2050- std::string memcard_path = System::GetGameMemoryCardPath (serial, path, 0 , &type);
2050+ std::string memcard_path =
2051+ System::GetGameMemoryCardPath (entry->title , entry->has_custom_title , entry->serial , entry->path , 0 , &type);
20512052 FILESYSTEM_STAT_DATA memcard_sd;
20522053 if (memcard_path.empty () || type == MemoryCardType::Shared ||
20532054 !FileSystem::StatFile (memcard_path.c_str (), &memcard_sd))
@@ -2057,33 +2058,33 @@ std::string GameList::GetGameIconPath(std::string_view serial, std::string_view
20572058
20582059 const s64 timestamp = memcard_sd.ModificationTime ;
20592060 TinyString index_serial;
2060- index_serial.assign (
2061- serial. substr ( 0 , std::min<size_t >(serial.length (), MemcardTimestampCacheEntry::MAX_SERIAL_LENGTH - 1 )));
2061+ index_serial.assign (entry-> serial . substr (
2062+ 0 , std::min<size_t >(entry-> serial .length (), MemcardTimestampCacheEntry::MAX_SERIAL_LENGTH - 1 )));
20622063
2063- MemcardTimestampCacheEntry* serial_entry = nullptr ;
2064- for (MemcardTimestampCacheEntry& entry : s_state.memcard_timestamp_cache_entries )
2064+ MemcardTimestampCacheEntry* cache_entry = nullptr ;
2065+ for (MemcardTimestampCacheEntry& it : s_state.memcard_timestamp_cache_entries )
20652066 {
2066- if (StringUtil::EqualNoCase (index_serial, entry .serial ))
2067+ if (StringUtil::EqualNoCase (index_serial, it .serial ))
20672068 {
20682069 // user might've deleted the file, so re-extract it if so
20692070 // otherwise, card hasn't changed, still no icon
2070- if (entry .memcard_timestamp == timestamp && !entry .icon_was_extracted )
2071+ if (it .memcard_timestamp == timestamp && !it .icon_was_extracted )
20712072 return (ret = std::move (fallback_path));
20722073
2073- serial_entry = &entry ;
2074+ cache_entry = &it ;
20742075 break ;
20752076 }
20762077 }
20772078
2078- if (!serial_entry )
2079+ if (!cache_entry )
20792080 {
2080- serial_entry = &s_state.memcard_timestamp_cache_entries .emplace_back ();
2081- std::memset (serial_entry , 0 , sizeof (MemcardTimestampCacheEntry));
2081+ cache_entry = &s_state.memcard_timestamp_cache_entries .emplace_back ();
2082+ std::memset (cache_entry , 0 , sizeof (MemcardTimestampCacheEntry));
20822083 }
20832084
2084- serial_entry ->memcard_timestamp = timestamp;
2085- serial_entry ->icon_was_extracted = false ;
2086- StringUtil::Strlcpy (serial_entry ->serial , index_serial.view (), sizeof (serial_entry ->serial ));
2085+ cache_entry ->memcard_timestamp = timestamp;
2086+ cache_entry ->icon_was_extracted = false ;
2087+ StringUtil::Strlcpy (cache_entry ->serial , index_serial.view (), sizeof (cache_entry ->serial ));
20872088
20882089 // Try extracting an icon.
20892090 Error error;
@@ -2105,8 +2106,8 @@ std::string GameList::GetGameIconPath(std::string_view serial, std::string_view
21052106 for (size_t i = 0 ; i < fi.icon_frames .size (); i++)
21062107 image.SetPixels (static_cast <u32 >(i), fi.icon_frames [i].pixels , MemoryCardImage::ICON_WIDTH * sizeof (u32 ));
21072108
2108- serial_entry ->icon_was_extracted = image.SaveToFile (ret.c_str (), AnimatedImage::DEFAULT_SAVE_QUALITY, &error);
2109- if (serial_entry ->icon_was_extracted )
2109+ cache_entry ->icon_was_extracted = image.SaveToFile (ret.c_str (), AnimatedImage::DEFAULT_SAVE_QUALITY, &error);
2110+ if (cache_entry ->icon_was_extracted )
21102111 return ret;
21112112 else
21122113 ERROR_LOG (" Failed to save memory card icon to {}: {}" , Path::GetFileName (ret), error.GetDescription ());
@@ -2118,7 +2119,7 @@ std::string GameList::GetGameIconPath(std::string_view serial, std::string_view
21182119 ERROR_LOG (" Failed to load memory card '{}': {}" , Path::GetFileName (memcard_path), error.GetDescription ());
21192120 }
21202121
2121- UpdateMemcardTimestampCache (*serial_entry );
2122+ UpdateMemcardTimestampCache (*cache_entry );
21222123 return (ret = std::move (fallback_path));
21232124}
21242125
0 commit comments