namespace SabreTools.Data.Models.STFS { /// /// Secure Transacted File System, Header format /// /// public class Header { /// /// Magic bytes indicating the format /// Possible values are "LIVE", "PIRS, and "CON " /// /// 4 bytes public byte[] MagicBytes { get; set; } = new byte[4]; /// /// Signature Block /// Not optional, but abstract class /// /// 552 bytes public Signature? Signature { get; set; } /// /// Used to check package owner /// 16 license entries, 16 bytes each /// /// 256 bytes public LicenseEntry[] LicensingData { get; set; } = new LicenseEntry[16]; /// /// SHA-1 Integrity Hash of the header (from ContentType/0x344 to first hash table) /// /// 20 bytes public byte[] HeaderHash { get; set; } = new byte[20]; /// /// Size of the header, in bytes (from start of file) /// The actual end of header is padded and zeroed up until next block (multiple of 4096 bytes) /// /// Big-endian public uint HeaderSize { get; set; } /// /// Indication of the content in the STFS /// See Enum.ContentType /// /// Big-endian public int ContentType { get; set; } /// /// Intended meaning of some of the below fields /// Known values are 0, 1 and 2 /// 0 = A bunch of fields will be zeroed (Seen in system updates) /// 1 = All but the below fields are set /// 2 = The following new fields are set: /// SeriesID, SeasonID, SeasonNumber, EpisodeNumber, /// AdditionalDisplayNames, AdditionalDisplayDescriptions /// /// Big-endian public int MetadataVersion { get; set; } /// /// Size of content in bytes /// /// Big-endian public long ContentSize { get; set; } /// /// Media ID /// /// Big-endian public uint MediaID { get; set; } /// /// Version of System/Title Updates /// /// Big-endian public int Version { get; set; } /// /// Base Version of System/Title Updates /// /// Big-endian public int BaseVersion { get; set; } /// /// Title ID /// /// Big-endian public uint TitleID { get; set; } /// /// Intended platform for content /// 0 = ???, 2 = Xbox 360, 4 = PC /// public byte Platform { get; set; } /// /// Intended platform for content /// Xbox 360 = 2, PC = 4 /// public byte ExecutableType { get; set; } /// /// Disc Number /// public byte DiscNumber { get; set; } /// /// Disc In Set /// public byte DiscInSet { get; set; } /// /// Save Game ID /// /// Big-endian public uint SaveGameID { get; set; } /// /// Console ID /// /// 5 bytes public byte[] ConsoleID { get; set; } = new byte[5]; /// /// Profile ID /// /// 8 bytes public byte[] ProfileID { get; set; } = new byte[8]; /// /// STFS Volume Descriptor /// Not optional, but abstract class /// public VolumeDescriptor? VolumeDescriptor { get; set; } /// /// Data File Count /// /// Big-endian public int DataFileCount { get; set; } /// /// Data File Combined Size, in bytes /// /// Big-endian public long DataFileCombinedSize { get; set; } /// /// Descriptor Type /// 0 = STFS, 1 = SVOD /// /// Big-endian public uint DescriptorType { get; set; } /// /// Reserved bytes, should be all zeroed /// /// Big-endian public uint Reserved { get; set; } /// /// Series ID /// Zeroed for MetadataVersion = 1 /// /// 16 bytes public byte[]? SeriesID { get; set; } = new byte[16]; /// /// Season ID /// Zeroed for MetadataVersion = 1 /// /// 16 bytes public byte[]? SeasonID { get; set; } = new byte[16]; /// /// Season Number /// Zeroed for MetadataVersion = 1 /// /// Big-endian public short? SeasonNumber { get; set; } /// /// Season Number /// Zeroed for MetadataVersion = 1 /// /// Big-endian public short? EpisodeNumber { get; set; } /// /// Padding bytes /// If MetadataVersion is 2, there are 40 bytes /// Otherwise, there are 76 bytes /// /// 40 bytes public byte[] Padding { get; set; } = []; /// /// Device ID /// /// 20 bytes public byte[] DeviceID { get; set; } = new byte[20]; /// /// Display Name, UTF-8 string /// 128 bytes per locale, 18 different locales /// /// 2304 bytes, UTF-8 string public byte[] DisplayName { get; set; } = new byte[2304]; /// /// Display Description, UTF-8 string /// 128 bytes per locale, 18 different locales /// /// 2304 bytes, UTF-8 string public byte[] DisplayDescription { get; set; } = new byte[2304]; /// /// Publisher Name, UTF-8 string /// /// 128 bytes, UTF-8 string public byte[] PublisherName { get; set; } = new byte[128]; /// /// Title Name, UTF-8 string /// /// 128 bytes, UTF-8 string public byte[] TitleName { get; set; } = new byte[128]; /// /// Transfer Flags, see Constants.TransferFlags /// public byte TransferFlags { get; set; } /// /// Size of the thumbnail image, in bytes /// /// Big-endian public int ThumbnailImageSize { get; set; } /// /// Size of the title thumbnail image, in bytes /// /// Big-endian public int TitleThumbnailImageSize { get; set; } /// /// Thumbnail image /// If Metadata version = 1, 0x4000 bytes allocated, padded with zeroes /// If Metadata version = 2, 0x3D00 bytes allocated, padded with zeroes /// public byte[] ThumbnailImage { get; set; } = []; /// /// Additional Display Names, UTF-8 string /// 128 bytes per locale, 6 different locales /// Only present if MetadataVersion = 2 /// /// If present, 768 bytes, UTF-8 string public byte[]? AdditionalDisplayNames { get; set; } /// /// Title thumbnail image /// If Metadata version = 1, 0x4000 bytes allocated, padded with zeroes /// If Metadata version = 2, 0x3D00 bytes allocated, padded with zeroes /// public byte[] TitleThumbnailImage { get; set; } = []; /// /// Additional Display Descriptions, UTF-8 string /// 128 bytes per locale, 6 different locales /// Only present if MetadataVersion = 2 /// /// If present, 768 bytes, UTF-8 string public byte[]? AdditionalDisplayDescriptions { get; set; } /// /// Optional field present on installer update/cache packages /// public InstallerHeader? InstallerHeader { get; set; } } }