mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
Hacky hack hack
This commit is contained in:
@@ -23,50 +23,13 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// Returns the offset relative to the start of the header
|
||||
/// where the compressed data lives
|
||||
/// </summary>
|
||||
public long CompressedDataOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
long offset = 0;
|
||||
|
||||
offset += 4; // UnknownDataSize
|
||||
offset += 4; // SecondExecutableFileEntryLength
|
||||
offset += 4; // UnknownValue2
|
||||
offset += 4; // UnknownValue3
|
||||
offset += 4; // UnknownValue4
|
||||
offset += 4; // FirstExecutableFileEntryLength
|
||||
offset += 4; // MsiFileEntryLength
|
||||
offset += 4; // UnknownValue7
|
||||
offset += 4; // UnknownValue8
|
||||
offset += 4; // ThirdExecutableFileEntryLength
|
||||
offset += 4; // UnknownValue10
|
||||
offset += 4; // UnknownValue11
|
||||
offset += 4; // UnknownValue12
|
||||
offset += 4; // UnknownValue13
|
||||
offset += 4; // UnknownValue14
|
||||
offset += 4; // UnknownValue15
|
||||
offset += 4; // UnknownValue16
|
||||
offset += 4; // UnknownValue17
|
||||
offset += 4; // UnknownValue18
|
||||
offset += Version?.Length ?? 0;
|
||||
offset += Model.TmpString == null ? 0 : Model.TmpString.Length + 1;
|
||||
offset += Model.GuidString == null ? 0 : Model.GuidString.Length + 1;
|
||||
offset += Model.NonWiseVersion == null ? 0 : Model.NonWiseVersion.Length + 1;
|
||||
offset += Model.PreFontValue == null ? 0 : Model.PreFontValue.Length;
|
||||
offset += 4; // FontSize
|
||||
offset += Model.PreStringValues == null ? 0 : Model.PreStringValues.Length;
|
||||
if (Model.Strings != null)
|
||||
{
|
||||
foreach (var str in Model.Strings)
|
||||
{
|
||||
offset += str.Length;
|
||||
}
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: Find a way for this to be automatically found based on the model
|
||||
/// Likely would be able to replace most of the unknown values with
|
||||
/// an array of values followed by padding bytes. This should be sufficient
|
||||
/// to ensure that all possible values before the temp string are found
|
||||
/// and read properly
|
||||
public long CompressedDataOffset { get; private set; }
|
||||
|
||||
/// <inheritdoc cref="SectionHeader.UnknownDataSize"/>
|
||||
public uint UnknownDataSize => Model.UnknownDataSize;
|
||||
|
||||
@@ -192,8 +155,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
// HACK: Cache the end-of-header offset
|
||||
long endOffset = data.Position;
|
||||
|
||||
data.Seek(currentOffset, SeekOrigin.Begin);
|
||||
return new WiseSectionHeader(model, data);
|
||||
return new WiseSectionHeader(model, data) { CompressedDataOffset = endOffset};
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user