namespace SabreTools.Data.Models.XRD { /// /// Xbox Rebuild/Recovery/Redump Data /// Custom file format containing descriptive metadata about Xbox / Xbox 360 disc images /// public class File { /// /// "XRD\xFF\x00" /// public byte[] Magic { get; set; } = new byte[5]; /// /// XRD File Format Version /// 0x01 = Standard /// 0x02 = Also contains Wiped Video ISO size/hashes, and Video ISO file size/hashes /// Intended use is Version 0x02 only for XGD3 discs, but not mandated /// public byte Version { get; set; } /// /// XGD Type: XGD1, XGD2, XGD3, 0xFF = Unknown /// public byte XGDType { get; set; } /// /// XGD SubType /// XGD1: /// subtype 0 = XGD1 Beta (XB00104M) /// subtype 1 = Standard /// XGD2: /// subtype 0 = XGD2 Beta "Wave 0" (3CFB91D5) /// subtype 1-20 = Wave 1-20, Standard /// subtype 0x81 = Hybrid XGD2 / DVD-Video (65472451) /// XGD3: /// subtype 0 = XGD3 Beta (152C2978, FD91511A, FFFFFDEB, FFFFFDE3) /// subtype 1 = Standard /// 0xFF = Unknown /// Others undefined /// public byte XGDSubtype { get; set; } /// /// 8-character serial in disc ringcode /// e.g. XGD1: e.g. "MS00101A" /// e.g. XGD2/3: e.g. "1A2B3C4D" /// Can be parsed from XBE/XEX Certificate /// public byte[] Ringcode { get; set; } = new byte[8]; /// /// Size of the redump ISO in bytes /// /// Little-endian public ulong RedumpSize { get; set; } /// /// CRC-32 hash of the redump ISO /// public byte[] RedumpCRC { get; set; } = new byte[4]; /// /// MD5 hash of the redump ISO /// public byte[] RedumpMD5 { get; set; } = new byte[16]; /// /// SHA-1 hash of the redump ISO /// public byte[] RedumpSHA1 { get; set; } = new byte[20]; /// /// Size of the Raw XISO in bytes /// /// Little-endian public ulong RawXISOSize { get; set; } /// /// CRC-32 hash of the Raw XISO /// public byte[] RawXISOCRC { get; set; } = new byte[4]; /// /// MD5 hash of the Raw XISO /// public byte[] RawXISOMD5 { get; set; } = new byte[16]; /// /// SHA-1 hash of the Raw XISO /// public byte[] RawXISOSHA1 { get; set; } = new byte[20]; /// /// Size of the Wiped/Trimmed XISO in bytes /// /// Little-endian public ulong CookedXISOSize { get; set; } /// /// CRC-32 hash of the Wiped/Trimmed XISO /// public byte[] CookedXISOCRC { get; set; } = new byte[4]; /// /// MD5 hash of the Wiped/Trimmed XISO /// public byte[] CookedXISOMD5 { get; set; } = new byte[16]; /// /// SHA-1 hash of the Wiped/Trimmed XISO /// public byte[] CookedXISOSHA1 { get; set; } = new byte[20]; /// /// Size of the Video ISO in bytes /// /// Little-endian public ulong VideoISOSize { get; set; } /// /// CRC-32 hash of the Video ISO /// public byte[] VideoISOCRC { get; set; } = new byte[4]; /// /// MD5 hash of the Video ISO /// public byte[] VideoISOMD5 { get; set; } = new byte[16]; /// /// SHA-1 hash of the Video ISO /// public byte[] VideoISOSHA1 { get; set; } = new byte[20]; /// /// Size of the wiped Video ISO in bytes /// Field does not exist for Version = 1 /// /// Little-endian public ulong? WipedVideoISOSize { get; set; } /// /// CRC-32 hash of the wiped Video ISO /// Field does not exist for Version = 1 /// public byte[]? WipedVideoISOCRC { get; set; } = new byte[4]; /// /// MD5 hash of the wiped Video ISO /// Field does not exist for Version = 1 /// public byte[]? WipedVideoISOMD5 { get; set; } = new byte[16]; /// /// SHA-1 hash of the wiped Video ISO /// Field does not exist for Version = 1 /// public byte[]? WipedVideoISOSHA1 { get; set; } = new byte[20]; /// /// Size of the filler data that has been hashed, in bytes /// Should always be 2048 /// /// Little-endian public ulong FillerSize { get; set; } /// /// CRC-32 Hash of the first sector of the XDVDFS filesystem (filler data) /// The hash is used to identify filler data or brute force the seed /// public byte[] FillerCRC { get; set; } = new byte[4]; /// /// MD5 Hash of the first sector of the XDVDFS filesystem (filler data) /// The hash is used to identify filler data or brute force the seed /// public byte[] FillerMD5 { get; set; } = new byte[16]; /// /// SHA-1 Hash of the first sector of the XDVDFS filesystem (filler data) /// The hash is used to identify filler data or brute force the seed /// public byte[] FillerSHA1 { get; set; } = new byte[20]; /// /// The starting sector offset for each security sector range /// Security sector ranges are 4096-sectors long /// XGD1: 16 sector offsets /// XGD2/3: 2 sector offsets public uint[]? SecuritySectors { get; set; } = []; /// /// XBE Certificate, starts with length of structure /// /// XGD1 only, Little-endian public XboxExecutable.Certificate? XboxCertificate { get; set; } /// /// XEX Certificate, starts with length of structure /// /// XGD2/3 only, Big-endian public XenonExecutable.Certificate? Xbox360Certificate { get; set; } /// /// Number of files in the XISO /// /// Little-endian public int FileCount { get; set; } /// /// File offsets and hashes in the XISO /// Length of array equal to FileCount /// public FileEntry[] FileInfo { get; set; } = []; /// /// XISO Volume Descriptor /// /// 2048 bytes public XDVDFS.VolumeDescriptor VolumeDescriptor { get; set; } = new(); /// /// Xbox DVD Layout Descriptor, immediately follows Volume Descriptor /// XGD1: Contains version numbers and signature bytes (always present) /// XGD2: Zeroed apart from initial signature bytes (always present?) /// XGD3: Sector not present (always not present?) /// Always check if this is present by reading LayoutDescriptor magic bytes /// /// 2048 bytes public XDVDFS.LayoutDescriptor? LayoutDescriptor { get; set; } /// /// Number of directory records in the XISO /// /// Little-endian public int DirectoryCount { get; set; } /// /// List of XISO descriptors and their sector offsets and sizes /// The root directory descriptor is not guaranteed to be the first /// public DirectoryEntry[] DirectoryInfo { get; set; } = []; /// /// Number of files in Video ISO /// Field does not exist for Version = 1 /// /// Little-endian public int? VideoISOFileCount { get; set; } /// /// File offsets and hashes in the Video ISO /// Length of array equal to VideoISOFileCount /// Field does not exist for Version = 1 /// public FileEntry[]? VideoISOFileInfo { get; set; } /// /// Size of all data in XRD file prior to this field /// /// Little-endian public uint XRDSize { get; set; } /// /// SHA-1 Hash of the XRD file prior to XRDSize field /// public byte[] XRDSHA1 { get; set; } = new byte[20]; } }