Skip to content

Commit

Permalink
Account for padding in data size
Browse files Browse the repository at this point in the history
  • Loading branch information
burninrubber0 committed Dec 23, 2023
1 parent 65a246c commit 3d81c0b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion VaultFormat/Physicsvehiclebaseattribs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class Physicsvehiclebaseattribs : IAttribute
public float CrashExtraPitchVelocityFactor { get; set; }
public float CrashExtraLinearVelocityFactor { get; set; }
public float AngularDrag { get; set; }
public int PaddingLength { get; set; }
public AttributeHeader header { get; set; }
public SizeAndPositionInformation info { get; set; }
public Physicsvehiclebaseattribs(SizeAndPositionInformation chunk, AttributeHeader dataChunk)
Expand Down Expand Up @@ -155,7 +156,7 @@ public int getDataSize()
BitConverter.GetBytes(AngularDrag)
};
// No padding needed
return bytes.SelectMany(i => i).Count();
return bytes.SelectMany(i => i).Count() + PaddingLength;
}

public AttributeHeader getHeader()
Expand All @@ -170,7 +171,9 @@ public SizeAndPositionInformation getInfo()

public void Read(ILoader loader, BinaryReader2 br)
{
int pos = (int)br.BaseStream.Position;
br.Align(0x10);
PaddingLength = (int)br.BaseStream.Position - pos;
RearRightWheelPosition = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
FrontRightWheelPosition = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
CoMOffset = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
Expand Down

0 comments on commit 3d81c0b

Please sign in to comment.