Add version guards to IRD model

This commit is contained in:
Matt Nadareski
2023-10-23 11:33:50 -04:00
parent 948edbad58
commit cd67a7282b

View File

@@ -7,7 +7,11 @@ namespace SabreTools.Models.IRD
/// <summary>
/// "3IRD"
/// </summary>
#if NET48
public byte[] Magic { get; set; }
#else
public byte[]? Magic { get; set; }
#endif
/// <summary>
/// Version
@@ -19,7 +23,11 @@ namespace SabreTools.Models.IRD
/// The same value stored in PARAM.SFO / TITLE_ID
/// </summary>
/// <remarks>9 bytes, ASCII, stored without dashes</remarks>
#if NET48
public string TitleID { get; set; }
#else
public string? TitleID { get; set; }
#endif
/// <summary>
/// Number of bytes that follow containing the title
@@ -30,25 +38,41 @@ namespace SabreTools.Models.IRD
/// The same value stored in PARAM.SFO / TITLE
/// </summary>
/// <remarks><see cref="TitleLength"/> bytes, ASCII</remarks>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// The same value stored in PARAM.SFO / PS3_SYSTEM_VER
/// </summary>
/// <remarks>4 bytes, ASCII, missing uses "0000"</remarks>
#if NET48
public string SystemVersion { get; set; }
#else
public string? SystemVersion { get; set; }
#endif
/// <summary>
/// The same value stored in PARAM.SFO / VERSION
/// </summary>
/// <remarks>5 bytes, ASCII</remarks>
#if NET48
public string GameVersion { get; set; }
#else
public string? GameVersion { get; set; }
#endif
/// <summary>
/// The same value stored in PARAM.SFO / APP_VER
/// </summary>
/// <remarks>5 bytes, ASCII</remarks>
#if NET48
public string AppVersion { get; set; }
#else
public string? AppVersion { get; set; }
#endif
/// <summary>
/// Length of the gzip-compressed header data
@@ -58,7 +82,11 @@ namespace SabreTools.Models.IRD
/// <summary>
/// Gzip-compressed header data
/// </summary>
#if NET48
public byte[] Header { get; set; }
#else
public byte[]? Header { get; set; }
#endif
/// <summary>
/// Length of the gzip-compressed footer data
@@ -68,7 +96,11 @@ namespace SabreTools.Models.IRD
/// <summary>
/// Gzip-compressed footer data
/// </summary>
#if NET48
public byte[] Footer { get; set; }
#else
public byte[]? Footer { get; set; }
#endif
/// <summary>
/// Number of complete regions in the image
@@ -78,8 +110,12 @@ namespace SabreTools.Models.IRD
/// <summary>
/// MD5 hashes for all complete regions in the image
/// </summary>
/// <remarks><see cref="RegionCount"/> regions, 16-bytes per hash</remarks>
/// <remarks><see cref="RegionCount"/> regions, 16-bytes per hash</remarks>
#if NET48
public byte[][] RegionHashes { get; set; }
#else
public byte[][]? RegionHashes { get; set; }
#endif
/// <summary>
/// Number of decrypted files in the image
@@ -89,14 +125,22 @@ namespace SabreTools.Models.IRD
/// <summary>
/// Starting sector for each decrypted file
/// </summary>
/// <remarks><see cref="FileCount"/> files, alternating with each <see cref="FileHashes"/> entry</remarks>
/// <remarks><see cref="FileCount"/> files, alternating with each <see cref="FileHashes"/> entry</remarks>
#if NET48
public ulong[] FileKeys { get; set; }
#else
public ulong[]? FileKeys { get; set; }
#endif
/// <summary>
/// MD5 hashes for all decrypted files in the image
/// </summary>
/// <remarks><see cref="FileCount"/> files, 16-bytes per hash, alternating with each <see cref="FileHashes"/> entry</remarks>
/// <remarks><see cref="FileCount"/> files, 16-bytes per hash, alternating with each <see cref="FileHashes"/> entry</remarks>
#if NET48
public byte[][] FileHashes { get; set; }
#else
public byte[][]? FileHashes { get; set; }
#endif
/// <summary>
/// Extra Config, usually 0x0000
@@ -112,19 +156,31 @@ namespace SabreTools.Models.IRD
/// D1 key
/// </summary>
/// <remarks>16 bytes</remarks>
#if NET48
public byte[] Data1Key { get; set; }
#else
public byte[]? Data1Key { get; set; }
#endif
/// <summary>
/// D2 key
/// </summary>
/// <remarks>16 bytes</remarks>
#if NET48
public byte[] Data2Key { get; set; }
#else
public byte[]? Data2Key { get; set; }
#endif
/// <summary>
/// Uncompressed PIC data
/// </summary>
/// <remarks>115 bytes, before D1/D2 keys on version 9</remarks>
#if NET48
public byte[] PIC { get; set; }
#else
public byte[]? PIC { get; set; }
#endif
/// <summary>
/// Unique Identifier