diff --git a/rpcs3/rpcs3qt/game_list_base.cpp b/rpcs3/rpcs3qt/game_list_base.cpp index edae4e51f6..4bc26e0ee4 100644 --- a/rpcs3/rpcs3qt/game_list_base.cpp +++ b/rpcs3/rpcs3qt/game_list_base.cpp @@ -49,7 +49,7 @@ void game_list_base::IconLoadFunction(game_info game, qreal device_pixel_ratio, static std::unordered_set warn_once_list; static shared_mutex s_mtx; - if (game->icon.isNull() && !gui::utils::load_icon(game->icon, game->info.icon_path, game->icon_in_archive ? game->info.path : "")) + if (game->icon.isNull() && !gui::utils::load_icon(game->icon, game->info.icon_path, game->icon_in_archive ? game->info.path : "", game->info.game_dir)) { if (game_list_log.warning) { diff --git a/rpcs3/rpcs3qt/qt_utils.cpp b/rpcs3/rpcs3qt/qt_utils.cpp index 84de92d692..948906fa97 100644 --- a/rpcs3/rpcs3qt/qt_utils.cpp +++ b/rpcs3/rpcs3qt/qt_utils.cpp @@ -705,7 +705,7 @@ namespace gui return QString("%1 days ago %2").arg(current_date - exctrated_date).arg(date.toString(fmt_relative)); } - bool load_iso_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path) + bool load_iso_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path, const std::string& game_dir) { if (icon_path.empty() || archive_path.empty()) return false; @@ -716,7 +716,9 @@ namespace gui // With the exception of raw device, check cache first — avoids constructing a full iso_archive just for the icon. iso_metadata_cache_entry cache_entry{}; - if (!is_raw_device && iso_cache::load(archive_path, archive_path, cache_entry) && !cache_entry.icon_data.empty()) + const std::string cache_key = game_dir.empty() ? archive_path : archive_path + "//" + game_dir; + + if (!is_raw_device && iso_cache::load(archive_path, cache_key, cache_entry) && !cache_entry.icon_data.empty()) { const QByteArray data(reinterpret_cast(cache_entry.icon_data.data()), static_cast(cache_entry.icon_data.size())); @@ -736,7 +738,7 @@ namespace gui return icon.loadFromData(data); } - bool load_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path) + bool load_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path, const std::string& game_dir) { if (icon_path.empty()) return false; @@ -745,7 +747,7 @@ namespace gui return icon.load(QString::fromStdString(icon_path)); } - return load_iso_icon(icon, icon_path, archive_path); + return load_iso_icon(icon, icon_path, archive_path, game_dir); } QString format_timestamp(s64 time, const QString& fmt) diff --git a/rpcs3/rpcs3qt/qt_utils.h b/rpcs3/rpcs3qt/qt_utils.h index 22e94109ef..64c98e1079 100644 --- a/rpcs3/rpcs3qt/qt_utils.h +++ b/rpcs3/rpcs3qt/qt_utils.h @@ -193,10 +193,10 @@ namespace gui } // Loads an icon from an (ISO) archive file. - bool load_iso_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path); + bool load_iso_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path, const std::string& game_dir = {}); // Loads an icon (optionally from an (ISO) archive file). - bool load_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path); + bool load_icon(QPixmap& icon, const std::string& icon_path, const std::string& archive_path, const std::string& game_dir = {}); template void stop_future_watcher(QFutureWatcher& watcher, bool cancel, std::shared_ptr> cancel_flag = nullptr)