From cd67a7282b72e89df9641e769d91453ff6967833 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 23 Oct 2023 11:33:50 -0400 Subject: [PATCH] Add version guards to IRD model --- IRD/File.cs | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/IRD/File.cs b/IRD/File.cs index bc9e43d..4228325 100644 --- a/IRD/File.cs +++ b/IRD/File.cs @@ -7,7 +7,11 @@ namespace SabreTools.Models.IRD /// /// "3IRD" /// +#if NET48 public byte[] Magic { get; set; } +#else + public byte[]? Magic { get; set; } +#endif /// /// Version @@ -19,7 +23,11 @@ namespace SabreTools.Models.IRD /// The same value stored in PARAM.SFO / TITLE_ID /// /// 9 bytes, ASCII, stored without dashes +#if NET48 public string TitleID { get; set; } +#else + public string? TitleID { get; set; } +#endif /// /// Number of bytes that follow containing the title @@ -30,25 +38,41 @@ namespace SabreTools.Models.IRD /// The same value stored in PARAM.SFO / TITLE /// /// bytes, ASCII +#if NET48 public string Title { get; set; } +#else + public string? Title { get; set; } +#endif /// /// The same value stored in PARAM.SFO / PS3_SYSTEM_VER /// /// 4 bytes, ASCII, missing uses "0000" +#if NET48 public string SystemVersion { get; set; } +#else + public string? SystemVersion { get; set; } +#endif /// /// The same value stored in PARAM.SFO / VERSION /// /// 5 bytes, ASCII +#if NET48 public string GameVersion { get; set; } +#else + public string? GameVersion { get; set; } +#endif /// /// The same value stored in PARAM.SFO / APP_VER /// /// 5 bytes, ASCII +#if NET48 public string AppVersion { get; set; } +#else + public string? AppVersion { get; set; } +#endif /// /// Length of the gzip-compressed header data @@ -58,7 +82,11 @@ namespace SabreTools.Models.IRD /// /// Gzip-compressed header data /// +#if NET48 public byte[] Header { get; set; } +#else + public byte[]? Header { get; set; } +#endif /// /// Length of the gzip-compressed footer data @@ -68,7 +96,11 @@ namespace SabreTools.Models.IRD /// /// Gzip-compressed footer data /// +#if NET48 public byte[] Footer { get; set; } +#else + public byte[]? Footer { get; set; } +#endif /// /// Number of complete regions in the image @@ -78,8 +110,12 @@ namespace SabreTools.Models.IRD /// /// MD5 hashes for all complete regions in the image /// - /// regions, 16-bytes per hash + /// regions, 16-bytes per hash +#if NET48 public byte[][] RegionHashes { get; set; } +#else + public byte[][]? RegionHashes { get; set; } +#endif /// /// Number of decrypted files in the image @@ -89,14 +125,22 @@ namespace SabreTools.Models.IRD /// /// Starting sector for each decrypted file /// - /// files, alternating with each entry + /// files, alternating with each entry +#if NET48 public ulong[] FileKeys { get; set; } +#else + public ulong[]? FileKeys { get; set; } +#endif /// /// MD5 hashes for all decrypted files in the image /// - /// files, 16-bytes per hash, alternating with each entry + /// files, 16-bytes per hash, alternating with each entry +#if NET48 public byte[][] FileHashes { get; set; } +#else + public byte[][]? FileHashes { get; set; } +#endif /// /// Extra Config, usually 0x0000 @@ -112,19 +156,31 @@ namespace SabreTools.Models.IRD /// D1 key /// /// 16 bytes +#if NET48 public byte[] Data1Key { get; set; } +#else + public byte[]? Data1Key { get; set; } +#endif /// /// D2 key /// /// 16 bytes +#if NET48 public byte[] Data2Key { get; set; } +#else + public byte[]? Data2Key { get; set; } +#endif /// /// Uncompressed PIC data /// /// 115 bytes, before D1/D2 keys on version 9 +#if NET48 public byte[] PIC { get; set; } +#else + public byte[]? PIC { get; set; } +#endif /// /// Unique Identifier