PPU: Precompile only encrypted executeables

Improve sys_prx_load_module and sys_overlay_load_module error checking.
This commit is contained in:
Eladash 2023-09-02 20:07:35 +03:00 committed by Elad Ashkenazi
parent d62d6cc852
commit b900c43ceb
5 changed files with 18 additions and 7 deletions

View file

@ -1403,7 +1403,7 @@ static bool CheckDebugSelf(fs::file& s)
return false;
}
fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* out_info)
fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* out_info, bool require_encrypted)
{
if (out_info)
{
@ -1418,8 +1418,14 @@ fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* ou
elf_or_self.seek(0);
// Check SELF header first. Check for a debug SELF.
if (elf_or_self.size() >= 4 && elf_or_self.read<u32>() == "SCE\0"_u32 && !CheckDebugSelf(elf_or_self))
if (elf_or_self.size() >= 4 && elf_or_self.read<u32>() == "SCE\0"_u32)
{
if (CheckDebugSelf(elf_or_self))
{
// TODO: Decrypt
return elf_or_self;
}
// Check the ELF file class (32 or 64 bit).
const bool isElf32 = IsSelfElf32(elf_or_self);
@ -1451,6 +1457,11 @@ fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* ou
return self_dec.MakeElf(isElf32);
}
if (require_encrypted)
{
return {};
}
return elf_or_self;
}