mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
Split unknown AddD field, fix TODO
This commit is contained in:
@@ -37,19 +37,26 @@
|
||||
public string? Build { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unknown (0x14h), Variable number of bytes before entry table
|
||||
/// Unknown
|
||||
/// </summary>
|
||||
/// <remarks>44 bytes</remarks>
|
||||
public byte[]? Unknown1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Product ID?
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 44 bytes in EXPUNGED, 3.17.00.0017, 3.17.00.0019, 4.47.00.0039
|
||||
/// 112 bytes in 4.84.00.0054, 4.84.69.0037, 4.84.76.7966, 4.84.76.7968, 4.85.07.0009
|
||||
/// 112 byte range contains a fixed-length string at 0x2C, possibly a product ID?
|
||||
/// "801400-001" in 4.84.00.0054
|
||||
/// "594130-001" in 4.84.69.0037
|
||||
/// "554900-001" in 4.84.76.7966
|
||||
/// "554900-001" in 4.84.76.7968
|
||||
/// "548520-001" in 4.85.07.0009
|
||||
/// 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 byte[]? Unknown { get; set; }
|
||||
public string? ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unknown
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 58 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 byte[]? Unknown2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Entry table
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using SabreTools.Data.Models.SecuROM;
|
||||
using SabreTools.IO.Extensions;
|
||||
using static SabreTools.Data.Models.SecuROM.Constants;
|
||||
@@ -48,9 +49,21 @@ namespace SabreTools.Serialization.Readers
|
||||
obj.Version = data.ReadNullTerminatedAnsiString();
|
||||
byte[] buildBytes = data.ReadBytes(4);
|
||||
obj.Build = Encoding.ASCII.GetString(buildBytes);
|
||||
obj.Unknown1 = data.ReadBytes(44);
|
||||
|
||||
// TODO: Figure out how to determine how many bytes are here consistently
|
||||
obj.Unknown = data.ReadBytes(1);
|
||||
// Peek at the next 10 bytes
|
||||
long currentOffset = data.Position;
|
||||
byte[] temp = data.ReadBytes(10);
|
||||
string tempString = Encoding.ASCII.GetString(temp);
|
||||
data.Seek(currentOffset, SeekOrigin.Begin);
|
||||
|
||||
// If the temp string is a regex match for an ID
|
||||
if (Regex.IsMatch(tempString, @"[0-9]{6}-[0-9]{3}"))
|
||||
{
|
||||
byte[] productIdBytes = data.ReadBytes(10);
|
||||
obj.ProductId = Encoding.ASCII.GetString(productIdBytes);
|
||||
obj.Unknown2 = data.ReadBytes(58);
|
||||
}
|
||||
|
||||
obj.Entries = new AddDEntry[obj.EntryCount];
|
||||
for (int i = 0; i < obj.Entries.Length; i++)
|
||||
|
||||
Reference in New Issue
Block a user