Loader: handle fs::file is Null fatal after decrypt self

This commit is contained in:
Megamouse 2018-06-22 10:49:40 +02:00
parent 3ed98be6cd
commit ab84a67511

View file

@ -1099,11 +1099,9 @@ void Emulator::Load(bool add_only)
{ {
elf_file.open(decrypted_path); elf_file.open(decrypted_path);
} }
else // Decrypt SELF
else if (elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data()))
{ {
// Decrypt SELF
elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data());
if (fs::file elf_out{decrypted_path, fs::rewrite}) if (fs::file elf_out{decrypted_path, fs::rewrite})
{ {
elf_out.write(elf_file.to_vector<u8>()); elf_out.write(elf_file.to_vector<u8>());
@ -1117,16 +1115,17 @@ void Emulator::Load(bool add_only)
} }
} }
ppu_exec_object ppu_exec;
ppu_prx_object ppu_prx;
spu_exec_object spu_exec;
if (!elf_file) if (!elf_file)
{ {
LOG_ERROR(LOADER, "Failed to decrypt SELF: %s", elf_path); LOG_ERROR(LOADER, "Failed to decrypt SELF: %s", elf_path);
return; return;
} }
else if (ppu_exec.open(elf_file) == elf_error::ok)
ppu_exec_object ppu_exec;
ppu_prx_object ppu_prx;
spu_exec_object spu_exec;
if (ppu_exec.open(elf_file) == elf_error::ok)
{ {
// PS3 executable // PS3 executable
m_state = system_state::ready; m_state = system_state::ready;