mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-01 04:51:49 +01:00
Qt: Properly use ICON1.PAM from game data dir if available
Fixes hover movie for disc games that have game data installed.
This commit is contained in:
parent
c245637c38
commit
a97bad97ae
@ -7,6 +7,7 @@ struct GameInfo
|
|||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string icon_path;
|
std::string icon_path;
|
||||||
|
std::string movie_path;
|
||||||
|
|
||||||
std::string name = "Unknown";
|
std::string name = "Unknown";
|
||||||
std::string serial = "Unknown";
|
std::string serial = "Unknown";
|
||||||
@ -22,13 +23,4 @@ struct GameInfo
|
|||||||
u32 resolution = 0;
|
u32 resolution = 0;
|
||||||
|
|
||||||
u64 size_on_disk = umax;
|
u64 size_on_disk = umax;
|
||||||
|
|
||||||
std::string get_pam_path() const
|
|
||||||
{
|
|
||||||
if (icon_path.empty())
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return icon_path.substr(0, icon_path.find_last_of("/")) + "/ICON1.PAM";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -473,9 +473,9 @@ void game_list_frame::OnParsingFinished()
|
|||||||
sort(m_path_entries.begin(), m_path_entries.end(), [](const path_entry& l, const path_entry& r){return l.path < r.path;});
|
sort(m_path_entries.begin(), m_path_entries.end(), [](const path_entry& l, const path_entry& r){return l.path < r.path;});
|
||||||
m_path_entries.erase(unique(m_path_entries.begin(), m_path_entries.end(), [](const path_entry& l, const path_entry& r){return l.path == r.path;}), m_path_entries.end());
|
m_path_entries.erase(unique(m_path_entries.begin(), m_path_entries.end(), [](const path_entry& l, const path_entry& r){return l.path == r.path;}), m_path_entries.end());
|
||||||
|
|
||||||
const std::string game_icon_path = m_play_hover_movies ? fs::get_config_dir() + "/Icons/game_icons/" : "";
|
const std::string game_icon_path = fs::get_config_dir() + "/Icons/game_icons/";
|
||||||
|
|
||||||
const auto add_game = [this, dev_flash, cat_unknown_localized = sstr(localized.category.unknown), cat_unknown = sstr(cat::cat_unknown), game_icon_path](const std::string& dir_or_elf)
|
const auto add_game = [this, dev_flash, cat_unknown_localized = sstr(localized.category.unknown), cat_unknown = sstr(cat::cat_unknown), game_icon_path, _hdd, play_hover_movies = m_play_hover_movies, show_custom_icons = m_show_custom_icons](const std::string& dir_or_elf)
|
||||||
{
|
{
|
||||||
GameInfo game{};
|
GameInfo game{};
|
||||||
game.path = dir_or_elf;
|
game.path = dir_or_elf;
|
||||||
@ -535,20 +535,27 @@ void game_list_frame::OnParsingFinished()
|
|||||||
game.bootable = psf::get_integer(psf, "BOOTABLE", 0);
|
game.bootable = psf::get_integer(psf, "BOOTABLE", 0);
|
||||||
game.attr = psf::get_integer(psf, "ATTRIBUTE", 0);
|
game.attr = psf::get_integer(psf, "ATTRIBUTE", 0);
|
||||||
game.icon_path = sfo_dir + "/ICON0.PNG";
|
game.icon_path = sfo_dir + "/ICON0.PNG";
|
||||||
|
game.movie_path = sfo_dir + "/ICON1.PAM";
|
||||||
|
|
||||||
if (game.category == "DG")
|
if (game.category == "DG")
|
||||||
{
|
{
|
||||||
std::string latest_icon = rpcs3::utils::get_hdd0_dir() + "game/" + game.serial + "/ICON0.PNG";
|
const std::string game_data_dir = _hdd + "game/" + game.serial;
|
||||||
if (fs::is_file(latest_icon))
|
|
||||||
|
if (std::string latest_icon = game_data_dir + "/ICON0.PNG"; fs::is_file(latest_icon))
|
||||||
{
|
{
|
||||||
game.icon_path = std::move(latest_icon);
|
game.icon_path = std::move(latest_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (std::string latest_movie = game_data_dir + "/ICON1.PAM"; fs::is_file(latest_movie))
|
||||||
|
{
|
||||||
|
game.movie_path = std::move(latest_movie);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_show_custom_icons)
|
if (show_custom_icons)
|
||||||
{
|
{
|
||||||
if (std::string icon_path = fs::get_config_dir() + "/Icons/game_icons/" + game.serial + "/ICON0.PNG"; fs::is_file(icon_path))
|
if (std::string icon_path = game_icon_path + game.serial + "/ICON0.PNG"; fs::is_file(icon_path))
|
||||||
{
|
{
|
||||||
game.icon_path = std::move(icon_path);
|
game.icon_path = std::move(icon_path);
|
||||||
}
|
}
|
||||||
@ -614,7 +621,13 @@ void game_list_frame::OnParsingFinished()
|
|||||||
info.hasCustomConfig = fs::is_file(rpcs3::utils::get_custom_config_path(info.info.serial));
|
info.hasCustomConfig = fs::is_file(rpcs3::utils::get_custom_config_path(info.info.serial));
|
||||||
info.hasCustomPadConfig = fs::is_file(rpcs3::utils::get_custom_input_config_path(info.info.serial));
|
info.hasCustomPadConfig = fs::is_file(rpcs3::utils::get_custom_input_config_path(info.info.serial));
|
||||||
info.has_hover_gif = fs::is_file(game_icon_path + info.info.serial + "/hover.gif");
|
info.has_hover_gif = fs::is_file(game_icon_path + info.info.serial + "/hover.gif");
|
||||||
info.has_hover_pam = fs::is_file(info.info.get_pam_path());
|
info.has_hover_pam = fs::is_file(info.info.movie_path);
|
||||||
|
|
||||||
|
// Free some memory
|
||||||
|
if (!info.has_hover_pam)
|
||||||
|
{
|
||||||
|
info.info.movie_path.clear();
|
||||||
|
}
|
||||||
|
|
||||||
m_games.push(std::make_shared<gui_game_info>(std::move(info)));
|
m_games.push(std::make_shared<gui_game_info>(std::move(info)));
|
||||||
};
|
};
|
||||||
|
@ -107,7 +107,7 @@ void game_list_grid::populate(
|
|||||||
}
|
}
|
||||||
else if (play_hover_movies && game->has_hover_pam)
|
else if (play_hover_movies && game->has_hover_pam)
|
||||||
{
|
{
|
||||||
item->set_movie_path(QString::fromStdString(game->info.get_pam_path()));
|
item->set_movie_path(QString::fromStdString(game->info.movie_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_item_id == game->info.path + game->info.icon_path)
|
if (selected_item_id == game->info.path + game->info.icon_path)
|
||||||
|
@ -289,7 +289,7 @@ void game_list_table::populate(
|
|||||||
}
|
}
|
||||||
else if (play_hover_movies && game->has_hover_pam)
|
else if (play_hover_movies && game->has_hover_pam)
|
||||||
{
|
{
|
||||||
icon_item->set_movie_path(QString::fromStdString(game->info.get_pam_path()));
|
icon_item->set_movie_path(QString::fromStdString(game->info.movie_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
icon_item->setData(Qt::UserRole, index, true);
|
icon_item->setData(Qt::UserRole, index, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user