overlays: don't check for hdd dirs if we play a disc game

This commit is contained in:
Megamouse 2025-03-21 18:59:41 +01:00
parent 4c742f7742
commit b4f453f687
4 changed files with 8 additions and 39 deletions

View file

@ -364,11 +364,10 @@ namespace rsx
{
// Search for any useable background picture in the given order
game_content_type content_type = game_content_type::background_picture;
game_content_dir_type dir_type = game_content_dir_type::any;
for (game_content_type type : { game_content_type::background_picture, game_content_type::overlay_picture, game_content_type::content_icon })
{
if (const std::string picture_path = rpcs3::utils::get_game_content_path(type, dir_type); !picture_path.empty())
if (const std::string picture_path = rpcs3::utils::get_game_content_path(type); !picture_path.empty())
{
content_type = type;
background_image = std::make_unique<image_info>(picture_path);
@ -378,9 +377,9 @@ namespace rsx
}
// Search for an overlay picture in the same dir in case we found a real background picture
if (background_image && !background_overlay_image && content_type == game_content_type::background_picture && dir_type != game_content_dir_type::any)
if (background_image && !background_overlay_image && content_type == game_content_type::background_picture)
{
if (const std::string picture_path = rpcs3::utils::get_game_content_path(game_content_type::overlay_picture, dir_type); !picture_path.empty())
if (const std::string picture_path = rpcs3::utils::get_game_content_path(game_content_type::overlay_picture); !picture_path.empty())
{
background_overlay_image = std::make_unique<image_info>(picture_path);
dirty |= !!background_overlay_image->get_data();

View file

@ -340,7 +340,7 @@ namespace rpcs3::utils
return get_input_config_dir(title_id) + g_cfg_input_configs.default_config + ".yml";
}
std::string get_game_content_path(game_content_type type, game_content_dir_type& dir_type)
std::string get_game_content_path(game_content_type type)
{
const std::string locale_suffix = fmt::format("_%02d", static_cast<s32>(g_cfg.sys.language.get()));
const std::string disc_dir = vfs::get("/dev_bdvd/PS3_GAME");
@ -351,14 +351,11 @@ namespace rpcs3::utils
hdd0_dir.clear(); // No hdd0 dir
}
const bool is_disc_game = !disc_dir.empty();
const bool check_disc = is_disc_game && dir_type != game_content_dir_type::dev_hdd0;
const bool check_disc = !disc_dir.empty();
const bool check_hdd0 = !hdd0_dir.empty() && !check_disc;
const auto find_content = [&](const std::string& name, const std::string& extension) -> std::string
{
// ICON0.PNG is not supposed to be updateable, so we can ignore the hdd0 dir for disc games in that case
const bool check_hdd0 = !hdd0_dir.empty() && dir_type != game_content_dir_type::dev_bdvd && !(is_disc_game && name == "ICON0");
// Check localized content first
for (bool localized : { true, false })
{
@ -369,7 +366,6 @@ namespace rpcs3::utils
{
if (std::string path = hdd0_dir + filename; fs::is_file(path))
{
dir_type = game_content_dir_type::dev_hdd0;
return path;
}
}
@ -379,13 +375,11 @@ namespace rpcs3::utils
{
if (std::string path = disc_dir + filename; fs::is_file(path))
{
dir_type = game_content_dir_type::dev_bdvd;
return path;
}
}
}
dir_type = game_content_dir_type::any;
return {};
};
@ -414,7 +408,6 @@ namespace rpcs3::utils
// Try to find a custom background first
if (std::string path = fs::get_config_dir() + "/Icons/game_icons/" + Emu.GetTitleID() + "/PIC1.PNG"; fs::is_file(path))
{
dir_type = game_content_dir_type::any;
return path;
}
@ -423,7 +416,6 @@ namespace rpcs3::utils
}
}
dir_type = game_content_dir_type::any;
return {};
}
}

View file

@ -3,13 +3,6 @@
#include "util/types.hpp"
#include <string>
enum class game_content_dir_type
{
any, // Can also be used as none when returned
dev_hdd0, // HDD0 dir
dev_bdvd, // Disc dir
};
enum class game_content_type
{
content_icon, // ICON0.PNG
@ -48,5 +41,5 @@ namespace rpcs3::utils
std::string get_input_config_dir(const std::string& title_id = "");
std::string get_custom_input_config_path(const std::string& title_id);
std::string get_game_content_path(game_content_type type, game_content_dir_type& dir_type);
std::string get_game_content_path(game_content_type type);
}

View file

@ -897,8 +897,7 @@ void game_list_frame::OnRefreshFinished()
}
}
// ICON0.PNG is not supposed to be updateable, so we can ignore the hdd0 dir for disc games in that case
// Let's fetch it anyway if the path was empty for some reason
// Let's fetch the game data icon if the path was empty for some reason
if (entry->info.icon_path.empty())
{
if (std::string icon_path = other->info.path + "/" + localized_icon; fs::is_file(icon_path))
@ -910,20 +909,6 @@ void game_list_frame::OnRefreshFinished()
entry->info.icon_path = std::move(icon_path);
}
}
if (!entry->has_hover_gif)
{
if (std::string movie_path = other->info.path + "/" + localized_movie; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
entry->has_hover_pam = true;
}
else if (std::string movie_path = other->info.path + "/ICON1.PAM"; fs::is_file(movie_path))
{
entry->info.movie_path = std::move(movie_path);
entry->has_hover_pam = true;
}
}
}
}