mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
unself: rename SCEVersionInfo to version_header
This commit is contained in:
parent
5fb716fc21
commit
500f7901ac
@ -227,23 +227,23 @@ void segment_ext_header::Show() const
|
||||
self_log.notice("Encryption: 0x%08x", encryption);
|
||||
}
|
||||
|
||||
void SCEVersionInfo::Load(const fs::file& f)
|
||||
void version_header::Load(const fs::file& f)
|
||||
{
|
||||
subheader_type = Read32(f);
|
||||
present = Read32(f);
|
||||
size = Read32(f);
|
||||
unknown = Read32(f);
|
||||
unknown4 = Read32(f);
|
||||
}
|
||||
|
||||
void SCEVersionInfo::Show() const
|
||||
void version_header::Show() const
|
||||
{
|
||||
self_log.notice("Sub-header type: 0x%08x", subheader_type);
|
||||
self_log.notice("Present: 0x%08x", present);
|
||||
self_log.notice("Size: 0x%08x", size);
|
||||
self_log.notice("Unknown: 0x%08x", unknown);
|
||||
self_log.notice("Unknown: 0x%08x", unknown4);
|
||||
}
|
||||
|
||||
void ControlInfo::Load(const fs::file& f)
|
||||
void supplemental_header::Load(const fs::file& f)
|
||||
{
|
||||
type = Read32(f);
|
||||
size = Read32(f);
|
||||
@ -251,45 +251,45 @@ void ControlInfo::Load(const fs::file& f)
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
control_flags.ctrl_flag1 = Read32(f);
|
||||
control_flags.unknown1 = Read32(f);
|
||||
control_flags.unknown2 = Read32(f);
|
||||
control_flags.unknown3 = Read32(f);
|
||||
control_flags.unknown4 = Read32(f);
|
||||
control_flags.unknown5 = Read32(f);
|
||||
control_flags.unknown6 = Read32(f);
|
||||
control_flags.unknown7 = Read32(f);
|
||||
PS3_plaintext_capability_header.ctrl_flag1 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown1 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown2 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown3 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown4 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown5 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown6 = Read32(f);
|
||||
PS3_plaintext_capability_header.unknown7 = Read32(f);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
f.read(file_digest_30.digest, 20);
|
||||
file_digest_30.unknown = Read64(f);
|
||||
f.read(PS3_elf_digest_header_30.constant_or_elf_digest, sizeof(PS3_elf_digest_header_30.constant_or_elf_digest));
|
||||
f.read(PS3_elf_digest_header_30.padding, sizeof(PS3_elf_digest_header_30.padding));
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
f.read(file_digest_40.digest1, 20);
|
||||
f.read(file_digest_40.digest2, 20);
|
||||
file_digest_40.unknown = Read64(f);
|
||||
f.read(PS3_elf_digest_header_40.constant, sizeof(PS3_elf_digest_header_40.constant));
|
||||
f.read(PS3_elf_digest_header_40.elf_digest, sizeof(PS3_elf_digest_header_40.elf_digest));
|
||||
PS3_elf_digest_header_40.required_system_version = Read64(f);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
npdrm.magic = Read32(f);
|
||||
npdrm.version = Read32(f);
|
||||
npdrm.license = Read32(f);
|
||||
npdrm.type = Read32(f);
|
||||
f.read(npdrm.content_id, 48);
|
||||
f.read(npdrm.digest, 16);
|
||||
f.read(npdrm.title_hash, 16);
|
||||
f.read(npdrm.dev_hash, 16);
|
||||
npdrm.activate_time = Read64(f);
|
||||
npdrm.expire_time = Read64(f);
|
||||
PS3_npdrm_header.npd.magic = Read32(f);
|
||||
PS3_npdrm_header.npd.version = Read32(f);
|
||||
PS3_npdrm_header.npd.license = Read32(f);
|
||||
PS3_npdrm_header.npd.type = Read32(f);
|
||||
f.read(PS3_npdrm_header.npd.content_id, 48);
|
||||
f.read(PS3_npdrm_header.npd.digest, 16);
|
||||
f.read(PS3_npdrm_header.npd.title_hash, 16);
|
||||
f.read(PS3_npdrm_header.npd.dev_hash, 16);
|
||||
PS3_npdrm_header.npd.activate_time = Read64(f);
|
||||
PS3_npdrm_header.npd.expire_time = Read64(f);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlInfo::Show() const
|
||||
void supplemental_header::Show() const
|
||||
{
|
||||
self_log.notice("Type: 0x%08x", type);
|
||||
self_log.notice("Size: 0x%08x", size);
|
||||
@ -297,41 +297,41 @@ void ControlInfo::Show() const
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
self_log.notice("Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
self_log.notice("Unknown1: 0x%08x", control_flags.unknown1);
|
||||
self_log.notice("Unknown2: 0x%08x", control_flags.unknown2);
|
||||
self_log.notice("Unknown3: 0x%08x", control_flags.unknown3);
|
||||
self_log.notice("Unknown4: 0x%08x", control_flags.unknown4);
|
||||
self_log.notice("Unknown5: 0x%08x", control_flags.unknown5);
|
||||
self_log.notice("Unknown6: 0x%08x", control_flags.unknown6);
|
||||
self_log.notice("Unknown7: 0x%08x", control_flags.unknown7);
|
||||
self_log.notice("Control flag 1: 0x%08x", PS3_plaintext_capability_header.ctrl_flag1);
|
||||
self_log.notice("Unknown1: 0x%08x", PS3_plaintext_capability_header.unknown1);
|
||||
self_log.notice("Unknown2: 0x%08x", PS3_plaintext_capability_header.unknown2);
|
||||
self_log.notice("Unknown3: 0x%08x", PS3_plaintext_capability_header.unknown3);
|
||||
self_log.notice("Unknown4: 0x%08x", PS3_plaintext_capability_header.unknown4);
|
||||
self_log.notice("Unknown5: 0x%08x", PS3_plaintext_capability_header.unknown5);
|
||||
self_log.notice("Unknown6: 0x%08x", PS3_plaintext_capability_header.unknown6);
|
||||
self_log.notice("Unknown7: 0x%08x", PS3_plaintext_capability_header.unknown7);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
if (size == 0x30)
|
||||
{
|
||||
self_log.notice("Digest: %s", file_digest_30.digest);
|
||||
self_log.notice("Unknown: 0x%llx", file_digest_30.unknown);
|
||||
self_log.notice("Digest: %s", PS3_elf_digest_header_30.constant_or_elf_digest);
|
||||
self_log.notice("Unknown: 0x%llx", PS3_elf_digest_header_30.padding);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
self_log.notice("Digest1: %s", file_digest_40.digest1);
|
||||
self_log.notice("Digest2: %s", file_digest_40.digest2);
|
||||
self_log.notice("Unknown: 0x%llx", file_digest_40.unknown);
|
||||
self_log.notice("Digest1: %s", PS3_elf_digest_header_40.constant);
|
||||
self_log.notice("Digest2: %s", PS3_elf_digest_header_40.elf_digest);
|
||||
self_log.notice("Unknown: 0x%llx", PS3_elf_digest_header_40.required_system_version);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
self_log.notice("Magic: 0x%08x", npdrm.magic);
|
||||
self_log.notice("Version: 0x%08x", npdrm.version);
|
||||
self_log.notice("License: 0x%08x", npdrm.license);
|
||||
self_log.notice("Type: 0x%08x", npdrm.type);
|
||||
self_log.notice("ContentID: %s", npdrm.content_id);
|
||||
self_log.notice("Digest: %s", npdrm.digest);
|
||||
self_log.notice("Inverse digest: %s", npdrm.title_hash);
|
||||
self_log.notice("XOR digest: %s", npdrm.dev_hash);
|
||||
self_log.notice("Activation time: 0x%llx", npdrm.activate_time);
|
||||
self_log.notice("Expiration time: 0x%llx", npdrm.expire_time);
|
||||
self_log.notice("Magic: 0x%08x", PS3_npdrm_header.npd.magic);
|
||||
self_log.notice("Version: 0x%08x", PS3_npdrm_header.npd.version);
|
||||
self_log.notice("License: 0x%08x", PS3_npdrm_header.npd.license);
|
||||
self_log.notice("Type: 0x%08x", PS3_npdrm_header.npd.type);
|
||||
self_log.notice("ContentID: %s", PS3_npdrm_header.npd.content_id);
|
||||
self_log.notice("Digest: %s", PS3_npdrm_header.npd.digest);
|
||||
self_log.notice("Inverse digest: %s", PS3_npdrm_header.npd.title_hash);
|
||||
self_log.notice("XOR digest: %s", PS3_npdrm_header.npd.dev_hash);
|
||||
self_log.notice("Activation time: 0x%llx", PS3_npdrm_header.npd.activate_time);
|
||||
self_log.notice("Expiration time: 0x%llx", PS3_npdrm_header.npd.expire_time);
|
||||
}
|
||||
}
|
||||
|
||||
@ -949,23 +949,23 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
||||
|
||||
// Read SCE version info.
|
||||
self_f.seek(m_ext_hdr.version_hdr_offset);
|
||||
scev_info.Load(self_f);
|
||||
m_version_hdr.Load(self_f);
|
||||
|
||||
// Read control info.
|
||||
ctrlinfo_arr.clear();
|
||||
m_supplemental_hdr_arr.clear();
|
||||
self_f.seek(m_ext_hdr.supplemental_hdr_offset);
|
||||
|
||||
for (u64 i = 0; i < m_ext_hdr.supplemental_hdr_size;)
|
||||
{
|
||||
ctrlinfo_arr.emplace_back();
|
||||
ControlInfo &cinfo = ctrlinfo_arr.back();
|
||||
m_supplemental_hdr_arr.emplace_back();
|
||||
supplemental_header& cinfo = m_supplemental_hdr_arr.back();
|
||||
cinfo.Load(self_f);
|
||||
i += cinfo.size;
|
||||
}
|
||||
|
||||
if (out_info)
|
||||
{
|
||||
out_info->ctrl_info = ctrlinfo_arr;
|
||||
out_info->supplemental_hdr = m_supplemental_hdr_arr;
|
||||
}
|
||||
|
||||
// Read ELF section headers.
|
||||
@ -1043,12 +1043,12 @@ void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("SCE version info");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
scev_info.Show();
|
||||
m_version_hdr.Show();
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("Control info");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
ctrlinfo_arr[i].Show();
|
||||
for(unsigned int i = 0; i < m_supplemental_hdr_arr.size(); i++)
|
||||
m_supplemental_hdr_arr[i].Show();
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("ELF section headers");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
@ -1121,11 +1121,11 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
const NPD_HEADER* SELFDecrypter::GetNPDHeader() const
|
||||
{
|
||||
// Parse the control info structures to find the NPDRM control info.
|
||||
for (const ControlInfo& info : ctrlinfo_arr)
|
||||
for (const supplemental_header& info : m_supplemental_hdr_arr)
|
||||
{
|
||||
if (info.type == 3)
|
||||
{
|
||||
return &info.npdrm;
|
||||
return &info.PS3_npdrm_header.npd;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,27 +97,27 @@ struct segment_ext_header
|
||||
void Show() const;
|
||||
};
|
||||
|
||||
struct SCEVersionInfo
|
||||
struct version_header
|
||||
{
|
||||
u32 subheader_type;
|
||||
u32 present;
|
||||
u32 size;
|
||||
u32 unknown;
|
||||
u32 subheader_type; // 1 - sceversion
|
||||
u32 present; // 0 = false, 1 = true
|
||||
u32 size; // usually 0x10
|
||||
u32 unknown4;
|
||||
|
||||
void Load(const fs::file& f);
|
||||
void Show() const;
|
||||
};
|
||||
|
||||
struct ControlInfo
|
||||
struct supplemental_header
|
||||
{
|
||||
u32 type;
|
||||
u32 type; // 1=PS3 plaintext_capability; 2=PS3 ELF digest; 3=PS3 NPDRM, 4=PS Vita ELF digest; 5=PS Vita NPDRM; 6=PS Vita boot param; 7=PS Vita shared secret
|
||||
u32 size;
|
||||
u64 next;
|
||||
u64 next; // 1 if another Supplemental Header element follows else 0
|
||||
|
||||
union
|
||||
{
|
||||
// type 1 0x30 bytes
|
||||
struct
|
||||
// type 1, 0x30 bytes
|
||||
struct // 0x20 bytes of data
|
||||
{
|
||||
u32 ctrl_flag1;
|
||||
u32 unknown1;
|
||||
@ -127,28 +127,28 @@ struct ControlInfo
|
||||
u32 unknown5;
|
||||
u32 unknown6;
|
||||
u32 unknown7;
|
||||
} PS3_plaintext_capability_header;
|
||||
|
||||
} control_flags;
|
||||
|
||||
// type 2 0x30 bytes
|
||||
struct
|
||||
// type 2, 0x40 bytes
|
||||
struct // 0x30 bytes of data
|
||||
{
|
||||
u8 digest[20];
|
||||
u64 unknown;
|
||||
u8 constant[0x14]; // same for every PS3/PS Vita SELF, hardcoded in make_fself.exe: 627CB1808AB938E32C8C091708726A579E2586E4
|
||||
u8 elf_digest[0x14]; // SHA-1. Hash F2C552BF716ED24759CBE8A0A9A6DB9965F3811C is blacklisted by appldr
|
||||
u64 required_system_version; // filled on Sony authentication server, contains decimal PS3_SYSTEM_VER value from PARAM.SFO
|
||||
} PS3_elf_digest_header_40;
|
||||
|
||||
} file_digest_30;
|
||||
|
||||
// type 2 0x40 bytes
|
||||
struct
|
||||
// type 2, 0x30 bytes
|
||||
struct // 0x20 bytes of data
|
||||
{
|
||||
u8 digest1[20];
|
||||
u8 digest2[20];
|
||||
u64 unknown;
|
||||
u8 constant_or_elf_digest[0x14];
|
||||
u8 padding[0xC];
|
||||
} PS3_elf_digest_header_30;
|
||||
|
||||
} file_digest_40;
|
||||
|
||||
// type 3 0x90 bytes
|
||||
NPD_HEADER npdrm;
|
||||
// type 3, 0x90 bytes
|
||||
struct // 0x80 bytes of data
|
||||
{
|
||||
NPD_HEADER npd;
|
||||
} PS3_npdrm_header;
|
||||
};
|
||||
|
||||
void Load(const fs::file& f);
|
||||
@ -233,7 +233,7 @@ struct Signature
|
||||
|
||||
struct SelfSection
|
||||
{
|
||||
u8 *data;
|
||||
u8* data;
|
||||
u64 size;
|
||||
u64 offset;
|
||||
|
||||
@ -400,7 +400,7 @@ struct ext_hdr
|
||||
struct SelfAdditionalInfo
|
||||
{
|
||||
bool valid = false;
|
||||
std::vector<ControlInfo> ctrl_info;
|
||||
std::vector<supplemental_header> supplemental_hdr;
|
||||
program_identification_header prog_id_hdr;
|
||||
};
|
||||
|
||||
@ -454,8 +454,8 @@ class SELFDecrypter
|
||||
|
||||
// Decryption info structs.
|
||||
std::vector<segment_ext_header> m_seg_ext_hdr{};
|
||||
SCEVersionInfo scev_info{};
|
||||
std::vector<ControlInfo> ctrlinfo_arr{};
|
||||
version_header m_version_hdr{};
|
||||
std::vector<supplemental_header> m_supplemental_hdr_arr{};
|
||||
|
||||
// Metadata structs.
|
||||
MetadataInfo meta_info{};
|
||||
|
@ -1909,18 +1909,18 @@ bool ppu_load_exec(const ppu_exec_object& elf, utils::serial* ar)
|
||||
|
||||
if (bool not_found = g_ps3_process_info.self_info.valid)
|
||||
{
|
||||
for (const auto& ctrl : g_ps3_process_info.self_info.ctrl_info)
|
||||
for (const auto& ctrl : g_ps3_process_info.self_info.supplemental_hdr)
|
||||
{
|
||||
if (ctrl.type == 1)
|
||||
{
|
||||
if (!std::exchange(not_found, false))
|
||||
{
|
||||
ppu_loader.error("More than one control flags header found! (flags1=0x%x)",
|
||||
ctrl.control_flags.ctrl_flag1);
|
||||
ctrl.PS3_plaintext_capability_header.ctrl_flag1);
|
||||
break;
|
||||
}
|
||||
|
||||
g_ps3_process_info.ctrl_flags1 |= ctrl.control_flags.ctrl_flag1;
|
||||
g_ps3_process_info.ctrl_flags1 |= ctrl.PS3_plaintext_capability_header.ctrl_flag1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user