mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
Implement ps3 application root flags detection
This commit is contained in:
parent
974bce19ed
commit
c2eb9a583d
13 changed files with 193 additions and 37 deletions
|
|
@ -885,12 +885,17 @@ SELFDecrypter::SELFDecrypter(const fs::file& s)
|
|||
{
|
||||
}
|
||||
|
||||
bool SELFDecrypter::LoadHeaders(bool isElf32)
|
||||
bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
||||
{
|
||||
// Read SCE header.
|
||||
self_f.seek(0);
|
||||
sce_hdr.Load(self_f);
|
||||
|
||||
if (out_info)
|
||||
{
|
||||
out_info->valid = false;
|
||||
}
|
||||
|
||||
// Check SCE magic.
|
||||
if (!sce_hdr.CheckMagic())
|
||||
{
|
||||
|
|
@ -905,6 +910,11 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
self_f.seek(self_hdr.se_appinfooff);
|
||||
app_info.Load(self_f);
|
||||
|
||||
if (out_info)
|
||||
{
|
||||
out_info->app_info = app_info;
|
||||
}
|
||||
|
||||
// Read ELF header.
|
||||
self_f.seek(self_hdr.se_elfoff);
|
||||
|
||||
|
|
@ -967,8 +977,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
ctrlinfo_arr.clear();
|
||||
self_f.seek(self_hdr.se_controloff);
|
||||
|
||||
u32 i = 0;
|
||||
while(i < self_hdr.se_controlsize)
|
||||
for (u64 i = 0; i < self_hdr.se_controlsize;)
|
||||
{
|
||||
ctrlinfo_arr.emplace_back();
|
||||
ControlInfo &cinfo = ctrlinfo_arr.back();
|
||||
|
|
@ -976,6 +985,11 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
i += cinfo.size;
|
||||
}
|
||||
|
||||
if (out_info)
|
||||
{
|
||||
out_info->ctrl_info = ctrlinfo_arr;
|
||||
}
|
||||
|
||||
// Read ELF section headers.
|
||||
if (isElf32)
|
||||
{
|
||||
|
|
@ -1013,6 +1027,11 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
}
|
||||
}
|
||||
|
||||
if (out_info)
|
||||
{
|
||||
out_info->valid = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1374,8 +1393,13 @@ static bool CheckDebugSelf(fs::file& s)
|
|||
return false;
|
||||
}
|
||||
|
||||
extern fs::file decrypt_self(fs::file elf_or_self, u8* klic_key)
|
||||
fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* out_info)
|
||||
{
|
||||
if (out_info)
|
||||
{
|
||||
out_info->valid = false;
|
||||
}
|
||||
|
||||
if (!elf_or_self)
|
||||
{
|
||||
return fs::file{};
|
||||
|
|
@ -1393,7 +1417,7 @@ extern fs::file decrypt_self(fs::file elf_or_self, u8* klic_key)
|
|||
SELFDecrypter self_dec(elf_or_self);
|
||||
|
||||
// Load the SELF file headers.
|
||||
if (!self_dec.LoadHeaders(isElf32))
|
||||
if (!self_dec.LoadHeaders(isElf32, out_info))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file headers!");
|
||||
return fs::file{};
|
||||
|
|
@ -1420,7 +1444,7 @@ extern fs::file decrypt_self(fs::file elf_or_self, u8* klic_key)
|
|||
return elf_or_self;
|
||||
}
|
||||
|
||||
extern bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key)
|
||||
bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key)
|
||||
{
|
||||
if (!self)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue