SecuROM model cleanup

This commit is contained in:
Matt Nadareski
2025-10-30 23:34:06 -04:00
parent b9f03b02f0
commit 1ebec97e0e
11 changed files with 28 additions and 38 deletions

View File

@@ -13,7 +13,7 @@
/// <summary>
/// "AddD"
/// </summary>
public string? Signature { get; set; }
public string Signature { get; set; }
/// <summary>s
/// Entry count
@@ -24,13 +24,13 @@
/// Version, null-terminated
/// </summary>
/// <remarks>Always 8 bytes?</remarks>
public string? Version { get; set; }
public string Version { get; set; }
/// <summary>
/// Build number
/// </summary>
/// <remarks>4 bytes</remarks>
public string? Build { get; set; }
public string Build { get; set; }
/// <summary>
/// Unknown
@@ -44,7 +44,7 @@
/// <remarks>
/// 10 bytes, only present in 4.84.00.0054, 4.84.69.0037, 4.84.76.7966, 4.84.76.7968, 4.85.07.0009
/// </remarks>
public string? ProductId { get; set; }
public string ProductId { get; set; }
/// <summary>
/// Unknown
@@ -57,6 +57,6 @@
/// <summary>
/// Entry table
/// </summary>
public AddDEntry[]? Entries { get; set; }
public AddDEntry[] Entries { get; set; }
}
}

View File

@@ -112,7 +112,7 @@ namespace SabreTools.Data.Models.SecuROM
/// </summary>
/// <remarks>12 bytes long in all samples</remarks>
[MarshalAs(UnmanagedType.LPStr)]
public string? FileName;
public string FileName;
/// <summary>
/// Unknown (0x2C)

View File

@@ -127,4 +127,4 @@ namespace SabreTools.Data.Models.SecuROM
#endregion
}
}
}

View File

@@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.SecuROM
/// <summary>
/// All entries in the file
/// </summary>
public DFAEntry[]? Entries { get; set; }
public DFAEntry[] Entries { get; set; }
}
}

View File

@@ -29,8 +29,8 @@ namespace SabreTools.Data.Models.SecuROM
Dependency = 0x04,
/// <summary>
/// Similar use to <see cref="Dependency"/>
/// Similar use to <see cref="Dependency"/>
/// </summary>
Unknown0x08 = 0x08,
}
}
}

View File

@@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.SecuROM
/// Versions with key values either are 256 or 512 bytes.
/// Stored as a string as the rest of the 256/512 bytes are just padding.
/// </remarks>
public string? Path { get; set; }
public string Path { get; set; }
/// <summary>
/// Type of the entry data

View File

@@ -19,7 +19,7 @@ namespace SabreTools.Data.Models.SecuROM
/// "MatR"
/// </summary>
/// <remarks>4 bytes</remarks>
public string? Signature { get; set; }
public string Signature { get; set; }
/// <summary>
/// Number of internal entries
@@ -79,8 +79,8 @@ namespace SabreTools.Data.Models.SecuROM
#endregion
/// <summary>
/// Entries array whose length is given by <see cref="EntryCount"/>
/// Entries array whose length is given by <see cref="EntryCount"/>
/// </summary>
public MatroshkaEntry[]? Entries { get; set; }
public MatroshkaEntry[] Entries { get; set; }
}
}
}

View File

@@ -24,11 +24,11 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.Entries);
}
private static void Print(StringBuilder builder, DFAEntry[]? entries)
private static void Print(StringBuilder builder, DFAEntry[] entries)
{
builder.AppendLine(" Entries Information:");
builder.AppendLine(" -------------------------");
if (entries == null || entries.Length == 0)
if (entries.Length == 0)
{
builder.AppendLine(" No entries");
builder.AppendLine();
@@ -38,24 +38,14 @@ namespace SabreTools.Serialization.Wrappers
for (int i = 0; i < entries.Length; i++)
{
var entry = entries[i];
Print(builder, entry, i);
builder.AppendLine($" Entry {i}");
builder.AppendLine(entry.Name, " Name");
builder.AppendLine(entry.Length, " Length");
builder.AppendLine(entry.Value, " Value");
}
builder.AppendLine();
}
private static void Print(StringBuilder builder, DFAEntry? entry, int index)
{
builder.AppendLine($" Entry {index}");
if (entry == null)
{
builder.AppendLine(" [NULL]");
return;
}
builder.AppendLine(entry.Name, " Name");
builder.AppendLine(entry.Length, " Length");
builder.AppendLine(entry.Value, " Value");
}
}
}

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Serialization.Wrappers
public bool Extract(string outputDirectory, bool includeDebug)
{
// If we have no entries
if (Entries == null || Entries.Length == 0)
if (Entries.Length == 0)
return false;
// Loop through and extract all files to the output
@@ -34,7 +34,7 @@ namespace SabreTools.Serialization.Wrappers
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
{
// If we have no entries
if (Entries == null || Entries.Length == 0)
if (Entries.Length == 0)
return false;
// If the entry index is invalid
@@ -128,4 +128,4 @@ namespace SabreTools.Serialization.Wrappers
return fileData;
}
}
}
}

View File

@@ -29,11 +29,11 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.Entries);
}
private static void Print(StringBuilder builder, MatroshkaEntry[]? entries)
private static void Print(StringBuilder builder, MatroshkaEntry[] entries)
{
builder.AppendLine(" Entries Information:");
builder.AppendLine(" -------------------------");
if (entries == null || entries.Length == 0)
if (entries.Length == 0)
{
builder.AppendLine(" No entries");
builder.AppendLine();

View File

@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Wrappers
public uint? Padding => Model.Padding;
/// <inheritdoc cref="MatroshkaPackage.Entries"/>
public MatroshkaEntry[]? Entries => Model.Entries;
public MatroshkaEntry[] Entries => Model.Entries;
#endregion