diff --git a/rpcs3/Emu/Cell/lv2/sys_process.cpp b/rpcs3/Emu/Cell/lv2/sys_process.cpp index b708ac3c94..30b0233b9c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_process.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_process.cpp @@ -3,6 +3,7 @@ #include "Emu/System.h" #include "Emu/IdManager.h" +#include "Crypto/unedat.h" #include "Emu/Cell/ErrorCodes.h" #include "Emu/Cell/PPUThread.h" #include "sys_lwmutex.h" @@ -288,7 +289,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 = vfs::get("/dev_bdvd/")]() mutable + Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = vfs::get("/dev_bdvd/"), klic = fxm::get_always()->devKlic]() mutable { sys_process.success("Process finished -> %s", argv[0]); Emu.Stop(); @@ -296,6 +297,12 @@ 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); + + if (klic != std::array{}) + { + Emu.klic.assign(klic.begin(), klic.end()); + } + Emu.BootGame(path, true); if (Emu.IsReady() && !g_cfg.misc.autostart) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index b91ade726e..69f97ed22b 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -501,7 +501,7 @@ void Emulator::Load(bool add_only) else { // Decrypt SELF - elf_file = decrypt_self(std::move(elf_file)); + elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data()); if (fs::file elf_out{decrypted_path, fs::rewrite}) { @@ -847,6 +847,7 @@ void Emulator::Stop() envp.clear(); data.clear(); disc.clear(); + klic.clear(); } s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_info* sup2, u64 arg2) diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 970ebeee92..75b0590b4d 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -215,6 +215,7 @@ public: std::vector argv; std::vector envp; std::vector data; + std::vector klic; std::string disc; const std::string& GetBoot() const