Add sim parsing for Steam2 sim/sid installers#95
Conversation
| { | ||
| public static readonly byte[] SimSignatureBytes = [0x1F, 0x4C, 0xD0, 0x3F]; | ||
|
|
||
| public const uint SimSignatureUInt32 = 0x3FD04C1F; // All other values in the structure are little endian, assuming this is too |
There was a problem hiding this comment.
The postfix comment can be made into a <remarks>
| /// <summary> | ||
| /// The set of sid file volumes | ||
| /// </summary> | ||
| // public SidFile[] Sid { get; set; } = new(); |
There was a problem hiding this comment.
If this gets uncommented at some point, the proper syntax would be [] not new().
| { | ||
| // Cache the current offset | ||
| long initialOffset = data.Position; | ||
| // Create a new Steam2 Installer set to populate |
There was a problem hiding this comment.
Nitpick: Newline before this comment
| } | ||
| } | ||
|
|
||
| public static SimFile? ParseSim(Stream data) |
There was a problem hiding this comment.
Nitpick: Generic Parse summary should be added.
|
|
||
| // Try to parse the entry table | ||
| var table = ParseTable(data, fileEntriesCount, stringsBytes); | ||
| if (table == null || table.Length != fileEntriesCount) |
There was a problem hiding this comment.
Nitpick: Currently prefer the is null syntax instead of == null
|
|
||
| // Read file path and name strings | ||
| int nameOffset = (int)obj.NameOffset; | ||
| int pathOffset = (int)obj.PathOffset; |
There was a problem hiding this comment.
Nitpick: You can move the pathOffset creation to above the path read.
| // Read file path and name strings | ||
| int nameOffset = (int)obj.NameOffset; | ||
| int pathOffset = (int)obj.PathOffset; | ||
| string? name = stringsBytes.ReadNullTerminatedAnsiString(ref nameOffset); // Unsure on encoding, assumed ascii/ansi |
There was a problem hiding this comment.
Would an empty string be valid for either of these cases? Like if it was just \0 is that possible?
There was a problem hiding this comment.
Not as far as I'm aware or have seen.
I don't think an empty string would be a valid case, we've certainly never encountered one
This PR adds sim parsing for the steam2 installer sim/sid set. Sid parsing will come in a later PR. Sid parsing won't be included in the main serialization for similar reasons as for why MSCABs currently do not have their data parsed unless you're extracting.