Skip to content

Commit

Permalink
BinaryDataTree corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
kornman00 committed Oct 28, 2017
1 parent d8255b8 commit 5afc858
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions 010Editor/BinaryDataTree.bt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "HaloWarsUtils.bt"

local uint64 kBinaryDataTreeBaseOffset = UINT64_MAX;
local uint64 kBinaryDataTreeNameDataOffset = UINT64_MAX;
local uint64 kBinaryDataTreeValueDataOffset = UINT64_MAX;

Expand Down Expand Up @@ -146,18 +147,32 @@ string BBinaryDataTreeNameValueToString(BBinaryDataTreeNameValue& v)
if (TypeClass == cTypeNull)
return name;

local string StringValue = "";
if (TypeClass == cTypeString && !DirectEncoding)
{
if (SizeInBytes == 0)
StringValue = ReadString(kBinaryDataTreeValueDataOffset + v.Value);
}

local string s;
SPrintf(s,
"%s %s %s"
"%s%s %u %u %s %s %s %s"
, IsUnsigned ? "U" : " "
, DirectEncoding ? "D" : " "
, 1<<SizeInBytes
, TotalDataSize
, TypeClassToString(TypeClass)
, name
, StringValue
, IsLastName ? "LAST" : ""
);
return s;
}

struct BBinaryDataTree
{
kBinaryDataTreeBaseOffset = FTell();

BBinaryDataTreeHeader Header;

if (Header.NumUserSections > 0)
Expand All @@ -183,7 +198,7 @@ struct BBinaryDataTree
kBinaryDataTreeValueDataOffset = UINT64_MAX;
if (ValueDataSize > 0)
{
ValueDataOffset = AlignUpValue(FTell(), 16);
ValueDataOffset = kBinaryDataTreeBaseOffset + AlignUpValue(FTell() - kBinaryDataTreeBaseOffset, 16);
kBinaryDataTreeValueDataOffset = ValueDataOffset;
}

Expand Down
4 changes: 2 additions & 2 deletions 010Editor/HaloWarsUtils.bt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ typedef struct
} Vector3F <read=Vector3FRead, write=Vector3FWrite>;
string Vector3FRead(Vector3F& v)
{
string s;
local string s;
SPrintf(s, "(%g, %g, %g)", v.x, v.y, v.z);
return s;
}
Expand All @@ -113,7 +113,7 @@ typedef struct
} XMVECTOR <read=XMVECTORRead, write=XMVECTORWrite>;
string XMVECTORRead(XMVECTOR& v)
{
string s;
local string s;
SPrintf(s, "(%g, %g, %g, %g)", v.x, v.y, v.z, v.w);
return s;
}
Expand Down

0 comments on commit 5afc858

Please sign in to comment.