cellSysCache: keep mounted /dev_hdd1 after exitspawn

This commit is contained in:
Nekotekina 2019-11-08 23:24:13 +03:00
parent 7072489a6e
commit e0bc276205
4 changed files with 27 additions and 2 deletions

View file

@ -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() + '_';

View file

@ -290,6 +290,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> 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<sys_exit2_param> 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<loaded_npdrm_keys>()->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<loaded_npdrm_keys>()->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<sys_exit2_param> 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<u8, 16>{})
{

View file

@ -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;

View file

@ -285,6 +285,7 @@ public:
std::vector<u8> data;
std::vector<u8> 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_level> sleep_timers_accuracy{this, "Sleep Timers Accuracy",
cfg::_enum<sleep_timers_accuracy_level> sleep_timers_accuracy{this, "Sleep Timers Accuracy",
#ifdef __linux__
sleep_timers_accuracy_level::_as_host};
#else