Fix NPDRM exitspawn

This commit is contained in:
Nekotekina 2017-11-01 00:36:25 +03:00
parent 0e7e40f2cb
commit af107df0b4
3 changed files with 11 additions and 2 deletions

View File

@ -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<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 = 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<LoadedNpdrmKeys_t>()->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<sys_exit2_param> ar
Emu.envp = std::move(envp);
Emu.data = std::move(data);
Emu.disc = std::move(disc);
if (klic != std::array<u8, 16>{})
{
Emu.klic.assign(klic.begin(), klic.end());
}
Emu.BootGame(path, true);
if (Emu.IsReady() && !g_cfg.misc.autostart)

View File

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

View File

@ -215,6 +215,7 @@ public:
std::vector<std::string> argv;
std::vector<std::string> envp;
std::vector<u8> data;
std::vector<u8> klic;
std::string disc;
const std::string& GetBoot() const