From 5fb716fc21ee2fe94efe283468a25e29f2ed4c5a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 19 Apr 2023 20:57:13 +0200 Subject: [PATCH] unself: rename SectionInfo to segment_ext_header --- rpcs3/Crypto/unself.cpp | 32 +++++++++++++++----------------- rpcs3/Crypto/unself.h | 15 +++++++-------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp index 9efbbd0aa5..5a9ef42162 100644 --- a/rpcs3/Crypto/unself.cpp +++ b/rpcs3/Crypto/unself.cpp @@ -209,24 +209,22 @@ void program_identification_header::Show() const self_log.notice("Version: 0x%llx", program_sceversion); } -void SectionInfo::Load(const fs::file& f) +void segment_ext_header::Load(const fs::file& f) { - offset = Read64(f); - size = Read64(f); - compressed = Read32(f); - unknown1 = Read32(f); - unknown2 = Read32(f); - encrypted = Read32(f); + offset = Read64(f); + size = Read64(f); + compression = Read32(f); + unknown = Read32(f); + encryption = Read64(f); } -void SectionInfo::Show() const +void segment_ext_header::Show() const { self_log.notice("Offset: 0x%llx", offset); self_log.notice("Size: 0x%llx", size); - self_log.notice("Compressed: 0x%08x", compressed); - self_log.notice("Unknown1: 0x%08x", unknown1); - self_log.notice("Unknown2: 0x%08x", unknown2); - self_log.notice("Encrypted: 0x%08x", encrypted); + self_log.notice("Compression: 0x%08x", compression); + self_log.notice("Unknown: 0x%08x", unknown); + self_log.notice("Encryption: 0x%08x", encryption); } void SCEVersionInfo::Load(const fs::file& f) @@ -940,13 +938,13 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info) // Read section info. - secinfo_arr.clear(); + m_seg_ext_hdr.clear(); self_f.seek(m_ext_hdr.segment_ext_hdr_offset); for(u32 i = 0; i < ((isElf32) ? elf32_hdr.e_phnum : elf64_hdr.e_phnum); ++i) { - secinfo_arr.emplace_back(); - secinfo_arr.back().Load(self_f); + m_seg_ext_hdr.emplace_back(); + m_seg_ext_hdr.back().Load(self_f); } // Read SCE version info. @@ -1040,8 +1038,8 @@ void SELFDecrypter::ShowHeaders(bool isElf32) self_log.notice("----------------------------------------------------"); self_log.notice("Section info"); self_log.notice("----------------------------------------------------"); - for(unsigned int i = 0; i < secinfo_arr.size(); i++) - secinfo_arr[i].Show(); + for(unsigned int i = 0; i < m_seg_ext_hdr.size(); i++) + m_seg_ext_hdr[i].Show(); self_log.notice("----------------------------------------------------"); self_log.notice("SCE version info"); self_log.notice("----------------------------------------------------"); diff --git a/rpcs3/Crypto/unself.h b/rpcs3/Crypto/unself.h index a12f413939..1fcac4bb43 100644 --- a/rpcs3/Crypto/unself.h +++ b/rpcs3/Crypto/unself.h @@ -85,14 +85,13 @@ struct program_identification_header void Show() const; }; -struct SectionInfo +struct segment_ext_header { - u64 offset; - u64 size; - u32 compressed; - u32 unknown1; - u32 unknown2; - u32 encrypted; + u64 offset; // Offset to data + u64 size; // Size of data + u32 compression; // 1 = plain, 2 = zlib + u32 unknown; // Always 0, as far as I know. + u64 encryption; // 0 = unrequested, 1 = completed, 2 = requested void Load(const fs::file& f); void Show() const; @@ -454,7 +453,7 @@ class SELFDecrypter std::vector phdr32_arr{}; // Decryption info structs. - std::vector secinfo_arr{}; + std::vector m_seg_ext_hdr{}; SCEVersionInfo scev_info{}; std::vector ctrlinfo_arr{};