From 1d2f6404c6eb086d1ceb52aca9ce31296b5647f4 Mon Sep 17 00:00:00 2001 From: Functionable <40835042+Functionable@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:36:43 +0000 Subject: [PATCH] ISO: Fix for save states --- rpcs3/Emu/System.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 006c0264c3..f7659af23a 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -783,7 +783,7 @@ bool Emulator::BootRsxCapture(const std::string& path) std::unique_ptr frame = std::make_unique(); utils::serial load; load.set_reading_state(); - + const std::string lower = fmt::to_lower(path); if (lower.ends_with(".gz") || lower.ends_with(".zst")) @@ -1408,6 +1408,10 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, m_path = rpcs3::utils::get_hdd1_dir(); m_path += std::string_view(argv[0]).substr(9); } + else if (is_file_iso(argv[0])) + { + m_path = argv[0]; + } else { sys_log.error("Unknown source for path redirection: %s", argv[0]); @@ -1818,6 +1822,10 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch, sys_log.error("Failed to move disc game %s to '%s' (%s)", m_title_id, dst_dir, fs::g_tls_error); return game_boot_result::wrong_disc_location; } + else if (launching_from_disc_archive) + { + bdvd_dir = iso_device::virtual_device_name + "/"; + } } if (bdvd_dir.empty() && disc.empty() && !is_disc_patch) @@ -3405,7 +3413,7 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s { if (spu.first->pc != spu.second || spu.first->unsavable) { - std::string dump; + std::string dump; spu.first->dump_all(dump); sys_log.error("SPU thread continued after being paused. (old_pc=0x%x, pc=0x%x, unsavable=%d)", spu.second, spu.first->pc, spu.first->unsavable); @@ -3583,7 +3591,17 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s ar(std::array{}); // Reserved for future use - if (auto dir = vfs::get("/dev_bdvd/PS3_GAME"); fs::is_dir(dir) && !fs::is_file(fs::get_parent_dir(dir) + "/PS3_DISC.SFB")) + // Game mounted from archive + if (m_path.starts_with(iso_device::virtual_device_name + "/")) + { + auto device = fs::get_virtual_device(iso_device::virtual_device_name + "/"); + ensure(device); + + auto iso_device = dynamic_cast(device.get()); + ar(iso_device->get_loaded_iso()); + ar(m_title_id); + } + else if (auto dir = vfs::get("/dev_bdvd/PS3_GAME"); fs::is_dir(dir) && !fs::is_file(fs::get_parent_dir(dir) + "/PS3_DISC.SFB")) { // Fake /dev_bdvd/PS3_GAME detected, use HDD0 for m_path restoration ensure(vfs::unmount("/dev_bdvd/PS3_GAME"));