mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-04 05:36:12 +00:00
IRD model cleanup
This commit is contained in:
@@ -19,7 +19,7 @@ namespace SabreTools.Data.Models.IRD
|
||||
/// The same value stored in PARAM.SFO / TITLE_ID
|
||||
/// </summary>
|
||||
/// <remarks>9 bytes, ASCII, stored without dashes</remarks>
|
||||
public string? TitleID { get; set; }
|
||||
public string TitleID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes that follow containing the title
|
||||
@@ -30,25 +30,25 @@ namespace SabreTools.Data.Models.IRD
|
||||
/// The same value stored in PARAM.SFO / TITLE
|
||||
/// </summary>
|
||||
/// <remarks><see cref="TitleLength"/> bytes, ASCII</remarks>
|
||||
public string? Title { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The same value stored in PARAM.SFO / PS3_SYSTEM_VER
|
||||
/// </summary>
|
||||
/// <remarks>4 bytes, ASCII, missing uses "0000"</remarks>
|
||||
public string? SystemVersion { get; set; }
|
||||
public string SystemVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The same value stored in PARAM.SFO / VERSION
|
||||
/// </summary>
|
||||
/// <remarks>5 bytes, ASCII</remarks>
|
||||
public string? GameVersion { get; set; }
|
||||
public string GameVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The same value stored in PARAM.SFO / APP_VER
|
||||
/// </summary>
|
||||
/// <remarks>5 bytes, ASCII</remarks>
|
||||
public string? AppVersion { get; set; }
|
||||
public string AppVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length of the gzip-compressed header data
|
||||
@@ -79,7 +79,7 @@ namespace SabreTools.Data.Models.IRD
|
||||
/// MD5 hashes for all complete regions in the image
|
||||
/// </summary>
|
||||
/// <remarks><see cref="RegionCount"/> regions, 16-bytes per hash</remarks>
|
||||
public byte[][]? RegionHashes { get; set; }
|
||||
public byte[][] RegionHashes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of decrypted files in the image
|
||||
@@ -90,13 +90,13 @@ namespace SabreTools.Data.Models.IRD
|
||||
/// Starting sector for each decrypted file
|
||||
/// </summary>
|
||||
/// <remarks><see cref="FileCount"/> files, alternating with each <see cref="FileHashes"/> entry</remarks>
|
||||
public ulong[]? FileKeys { get; set; }
|
||||
public ulong[] FileKeys { get; set; }
|
||||
|
||||
/// <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>
|
||||
public byte[][]? FileHashes { get; set; }
|
||||
public byte[][] FileHashes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Extra Config, usually 0x0000
|
||||
|
||||
@@ -27,22 +27,23 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine(Model.Header, "Header");
|
||||
builder.AppendLine(Model.FooterLength, "Footer length");
|
||||
builder.AppendLine(Model.Footer, "Footer");
|
||||
|
||||
builder.AppendLine(Model.RegionCount, "Region count");
|
||||
if (Model.RegionCount != 0 && Model.RegionHashes != null && Model.RegionHashes.Length != 0)
|
||||
if (Model.RegionCount != 0 && Model.RegionHashes.Length != 0)
|
||||
{
|
||||
for (int i = 0; i < Model.RegionCount; i++)
|
||||
{
|
||||
builder.AppendLine(Model.RegionHashes[i], $"Region {i} hash");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine(Model.FileCount, "File count");
|
||||
for (int i = 0; i < Model.FileCount; i++)
|
||||
{
|
||||
if (Model.FileKeys != null)
|
||||
builder.AppendLine(Model.FileKeys[i], $"File {i} key");
|
||||
if (Model.FileHashes != null)
|
||||
builder.AppendLine(Model.FileHashes[i], $"File {i} hash");
|
||||
builder.AppendLine(Model.FileKeys[i], $"File {i} key");
|
||||
builder.AppendLine(Model.FileHashes[i], $"File {i} hash");
|
||||
}
|
||||
|
||||
builder.AppendLine(Model.ExtraConfig, "Extra config");
|
||||
builder.AppendLine(Model.Attachments, "Attachments");
|
||||
builder.AppendLine(Model.Data1Key, "Data 1 key");
|
||||
|
||||
@@ -23,31 +23,31 @@ namespace SabreTools.Serialization.Writers
|
||||
return null;
|
||||
|
||||
// If any static-length fields aren't the correct length
|
||||
if (obj.TitleID == null || obj.TitleID.Length != 9)
|
||||
if (obj.TitleID.Length != 9)
|
||||
return null;
|
||||
if (obj.Title == null || obj.Title.Length != obj.TitleLength)
|
||||
if (obj.Title.Length != obj.TitleLength)
|
||||
return null;
|
||||
if (obj.SystemVersion == null || obj.SystemVersion.Length != 4)
|
||||
if (obj.SystemVersion.Length != 4)
|
||||
return null;
|
||||
if (obj.GameVersion == null || obj.GameVersion.Length != 5)
|
||||
if (obj.GameVersion.Length != 5)
|
||||
return null;
|
||||
if (obj.AppVersion == null || obj.AppVersion.Length != 5)
|
||||
if (obj.AppVersion.Length != 5)
|
||||
return null;
|
||||
if (obj.Header == null || obj.Header.Length != obj.HeaderLength)
|
||||
if (obj.Header.Length != obj.HeaderLength)
|
||||
return null;
|
||||
if (obj.Footer == null || obj.Footer.Length != obj.FooterLength)
|
||||
if (obj.Footer.Length != obj.FooterLength)
|
||||
return null;
|
||||
if (obj.RegionHashes == null || obj.RegionHashes.Length != obj.RegionCount || !Array.TrueForAll(obj.RegionHashes, h => h == null || h.Length != 16))
|
||||
if (obj.RegionHashes.Length != obj.RegionCount || !Array.TrueForAll(obj.RegionHashes, h => h == null || h.Length != 16))
|
||||
return null;
|
||||
if (obj.FileKeys == null || obj.FileKeys.Length != obj.FileCount)
|
||||
if (obj.FileKeys.Length != obj.FileCount)
|
||||
return null;
|
||||
if (obj.FileHashes == null || obj.FileHashes.Length != obj.FileCount || !Array.TrueForAll(obj.FileHashes, h => h == null || h.Length != 16))
|
||||
if (obj.FileHashes.Length != obj.FileCount || !Array.TrueForAll(obj.FileHashes, h => h == null || h.Length != 16))
|
||||
return null;
|
||||
if (obj.PIC == null || obj.PIC.Length != 115)
|
||||
if (obj.PIC.Length != 115)
|
||||
return null;
|
||||
if (obj.Data1Key == null || obj.Data1Key.Length != 16)
|
||||
if (obj.Data1Key.Length != 16)
|
||||
return null;
|
||||
if (obj.Data2Key == null || obj.Data2Key.Length != 16)
|
||||
if (obj.Data2Key.Length != 16)
|
||||
return null;
|
||||
|
||||
// Create the output stream
|
||||
|
||||
Reference in New Issue
Block a user