mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
Savestates: support game collections
This commit is contained in:
parent
219e3d61f8
commit
87cd65ff03
@ -1702,14 +1702,9 @@ void spu_thread::serialize_common(utils::serial& ar)
|
||||
ar(gpr, pc, ch_mfc_cmd, mfc_size, mfc_barrier, mfc_fence, mfc_prxy_cmd, mfc_prxy_mask, mfc_prxy_write_state.all
|
||||
, srr0, ch_tag_upd, ch_tag_mask, ch_tag_stat.data, ch_stall_mask, ch_stall_stat.data, ch_atomic_stat.data
|
||||
, ch_out_mbox.data, ch_out_intr_mbox.data, snr_config, ch_snr1.data, ch_snr2.data, ch_events.raw().all, interrupts_enabled
|
||||
, run_ctrl, exit_status.data, status_npc.raw().status);
|
||||
, run_ctrl, exit_status.data, status_npc.raw().status, ch_dec_start_timestamp, ch_dec_value, is_dec_frozen);
|
||||
|
||||
if (GET_SERIALIZATION_VERSION(spu) != 1)
|
||||
{
|
||||
ar(ch_dec_start_timestamp, ch_dec_value, is_dec_frozen);
|
||||
}
|
||||
|
||||
std::for_each_n(mfc_queue, mfc_size, [&](spu_mfc_cmd& cmd) { ar(cmd); });
|
||||
ar(std::span(mfc_queue, mfc_size));
|
||||
}
|
||||
|
||||
spu_thread::spu_thread(utils::serial& ar, lv2_spu_group* group)
|
||||
|
@ -452,20 +452,8 @@ namespace rsx
|
||||
ar(enable_second_vhandler, requested_vsync);
|
||||
ar(device_addr, label_addr, main_mem_size, local_mem_size, rsx_event_port, driver_info);
|
||||
ar(in_begin_end);
|
||||
|
||||
if (!ar.is_writing() && GET_SERIALIZATION_VERSION(rsx) <= 2)
|
||||
{
|
||||
// Used to be ZCULL information we can obtain by reading method registers
|
||||
ar.pos += 3;
|
||||
}
|
||||
|
||||
ar(display_buffers, display_buffers_count, current_display_buffer);
|
||||
|
||||
if (ar.is_writing() || GET_SERIALIZATION_VERSION(rsx) != 1)
|
||||
{
|
||||
ar(unsent_gcm_events);
|
||||
ar(rsx::method_registers.current_draw_clause);
|
||||
}
|
||||
ar(unsent_gcm_events, rsx::method_registers.current_draw_clause);
|
||||
}
|
||||
|
||||
thread::thread(utils::serial* _ar)
|
||||
|
@ -88,9 +88,9 @@ static std::array<serial_ver_t, 23> s_serial_versions;
|
||||
return ::s_serial_versions[identifier].current_version;\
|
||||
}
|
||||
|
||||
SERIALIZATION_VER(global_version, 0, 11) // For stuff not listed here
|
||||
SERIALIZATION_VER(global_version, 0, 12) // For stuff not listed here
|
||||
SERIALIZATION_VER(ppu, 1, 1)
|
||||
SERIALIZATION_VER(spu, 2, 1, 2)
|
||||
SERIALIZATION_VER(spu, 2, 1)
|
||||
SERIALIZATION_VER(lv2_sync, 3, 1)
|
||||
SERIALIZATION_VER(lv2_vm, 4, 1)
|
||||
SERIALIZATION_VER(lv2_net, 5, 1)
|
||||
@ -101,7 +101,7 @@ SERIALIZATION_VER(lv2_config, 9, 1)
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
SERIALIZATION_VER(rsx, 10, 1, 2, 3)
|
||||
SERIALIZATION_VER(rsx, 10, 1)
|
||||
}
|
||||
|
||||
namespace np
|
||||
@ -255,7 +255,12 @@ void init_fxo_for_exec(utils::serial* ar, bool full = false)
|
||||
Emu.GetCallbacks().init_pad_handler(Emu.GetTitleID());
|
||||
Emu.GetCallbacks().init_kb_handler();
|
||||
Emu.GetCallbacks().init_mouse_handler();
|
||||
if (ar) Emu.ExecDeserializationRemnants();
|
||||
|
||||
if (ar)
|
||||
{
|
||||
Emu.ExecDeserializationRemnants();
|
||||
ar->pos += 32; // Reserved area
|
||||
}
|
||||
}
|
||||
|
||||
void Emulator::Init(bool add_only)
|
||||
@ -859,6 +864,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
bool LE_format;
|
||||
bool state_inspection_support;
|
||||
nse_t<u64, 1> offset;
|
||||
std::array<u8, 32> reserved;
|
||||
};
|
||||
|
||||
const auto header = m_ar->try_read<file_header>().second;
|
||||
@ -911,15 +917,14 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
}
|
||||
|
||||
argv.clear();
|
||||
|
||||
std::string bdvd_by_title_id;
|
||||
(*m_ar)(argv.emplace_back(), bdvd_by_title_id);
|
||||
|
||||
klic.clear();
|
||||
|
||||
if (u128 key = m_ar->operator u128())
|
||||
std::string bdvd_by_title_id;
|
||||
(*m_ar)(argv.emplace_back(), bdvd_by_title_id, klic.emplace_back(), m_game_dir, hdd1);
|
||||
|
||||
if (!klic[0])
|
||||
{
|
||||
klic.emplace_back(key);
|
||||
klic.clear();
|
||||
}
|
||||
|
||||
if (!bdvd_by_title_id.empty())
|
||||
@ -938,8 +943,6 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
}
|
||||
}
|
||||
|
||||
hdd1 = m_ar->operator std::string();
|
||||
|
||||
auto load_tar = [&](const std::string& path)
|
||||
{
|
||||
const usz size = *m_ar;
|
||||
@ -960,7 +963,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
|
||||
for (const std::string hdd0_game = rpcs3::utils::get_hdd0_dir() + "game/";;)
|
||||
{
|
||||
const std::string game_data = m_ar->operator std::string();
|
||||
const std::string game_data = *m_ar;
|
||||
|
||||
if (game_data.empty())
|
||||
{
|
||||
@ -970,6 +973,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
load_tar(hdd0_game + game_data);
|
||||
}
|
||||
|
||||
m_ar->pos += 32; // Reserved area
|
||||
|
||||
if (argv[0].starts_with("/dev_hdd0"sv))
|
||||
{
|
||||
m_path = rpcs3::utils::get_hdd0_dir();
|
||||
@ -1000,6 +1005,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
{
|
||||
sys_log.error("Unknown source for savestates: %s", argv[0]);
|
||||
}
|
||||
|
||||
sys_log.notice("Restored executable path: \'%s\'", m_path);
|
||||
}
|
||||
|
||||
const std::string resolved_path = GetCallbacks().resolve_path(m_path);
|
||||
@ -1362,7 +1369,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
}
|
||||
}
|
||||
|
||||
if (bdvd_dir.empty() && !is_disc_patch)
|
||||
if (bdvd_dir.empty() && disc.empty() && !is_disc_patch)
|
||||
{
|
||||
// Reset original disc game dir if this is neither disc nor disc patch
|
||||
m_game_dir = "PS3_GAME";
|
||||
@ -1489,7 +1496,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
// Disc game
|
||||
bdvd_dir = disc;
|
||||
vfs::mount("/dev_bdvd", bdvd_dir);
|
||||
sys_log.notice("Disk: %s", vfs::get("/dev_bdvd"));
|
||||
vfs::mount("/dev_bdvd/PS3_GAME", bdvd_dir + m_game_dir);
|
||||
sys_log.notice("Disk: %s, Dir: %s", vfs::get("/dev_bdvd"), m_game_dir);
|
||||
}
|
||||
|
||||
if (add_only)
|
||||
@ -2426,14 +2434,18 @@ void Emulator::Kill(bool allow_autoexit, bool savestate)
|
||||
ar("RPCS3SAV"_u64);
|
||||
ar(std::endian::native == std::endian::little);
|
||||
ar(g_cfg.savestate.state_inspection_mode.get());
|
||||
ar(std::array<u8, 32>{}); // Reserved for future use
|
||||
ar(usz{0}); // Offset of versioning data, to be overwritten at the end of saving
|
||||
ar(argv[0]);
|
||||
ar(!m_title_id.empty() && !vfs::get("/dev_bdvd").empty() ? m_title_id : std::string());
|
||||
ar(klic.empty() ? std::array<u8, 16>{} : std::bit_cast<std::array<u8, 16>>(klic[0]));
|
||||
ar(m_game_dir);
|
||||
save_hdd1();
|
||||
save_hdd0();
|
||||
ar(std::array<u8, 32>{}); // Reserved for future use
|
||||
vm::save(ar);
|
||||
g_fxo->save(ar);
|
||||
ar(std::array<u8, 32>{}); // Reserved for future use
|
||||
ar(timestamp);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user