diff --git a/rpcs3/Emu/Cell/Modules/cellSysCache.cpp b/rpcs3/Emu/Cell/Modules/cellSysCache.cpp index d077ff6213..0992985f20 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysCache.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysCache.cpp @@ -36,6 +36,21 @@ struct syscache_info syscache_info() noexcept { + // Check if dev_hdd1 is mounted by parent process + if (Emu.hdd1.size()) + { + const auto lock = init.init(); + + // Extract cache id from path + cache_id = Emu.hdd1; + if (cache_id.back() == '/') + cache_id.resize(cache_id.size() - 1); + cache_id = cache_id.substr(cache_id.find_last_of('/') + 1); + + LOG_SUCCESS(PPU, "Retained cache from parent process: %s", Emu.hdd1); + return; + } + // Find existing cache at startup const std::string prefix = Emu.GetTitleID() + '_'; diff --git a/rpcs3/Emu/Cell/lv2/sys_process.cpp b/rpcs3/Emu/Cell/lv2/sys_process.cpp index 4d812530b6..0649bb67d6 100644 --- a/rpcs3/Emu/Cell/lv2/sys_process.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_process.cpp @@ -290,6 +290,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr ar // TODO: set prio, flags std::string path = vfs::get(argv[0]); + std::string hdd1 = vfs::get("/dev_hdd1/"); std::string disc; if (Emu.GetCat() == "DG" || Emu.GetCat() == "GD") @@ -299,7 +300,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr ar vm::temporary_unlock(ppu); - Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = std::move(disc), klic = g_fxo->get()->devKlic]() mutable + Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = std::move(disc), hdd1 = std::move(hdd1), klic = g_fxo->get()->devKlic]() mutable { sys_process.success("Process finished -> %s", argv[0]); Emu.SetForceBoot(true); @@ -308,6 +309,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr ar Emu.envp = std::move(envp); Emu.data = std::move(data); Emu.disc = std::move(disc); + Emu.hdd1 = std::move(hdd1); if (klic != std::array{}) { diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 787e1d2f81..72d7f5370d 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1063,6 +1063,12 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa vfs::mount("/dev_usb000", fmt::replace_all(g_cfg.vfs.dev_usb000, "$(EmulatorDir)", emu_dir)); vfs::mount("/app_home", home_dir.empty() ? elf_dir + '/' : fmt::replace_all(home_dir, "$(EmulatorDir)", emu_dir)); + if (!hdd1.empty()) + { + vfs::mount("/dev_hdd1", hdd1); + LOG_NOTICE(LOADER, "Hdd1: %s", vfs::get("/dev_hdd1")); + } + // Special boot mode (directory scan) if (fs::is_dir(m_path)) { @@ -1823,6 +1829,7 @@ void Emulator::Stop(bool restart) data.clear(); disc.clear(); klic.clear(); + hdd1.clear(); m_force_boot = false; diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 628a643442..a6fd686e23 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -285,6 +285,7 @@ public: std::vector data; std::vector klic; std::string disc; + std::string hdd1; const std::string& GetBoot() const { @@ -420,7 +421,7 @@ struct cfg_root : cfg::node cfg::_bool hle_lwmutex{this, "HLE lwmutex"}; // Force alternative lwmutex/lwcond implementation cfg::_int<10, 1000> clocks_scale{this, "Clocks scale", 100}; // Changing this from 100 (percentage) may affect game speed in unexpected ways - cfg::_enum sleep_timers_accuracy{this, "Sleep Timers Accuracy", + cfg::_enum sleep_timers_accuracy{this, "Sleep Timers Accuracy", #ifdef __linux__ sleep_timers_accuracy_level::_as_host}; #else