Skip to content

Commit 677e13d

Browse files
committed
overlays: Fix iso media path loading
1 parent e04198e commit 677e13d

26 files changed

Lines changed: 206 additions & 77 deletions

rpcs3/Emu/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ target_sources(rpcs3_emu PRIVATE
522522
RSX/Overlays/BigPicture/overlay_big_picture.cpp
523523
RSX/Overlays/BigPicture/overlay_big_picture_game_details.cpp
524524
RSX/Overlays/BigPicture/overlay_big_picture_game_grid.cpp
525+
RSX/Overlays/BigPicture/overlay_big_picture_game_info.cpp
525526
RSX/Overlays/BigPicture/overlay_big_picture_main_menu.cpp
526527
RSX/Overlays/Network/overlay_recvmessage_dialog.cpp
527528
RSX/Overlays/Network/overlay_sendmessage_dialog.cpp

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ namespace rsx
4444
m_back_hint.set_pos(x + 40 + 120 + 20, y + height - 80);
4545
}
4646

47-
void big_picture_game_details::show(const GameInfo& info, const image_info* icon_data)
47+
void big_picture_game_details::show(const big_picture_game_info& info, const image_info* icon_data)
4848
{
4949
m_title.set_text(info.name.empty() ? info.serial : info.name);
5050
m_title.auto_resize(false, m_w - 80);
5151

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

54-
if (const std::string pic1_path = rpcs3::utils::get_game_content_path(game_content_type::background_picture, info); !pic1_path.empty())
54+
if (const auto res = rpcs3::utils::get_game_content_path(game_content_type::background_picture, info); !res.first.empty())
5555
{
56-
m_pic_data = std::make_unique<image_info>(pic1_path);
56+
m_pic_data = info.load_icon(res.first, res.second);
5757
// The renderer's texture cache is keyed by this object's address, which can be reused by an
5858
// unrelated image after the old one is freed - force a re-upload instead of trusting the cache.
5959
m_pic_data->dirty = true;
@@ -71,7 +71,7 @@ namespace rsx
7171

7272
if (!info.movie_path.empty())
7373
{
74-
m_video = std::make_unique<video_view>(info.movie_path, info.audio_path, info.icon_path);
74+
m_video = std::make_unique<video_view>(info);
7575
m_video->set_pos(m_icon.x, m_icon.y);
7676
m_video->set_size(m_icon.w, m_icon.h);
7777
m_video->set_active(true);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "Emu/RSX/Overlays/overlays.h"
44
#include "Emu/RSX/Overlays/overlay_controls.h"
55
#include "Emu/RSX/Overlays/overlay_video.h"
6-
#include "Emu/GameInfo.h"
6+
#include "overlay_big_picture_game_info.h"
77

88
namespace rsx
99
{
@@ -22,7 +22,7 @@ namespace rsx
2222
start
2323
};
2424

25-
void show(const GameInfo& info, const image_info* icon_data);
25+
void show(const big_picture_game_info& info, const image_info* icon_data);
2626
void hide();
2727
bool is_visible() const { return m_visible; }
2828

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "stdafx.h"
22
#include "overlay_big_picture_game_grid.h"
33
#include "overlay_big_picture_game_details.h"
4-
#include "Emu/System.h"
54
#include "Emu/system_config.h"
65
#include "Utilities/Thread.h"
76

@@ -11,7 +10,7 @@ namespace rsx
1110
{
1211
namespace overlays
1312
{
14-
big_picture_game_tile::big_picture_game_tile(const big_picture_game_entry& entry, u16 tile_width)
13+
big_picture_game_tile::big_picture_game_tile(const big_picture_game_info& entry, u16 tile_width)
1514
{
1615
pack_padding = 8;
1716
back_color.a = 0.f;
@@ -22,9 +21,9 @@ namespace rsx
2221
icon->set_size(tile_width, icon_h);
2322
icon->back_color = color4f(1.f, 1.f, 1.f, 0.08f);
2423

25-
if (fs::exists(entry.icon_path))
24+
if (auto icon_data = entry.load_icon())
2625
{
27-
m_icon_data = std::make_unique<image_info>(entry.icon_path);
26+
m_icon_data = std::move(icon_data);
2827
// The renderer's texture cache is keyed by this object's address, which can be reused by an
2928
// unrelated image after the old one is freed - force a re-upload instead of trusting the cache.
3029
m_icon_data->dirty = true;
@@ -119,7 +118,7 @@ namespace rsx
119118
m_game_enumeration.remove_duplicates();
120119

121120
// Parse entries (multithreaded)
122-
const std::vector<game_enumeration<big_picture_game_entry>::path_entry>& entries = m_game_enumeration.path_entries();
121+
const std::vector<game_enumeration<big_picture_game_info>::path_entry>& entries = m_game_enumeration.path_entries();
123122
usz thread_count = std::min<usz>(utils::get_thread_count(), entries.size());
124123
map_workload("BPM Parser "sv, thread_count, entries.size(), [this, &entries](usz index)
125124
{
@@ -131,7 +130,7 @@ namespace rsx
131130
m_game_enumeration.apply_patches();
132131

133132
// Get final enumerated games
134-
for (big_picture_game_entry& game : m_game_enumeration.take_games())
133+
for (big_picture_game_info& game : m_game_enumeration.take_games())
135134
{
136135
if (!game.bootable) continue; // Let's restrict this to bootable entries
137136

@@ -142,7 +141,7 @@ namespace rsx
142141
m_game_enumeration.clear(true);
143142

144143
// Sort by name
145-
std::sort(m_games.begin(), m_games.end(), [](const big_picture_game_entry& a, const big_picture_game_entry& b)
144+
std::sort(m_games.begin(), m_games.end(), [](const big_picture_game_info& a, const big_picture_game_info& b)
146145
{
147146
return a.name < b.name;
148147
});
@@ -288,7 +287,7 @@ namespace rsx
288287
case big_picture_game_details::result::start:
289288
{
290289
rsx_log.notice("Big Picture Mode: Start pressed for index=%d", m_selected_index);
291-
const big_picture_game_entry& info = m_games[m_selected_index];
290+
const big_picture_game_info& info = m_games[m_selected_index];
292291
rsx_log.notice("Big Picture Mode: selected game path='%s' serial='%s'", info.path, info.serial);
293292
m_details->hide();
294293
if (m_on_game_selected)

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "Emu/RSX/Overlays/HomeMenu/overlay_home_menu_page.h"
44
#include "Emu/game_enumeration.h"
5-
#include "Emu/GameInfo.h"
5+
#include "overlay_big_picture_game_info.h"
66

77
#include <functional>
88

@@ -12,14 +12,10 @@ namespace rsx
1212
{
1313
struct big_picture_game_details;
1414

15-
struct big_picture_game_entry : public GameInfo
16-
{
17-
};
18-
1915
// A single selectable tile (icon + title) inside the game grid.
2016
struct big_picture_game_tile : public vertical_layout
2117
{
22-
big_picture_game_tile(const big_picture_game_entry& entry, u16 tile_width);
18+
big_picture_game_tile(const big_picture_game_info& entry, u16 tile_width);
2319

2420
// PS3 ICON0.PNG is always 320x176 - keep tiles at that exact aspect ratio instead of stretching it.
2521
static constexpr u16 icon_height(u16 tile_width) { return static_cast<u16>(tile_width * 176 / 320); }
@@ -56,8 +52,8 @@ namespace rsx
5652
std::mutex m_reload_mutex;
5753
std::unique_ptr<named_thread<std::function<void()>>> m_game_enumeration_thread;
5854

59-
game_enumeration<big_picture_game_entry> m_game_enumeration;
60-
std::vector<big_picture_game_entry> m_games;
55+
game_enumeration<big_picture_game_info> m_game_enumeration;
56+
std::vector<big_picture_game_info> m_games;
6157
std::vector<big_picture_game_tile*> m_tiles; // non-owning, owned by m_grid
6258
std::unique_ptr<vertical_layout> m_grid;
6359
std::unique_ptr<label> m_placeholder_text;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "stdafx.h"
2+
#include "overlay_big_picture_game_info.h"
3+
#include "Emu/RSX/Overlays/overlay_controls.h"
4+
5+
namespace rsx
6+
{
7+
namespace overlays
8+
{
9+
std::unique_ptr<image_info> big_picture_game_info::load_icon(const std::string& icon_path, bool in_archive) const
10+
{
11+
return image_info::load_icon(icon_path, in_archive ? path : "");
12+
}
13+
14+
std::unique_ptr<image_info> big_picture_game_info::load_icon() const
15+
{
16+
return image_info::load_icon(icon_path, icon_in_archive ? path : "");
17+
}
18+
}
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pragma once
2+
3+
#include "Emu/GameInfo.h"
4+
5+
namespace rsx
6+
{
7+
namespace overlays
8+
{
9+
struct image_info;
10+
11+
struct big_picture_game_info : public GameInfo
12+
{
13+
std::unique_ptr<image_info> load_icon(const std::string& icon_path, bool in_archive) const;
14+
std::unique_ptr<image_info> load_icon() const;
15+
};
16+
}
17+
}

rpcs3/Emu/RSX/Overlays/overlay_audio.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@ namespace rsx
66
{
77
namespace overlays
88
{
9-
audio_player::audio_player(const std::string& audio_path)
9+
audio_player::audio_player(const std::string& audio_path, bool audio_in_archive, const std::string& iso_path)
1010
{
11-
init_audio(audio_path);
11+
init_audio(audio_path, audio_in_archive, iso_path);
1212
}
1313

14-
void audio_player::init_audio(const std::string& audio_path)
14+
void audio_player::init_audio(const std::string& audio_path, bool audio_in_archive, const std::string& iso_path)
1515
{
1616
if (audio_path.empty()) return;
1717

1818
m_video_source = ensure(Emu.GetCallbacks().make_video_source());
19-
m_video_source->set_audio_path(audio_path);
19+
m_video_source->set_audio_path(audio_path, audio_in_archive);
20+
21+
if (audio_in_archive)
22+
{
23+
m_video_source->set_iso_path(iso_path);
24+
}
2025
}
2126

2227
void audio_player::set_active(bool active)

rpcs3/Emu/RSX/Overlays/overlay_audio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespace rsx
99
class audio_player
1010
{
1111
public:
12-
audio_player(const std::string& audio_path);
12+
audio_player(const std::string& audio_path, bool audio_in_archive, const std::string& iso_path);
1313
~audio_player() = default;
1414

1515
void set_active(bool active);
1616

1717
private:
18-
void init_audio(const std::string& audio_path);
18+
void init_audio(const std::string& audio_path, bool audio_in_archive, const std::string& iso_path);
1919

2020
std::unique_ptr<video_source> m_video_source;
2121
};

rpcs3/Emu/RSX/Overlays/overlay_controls.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "Utilities/geometry.h"
77
#include "Utilities/File.h"
88
#include "Emu/Cell/timers.hpp"
9+
#include "Loader/ISO.h"
910

1011
#include <numbers>
1112

@@ -143,6 +144,34 @@ namespace rsx
143144
}
144145
}
145146

147+
std::unique_ptr<image_info> image_info::load_icon(const std::string& icon_path, const std::string& archive_path)
148+
{
149+
if (icon_path.empty()) return nullptr;
150+
151+
if (archive_path.empty())
152+
{
153+
if (!fs::exists(icon_path)) return nullptr;
154+
return std::make_unique<image_info>(icon_path);
155+
}
156+
157+
const bool is_archive = is_iso_file(archive_path);
158+
if (!is_archive) return nullptr;
159+
160+
iso_archive archive(archive_path);
161+
if (!archive.exists(icon_path)) return nullptr;
162+
163+
auto icon_file = archive.open(icon_path);
164+
if (!icon_file) return nullptr;
165+
166+
const auto icon_size = icon_file->size();
167+
if (icon_size == 0) return nullptr;
168+
169+
std::vector<u8> data(icon_size);
170+
icon_file->read(data.data(), icon_size);
171+
172+
return std::make_unique<image_info>(data);
173+
}
174+
146175
resource_config::resource_config()
147176
{
148177
}

0 commit comments

Comments
 (0)