From ae83c28bc8ae78196ddf5e3ccd5b52e336858f37 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 17 Mar 2025 13:06:21 +0100 Subject: [PATCH] Qt: Simplify hover movie code --- rpcs3/rpcs3qt/game_list_frame.cpp | 25 +++++++++++++------------ rpcs3/rpcs3qt/game_list_grid.cpp | 7 +------ rpcs3/rpcs3qt/game_list_table.cpp | 7 +------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 698ffc6bfb..b46ef985dd 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -666,18 +666,20 @@ void game_list_frame::OnParsingFinished() } } - game.has_hover_gif = fs::is_file(game_icon_path + game.info.serial + "/hover.gif"); - - if (!game.has_hover_gif && game.info.movie_path.empty()) + if (std::string movie_path = game_icon_path + game.info.serial + "/hover.gif"; fs::is_file(movie_path)) { - if (std::string movie_path = sfo_dir + "/" + localized_movie; fs::is_file(movie_path)) - { - game.info.movie_path = std::move(movie_path); - } - else if (std::string movie_path = sfo_dir + "/ICON1.PAM"; fs::is_file(movie_path)) - { - game.info.movie_path = std::move(movie_path); - } + game.info.movie_path = std::move(movie_path); + game.has_hover_gif = true; + } + else if (std::string movie_path = sfo_dir + "/" + localized_movie; fs::is_file(movie_path)) + { + game.info.movie_path = std::move(movie_path); + game.has_hover_pam = true; + } + else if (std::string movie_path = sfo_dir + "/ICON1.PAM"; fs::is_file(movie_path)) + { + game.info.movie_path = std::move(movie_path); + game.has_hover_pam = true; } const QString serial = QString::fromStdString(game.info.serial); @@ -735,7 +737,6 @@ void game_list_frame::OnParsingFinished() game.compat = m_game_compat->GetCompatibility(game.info.serial); game.has_custom_config = fs::is_file(rpcs3::utils::get_custom_config_path(game.info.serial)); game.has_custom_pad_config = fs::is_file(rpcs3::utils::get_custom_input_config_path(game.info.serial)); - game.has_hover_pam = !game.info.movie_path.empty(); m_games.push(std::make_shared(std::move(game))); }; diff --git a/rpcs3/rpcs3qt/game_list_grid.cpp b/rpcs3/rpcs3qt/game_list_grid.cpp index 5b6e4c3410..fa71407bd1 100644 --- a/rpcs3/rpcs3qt/game_list_grid.cpp +++ b/rpcs3/rpcs3qt/game_list_grid.cpp @@ -48,7 +48,6 @@ void game_list_grid::populate( { clear_list(); - const QString game_icon_path = play_hover_movies ? QString::fromStdString(fs::get_config_dir() + "/Icons/game_icons/") : ""; game_list_grid_item* selected_item = nullptr; blockSignals(true); @@ -109,11 +108,7 @@ void game_list_grid::populate( } }); - if (play_hover_movies && game->has_hover_gif) - { - item->set_movie_path(game_icon_path % serial % "/hover.gif"); - } - else if (play_hover_movies && game->has_hover_pam) + if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam)) { item->set_movie_path(QString::fromStdString(game->info.movie_path)); } diff --git a/rpcs3/rpcs3qt/game_list_table.cpp b/rpcs3/rpcs3qt/game_list_table.cpp index 49aa7962eb..a1b0f06b86 100644 --- a/rpcs3/rpcs3qt/game_list_table.cpp +++ b/rpcs3/rpcs3qt/game_list_table.cpp @@ -216,7 +216,6 @@ void game_list_table::populate( const QLocale locale{}; const Localized localized; - const QString game_icon_path = play_hover_movies ? QString::fromStdString(fs::get_config_dir() + "/Icons/game_icons/") : ""; const std::string dev_flash = g_cfg_vfs.get_dev_flash(); int row = 0; @@ -292,11 +291,7 @@ void game_list_table::populate( } }); - if (play_hover_movies && game->has_hover_gif) - { - icon_item->set_movie_path(game_icon_path % serial % "/hover.gif"); - } - else if (play_hover_movies && game->has_hover_pam) + if (play_hover_movies && (game->has_hover_gif || game->has_hover_pam)) { icon_item->set_movie_path(QString::fromStdString(game->info.movie_path)); }