Skip to content

Commit c85105a

Browse files
committed
overlays: use get_game_content_path in BPM
1 parent 1d64418 commit c85105a

8 files changed

Lines changed: 29 additions & 20 deletions

rpcs3/Emu/RSX/Overlays/BigPicture/overlay_big_picture.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include "Emu/RSX/Overlays/overlays.h"
4-
#include "Emu/Cell/ErrorCodes.h"
54
#include "overlay_big_picture_main_menu.h"
65

76
namespace rsx

rpcs3/Emu/RSX/Overlays/BigPicture/overlay_big_picture_game_details.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "stdafx.h"
22
#include "overlay_big_picture_game_details.h"
3-
#include "Emu/RSX/Overlays/HomeMenu/overlay_home_menu_components.h"
3+
#include "Emu/system_utils.hpp"
44

55
namespace rsx
66
{
@@ -51,9 +51,7 @@ namespace rsx
5151

5252
m_info_text.set_text(fmt::format("%s\n%s\n%s", info.serial, info.category, info.app_ver));
5353

54-
const std::string game_dir = fs::get_parent_dir(info.icon_path);
55-
56-
if (const std::string pic1_path = game_dir + "/PIC1.PNG"; fs::is_file(pic1_path))
54+
if (const std::string pic1_path = rpcs3::utils::get_game_content_path(game_content_type::background_picture, info); !pic1_path.empty())
5755
{
5856
m_pic_data = std::make_unique<image_info>(pic1_path);
5957
// The renderer's texture cache is keyed by this object's address, which can be reused by an
@@ -71,9 +69,9 @@ namespace rsx
7169

7270
m_pic_background.refresh();
7371

74-
if (const std::string icon1_path = game_dir + "/ICON1.PAM"; fs::is_file(icon1_path))
72+
if (!info.movie_path.empty())
7573
{
76-
m_video = std::make_unique<video_view>(icon1_path, "", info.icon_path);
74+
m_video = std::make_unique<video_view>(info.movie_path, "", info.icon_path);
7775
m_video->set_pos(m_icon.x, m_icon.y);
7876
m_video->set_size(m_icon.w, m_icon.h);
7977
m_video->set_active(true);

rpcs3/Emu/RSX/Overlays/BigPicture/overlay_big_picture_game_grid.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,13 @@ namespace rsx
109109

110110
GameInfo info{};
111111
info.path = path;
112-
info.icon_path = sfo_dir + "/ICON0.PNG";
113112
info.serial = title_id;
114113
info.name = std::string(psf::get_string(psf, "TITLE", title_id));
115114
info.category = std::string(psf::get_string(psf, "CATEGORY"));
116115
info.app_ver = std::string(psf::get_string(psf, "APP_VER"));
116+
info.icon_path = rpcs3::utils::get_game_content_path(game_content_type::content_icon, info, sfo_dir);
117+
info.movie_path = rpcs3::utils::get_game_content_path(game_content_type::content_video, info, sfo_dir);
118+
info.audio_path = rpcs3::utils::get_game_content_path(game_content_type::content_sound, info, sfo_dir);
117119

118120
m_games.push_back({ std::move(info) });
119121
}

rpcs3/Emu/system_utils.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "system_config.h"
44
#include "vfs_config.h"
55
#include "Emu/Io/pad_config.h"
6+
#include "Emu/GameInfo.h"
67
#include "Emu/System.h"
78
#include "Emu/VFS.h"
89
#include "util/sysinfo.hpp"
@@ -594,19 +595,17 @@ namespace rpcs3::utils
594595
return get_input_config_dir(title_id) + g_cfg_input_configs.default_config + ".yml";
595596
}
596597

597-
std::string get_game_content_path(game_content_type type)
598+
std::string get_game_content_path(game_content_type type, const std::string& serial, std::string sfo_dir, const std::string& disc_dir)
598599
{
599600
const std::string locale_suffix = fmt::format("_%02d", static_cast<s32>(g_cfg.sys.language.get()));
600-
const std::string disc_dir = vfs::get("/dev_bdvd/PS3_GAME");
601-
std::string hdd0_dir = Emu.GetSfoDir(false);
602601

603-
if (hdd0_dir == disc_dir)
602+
if (sfo_dir == disc_dir)
604603
{
605-
hdd0_dir.clear(); // No hdd0 dir
604+
sfo_dir.clear(); // No hdd0 dir
606605
}
607606

608607
const bool check_disc = !disc_dir.empty();
609-
const bool check_hdd0 = !hdd0_dir.empty() && !check_disc;
608+
const bool check_hdd0 = !sfo_dir.empty() && !check_disc;
610609

611610
const auto find_content = [&](std::string_view name, std::string_view extension) -> std::string
612611
{
@@ -618,7 +617,7 @@ namespace rpcs3::utils
618617
// Check content on hdd0 first
619618
if (check_hdd0)
620619
{
621-
if (std::string path = hdd0_dir + filename; fs::is_file(path))
620+
if (std::string path = sfo_dir + filename; fs::is_file(path))
622621
{
623622
return path;
624623
}
@@ -660,7 +659,7 @@ namespace rpcs3::utils
660659
case game_content_type::background_picture_2:
661660
{
662661
// Try to find a custom background first
663-
if (std::string path = fs::get_config_dir() + "/Icons/game_icons/" + Emu.GetTitleID() + "/PIC1.PNG"; fs::is_file(path))
662+
if (std::string path = fs::get_config_dir() + "/Icons/game_icons/" + serial + "/PIC1.PNG"; fs::is_file(path))
664663
{
665664
return path;
666665
}
@@ -673,6 +672,16 @@ namespace rpcs3::utils
673672
return {};
674673
}
675674

675+
std::string get_game_content_path(game_content_type type, const GameInfo& info, const std::string& sfo_dir)
676+
{
677+
return get_game_content_path(type, info.serial, sfo_dir.empty() ? rpcs3::utils::get_sfo_dir_from_game_path(info.path, info.serial) : sfo_dir, {});
678+
}
679+
680+
std::string get_game_content_path(game_content_type type)
681+
{
682+
return get_game_content_path(type, Emu.GetTitleID(), Emu.GetSfoDir(false), vfs::get("/dev_bdvd/PS3_GAME"));
683+
}
684+
676685
bool version_is_bigger(std::string_view v0, std::string_view v1, std::string_view serial, bool is_fw)
677686
{
678687
std::add_pointer_t<char> ev0, ev1;

rpcs3/Emu/system_utils.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <set>
66
#include <vector>
77

8+
struct GameInfo;
9+
810
enum class game_content_type
911
{
1012
content_icon, // ICON0.PNG
@@ -85,6 +87,7 @@ namespace rpcs3::utils
8587
std::string get_input_config_dir(const std::string& title_id = "");
8688
std::string get_custom_input_config_path(const std::string& title_id);
8789

90+
std::string get_game_content_path(game_content_type type, const GameInfo& info, const std::string& sfo_dir = {});
8891
std::string get_game_content_path(game_content_type type);
8992

9093
bool version_is_bigger(std::string_view v0, std::string_view v1, std::string_view serial, bool is_fw);

rpcs3/rpcs3qt/game_compatibility.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
#include "Crypto/unpkg.h"
88
#include "Loader/PSF.h"
99

10-
#include <QApplication>
11-
#include <QMessageBox>
1210
#include <QJsonArray>
1311
#include <QJsonDocument>
12+
#include <QJsonObject>
1413

1514
LOG_CHANNEL(compat_log, "Compat");
1615

rpcs3/rpcs3qt/game_compatibility.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <memory>
66

7-
#include <QJsonObject>
7+
#include <QObject>
88

99
class downloader;
1010

rpcs3/rpcs3qt/gui_game_info.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "Emu/GameInfo.h"
77

8-
#include <set>
98
#include <QPixmap>
109

1110
/* Having the icons associated with the game info simplifies logic internally */

0 commit comments

Comments
 (0)