using System.Runtime.InteropServices; namespace SabreTools.Data.Models.PlayStation4 { /// /// All numeric values are big-endian [StructLayout(LayoutKind.Sequential)] public class AppPkgHeader { /// /// Identifying bytes for app.pkg file, "\7FCNT" /// public uint Magic; /// /// PKG Type /// public uint Type; /// /// PKG Unknown Field /// public uint PKGUnknown; /// /// PKG File count /// public uint FileCount; /// /// PKG Entry count /// public uint EntryCount; /// /// SC Entry count /// public ushort SCEntryCount; /// /// PKG Entry count (duplicated) /// public ushort EntryCount2; /// /// PKG File Table offset /// public uint TableOffset; /// /// PKG Entry data size /// public uint EntryDataSize; /// /// Offset of PKG Entries /// public ulong BodyOffset; /// /// Length of all PKG Entries /// public ulong BodySize; /// /// PKG Content offset /// public ulong ContentOffset; /// /// PKG Content size /// public ulong ContentSize; /// /// PKG Content ID /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x24)] public string ContentID = string.Empty; /// /// PKG Content Padding (Zeroes) /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xC)] public byte[] ContentZeroes = new byte[0xC]; /// /// PKG DRM Type /// public uint DRMType; /// /// PKG Content Type /// public uint ContentType; /// /// PKG Content Flags /// public uint ContentFlags; /// /// PKG Promote Size /// public uint PromoteSize; /// /// PKG Version Date /// public uint VersionDate; /// /// PKG Content Flags /// public uint VersionHash; /// /// PKG Padding Section 1 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x78)] public byte[] Zeroes1 = new byte[0x78]; /// /// PKG SHA256 for Main Entry 1 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] MainEntry1SHA256 = new byte[0x20]; /// /// PKG SHA256 for Main Entry 2 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] MainEntry2SHA256 = new byte[0x20]; /// /// PKG SHA256 for Digest Table /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] DigestTableSHA256 = new byte[0x20]; /// /// PKG SHA256 for Main Table /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] MainTableSHA256 = new byte[0x20]; /// /// PKG Padding Section 2 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x280)] public byte[] Zeroes2 = new byte[0x280]; /// /// PFS Unknown Field /// public uint PFSUnknown; /// /// PFS Image Count /// public uint PFSImageCount; /// /// PFS Image Flags /// public ulong PFSImageFlags; /// /// PFS Image Offset /// public ulong PFSImageOffset; /// /// PFS Image Size /// public ulong PFSImageSize; /// /// Mount Image Offset /// public ulong MountImageOffset; /// /// Mount Image Size /// public ulong MountImageSize; /// /// PKG Size /// public ulong PKGSize; /// /// PKG Signed Size /// public uint PKGSignedSize; /// /// PKG Signed Size /// public uint PKGCacheSize; /// /// SHA256 for PFS Image /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] PFSImageSHA256 = new byte[0x20]; /// /// SHA256 for PFS Signed /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] PFSSignedSHA256 = new byte[0x20]; /// /// PFS Split Size nth 0 /// public ulong PFSSplitSize0; /// /// PFS Split Size nth 1 /// public ulong PFSSplitSize1; /// /// PKG Padding Section 3 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xB50)] public byte[] Zeroes3 = new byte[0xB50]; /// /// SHA256 for PKG /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] public byte[] PKGSHA256 = new byte[0x20]; } }