-
Notifications
You must be signed in to change notification settings - Fork 4
XRD File Support #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
XRD File Support #87
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace SabreTools.Data.Models.XRD | ||
| { | ||
| public static class Constants | ||
| { | ||
| /// <summary> | ||
| /// Magic string at start of XRD file | ||
| /// </summary> | ||
| public static readonly byte[] MagicBytes = [0x58, 0x52, 0x44, 0xFF, 0x00]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| namespace SabreTools.Data.Models.XRD | ||
| { | ||
| public class DirectoryEntry | ||
| { | ||
| /// <summary> | ||
| /// Sector offset of descriptor in XDVDFS filesystem | ||
| /// </summary> | ||
| public uint Offset { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Size of descriptor in sectors | ||
| /// </summary> | ||
| public uint Size { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 Hash of file content | ||
| /// </summary> | ||
| public XDVDFS.DirectoryDescriptor DirectoryDescriptor { get; set; } = new(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,270 @@ | ||
| namespace SabreTools.Data.Models.XRD | ||
| { | ||
| /// <summary> | ||
| /// Xbox Rebuild/Recovery/Redump Data | ||
| /// Custom file format containing descriptive metadata about Xbox / Xbox 360 disc images | ||
| /// </summary> | ||
| public class File | ||
| { | ||
| /// <summary> | ||
| /// "XRD\xFF\x00" | ||
| /// </summary> | ||
| public byte[] Magic { get; set; } = new byte[5]; | ||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| public byte Version { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// XGD Type: XGD1, XGD2, XGD3, 0xFF = Unknown | ||
| /// </summary> | ||
| public byte XGDType { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| public byte XGDSubtype { get; set; } | ||
|
mnadareski marked this conversation as resolved.
|
||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| public byte[] Ringcode { get; set; } = new byte[8]; | ||
|
|
||
| /// <summary> | ||
| /// Size of the redump ISO in bytes | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public ulong RedumpSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CRC-32 hash of the redump ISO | ||
| /// </summary> | ||
| public byte[] RedumpCRC { get; set; } = new byte[4]; | ||
|
|
||
| /// <summary> | ||
| /// MD5 hash of the redump ISO | ||
| /// </summary> | ||
| public byte[] RedumpMD5 { get; set; } = new byte[16]; | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 hash of the redump ISO | ||
| /// </summary> | ||
| public byte[] RedumpSHA1 { get; set; } = new byte[20]; | ||
|
|
||
| /// <summary> | ||
| /// Size of the Raw XISO in bytes | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public ulong RawXISOSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CRC-32 hash of the Raw XISO | ||
| /// </summary> | ||
| public byte[] RawXISOCRC { get; set; } = new byte[4]; | ||
|
|
||
| /// <summary> | ||
| /// MD5 hash of the Raw XISO | ||
| /// </summary> | ||
| public byte[] RawXISOMD5 { get; set; } = new byte[16]; | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 hash of the Raw XISO | ||
| /// </summary> | ||
| public byte[] RawXISOSHA1 { get; set; } = new byte[20]; | ||
|
|
||
| /// <summary> | ||
| /// Size of the Wiped/Trimmed XISO in bytes | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public ulong CookedXISOSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CRC-32 hash of the Wiped/Trimmed XISO | ||
| /// </summary> | ||
| public byte[] CookedXISOCRC { get; set; } = new byte[4]; | ||
|
|
||
| /// <summary> | ||
| /// MD5 hash of the Wiped/Trimmed XISO | ||
| /// </summary> | ||
| public byte[] CookedXISOMD5 { get; set; } = new byte[16]; | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 hash of the Wiped/Trimmed XISO | ||
| /// </summary> | ||
| public byte[] CookedXISOSHA1 { get; set; } = new byte[20]; | ||
|
|
||
| /// <summary> | ||
| /// Size of the Video ISO in bytes | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public ulong VideoISOSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CRC-32 hash of the Video ISO | ||
| /// </summary> | ||
| public byte[] VideoISOCRC { get; set; } = new byte[4]; | ||
|
|
||
| /// <summary> | ||
| /// MD5 hash of the Video ISO | ||
| /// </summary> | ||
| public byte[] VideoISOMD5 { get; set; } = new byte[16]; | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 hash of the Video ISO | ||
| /// </summary> | ||
| public byte[] VideoISOSHA1 { get; set; } = new byte[20]; | ||
|
|
||
| /// <summary> | ||
| /// Size of the wiped Video ISO in bytes | ||
| /// Field does not exist for Version = 1 | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public ulong? WipedVideoISOSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// CRC-32 hash of the wiped Video ISO | ||
| /// Field does not exist for Version = 1 | ||
| /// </summary> | ||
| public byte[]? WipedVideoISOCRC { get; set; } = new byte[4]; | ||
|
|
||
| /// <summary> | ||
| /// MD5 hash of the wiped Video ISO | ||
| /// Field does not exist for Version = 1 | ||
| /// </summary> | ||
| public byte[]? WipedVideoISOMD5 { get; set; } = new byte[16]; | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 hash of the wiped Video ISO | ||
| /// Field does not exist for Version = 1 | ||
| /// </summary> | ||
| public byte[]? WipedVideoISOSHA1 { get; set; } = new byte[20]; | ||
|
|
||
| /// <summary> | ||
| /// Size of the filler data that has been hashed, in bytes | ||
| /// Should always be 2048 | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public ulong FillerSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| public byte[] FillerCRC { get; set; } = new byte[4]; | ||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| public byte[] FillerMD5 { get; set; } = new byte[16]; | ||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| public byte[] FillerSHA1 { get; set; } = new byte[20]; | ||
|
|
||
| /// <summary> | ||
| /// 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; } = []; | ||
|
|
||
| /// <summary> | ||
| /// XBE Certificate, starts with length of structure | ||
| /// </summary> | ||
| /// <remarks>XGD1 only, Little-endian</remarks> | ||
| public XboxExecutable.Certificate? XboxCertificate { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// XEX Certificate, starts with length of structure | ||
| /// </summary> | ||
| /// <remarks>XGD2/3 only, Big-endian</remarks> | ||
| public XenonExecutable.Certificate? Xbox360Certificate { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Number of files in the XISO | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public int FileCount { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// File offsets and hashes in the XISO | ||
| /// Length of array equal to FileCount | ||
| /// </summary> | ||
| public FileEntry[] FileInfo { get; set; } = []; | ||
|
|
||
| /// <summary> | ||
| /// XISO Volume Descriptor | ||
| /// </summary> | ||
| /// <remarks>2048 bytes</remarks> | ||
| public XDVDFS.VolumeDescriptor VolumeDescriptor { get; set; } = new(); | ||
|
|
||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| /// <remarks>2048 bytes</remarks> | ||
| public XDVDFS.LayoutDescriptor? LayoutDescriptor { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Number of directory records in the XISO | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public int DirectoryCount { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// List of XISO descriptors and their sector offsets and sizes | ||
| /// The root directory descriptor is not guaranteed to be the first | ||
| /// </summary> | ||
| public DirectoryEntry[] DirectoryInfo { get; set; } = []; | ||
|
|
||
| /// <summary> | ||
| /// Number of files in Video ISO | ||
| /// Field does not exist for Version = 1 | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public int? VideoISOFileCount { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// File offsets and hashes in the Video ISO | ||
| /// Length of array equal to VideoISOFileCount | ||
| /// Field does not exist for Version = 1 | ||
| /// </summary> | ||
| public FileEntry[]? VideoISOFileInfo { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Size of all data in XRD file prior to this field | ||
| /// </summary> | ||
| /// <remarks>Little-endian</remarks> | ||
| public uint XRDSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 Hash of the XRD file prior to XRDSize field | ||
| /// </summary> | ||
| public byte[] XRDSHA1 { get; set; } = new byte[20]; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| namespace SabreTools.Data.Models.XRD | ||
| { | ||
| public class FileEntry | ||
| { | ||
| /// <summary> | ||
| /// Sector offset of file in XDVDFS filesystem | ||
| /// </summary> | ||
| public uint Offset { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Size of file in bytes | ||
| /// </summary> | ||
| public ulong Size { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// SHA-1 Hash of file content | ||
| /// </summary> | ||
| public byte[] SHA1 { get; set; } = new byte[20]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.