From 795e234c6fe8f978c736b1434001e92ab2420b92 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sun, 23 Oct 2022 13:13:11 +0300 Subject: [PATCH] game list: Silence some warning --- rpcs3/rpcs3qt/game_list_frame.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 5a5b9728d4..dc255c2c4e 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -22,6 +22,7 @@ #include "Loader/PSF.h" #include "util/types.hpp" #include "Utilities/File.h" +#include "Utilities/mutex.h" #include "util/yaml.hpp" #include "Input/pad_thread.h" @@ -30,6 +31,7 @@ #include #include #include +#include #include #include @@ -2187,10 +2189,26 @@ void game_list_frame::RepaintIcons(const bool& from_settings) const std::function func = [this](const game_info& game) -> movie_item* { + static std::unordered_set warn_once_list; + static shared_mutex s_mtx; + if (game->icon.isNull() && (game->info.icon_path.empty() || !game->icon.load(qstr(game->info.icon_path)))) { - game_list_log.warning("Could not load image from path %s", sstr(QDir(qstr(game->info.icon_path)).absolutePath())); + if (game_list_log.warning) + { + bool logged = false; + { + std::lock_guard lock(s_mtx); + logged = !warn_once_list.emplace(game->info.icon_path).second; + } + + if (!logged) + { + game_list_log.warning("Could not load image from path %s", sstr(QDir(qstr(game->info.icon_path)).absolutePath())); + } + } } + const QColor color = getGridCompatibilityColor(game->compat.color); game->pxmap = PaintedPixmap(game->icon, game->hasCustomConfig, game->hasCustomPadConfig, color); return game->item;