With the new v16 update comes a new special attribute called <pos=...>
And I realized that this is almost a pointer. Almost.
Before that, I always parsed the file as it is laid out in the binary file:
typedef struct _LmHeader
{
uint32 magic;
uint32 materialCount;
uint32 materialsPtr <format=hex, comment=“s_Material*”>;
uint32 modelCount;
uint32 modelHeadersPtr <format=hex, comment=“s_ModelHeader*”>;
} s_LmHeader;
s_LmHeader lmHeader;
// extra parsing from here
FSeek ( lmHeader.materialsPtr );
s_Material material [ lmHeader.materialCount ];
FSeek ( lmHeader.modelHeadersPtr );
s_ModelHeader modelHeaders [ lmHeader.modelCount ];
But now with <pos=...> it is almost possible to parse a file like a real C struct:
uint32 magic;
uint32 materialCount;
s_Material materials[materialCount] <pos=...”>;
uint32 modelCount;
s_ModelHeader modelHeaders[modelCount] <pos=...”>;
} s_LmHeader;
s_LmHeader lmHeader;
You just need to do some workarounds, like:
typedef struct _LmHeader
{
uint32 magic;
uint32 materialCount;
s_Material materials[materialCount] <pos=ReadUInt(), optimize=true>; FSkip(4);
uint32 modelCount;
s_ModelHeader modelHeaders[modelCount] <pos=ReadUInt(), optimize=true>; FSkip(4);
} s_LmHeader;
s_LmHeader lmHeader;
or:
typedef struct _LmHeader
{
uint32 magic;
uint32 materialCount;
uint32 materialsPtr;
s_Material materials[materialCount] <pos=materialsPtr, optimize=true>;
uint32 modelCount;
uint32 modelHeadersPtr
s_ModelHeader modelHeaders[modelCount] <pos=modelHeadersPtr, optimize=true>;
} s_LmHeader;
s_LmHeader lmHeader;
And after that, you don’t need to do extra parsing, because you already did that in the header struct. So if not for workarounds, the BT files would look cleaner.
But the drawback is that the parsed file itself is out of order in the results screen.
So it is more confusing to look at the results.
How do you recommend parsing pointers?
Also, maybe we could think about a new pointers feature for v17?
Similar to <pos=...> maybe? Or classical * as a pointer. It would just work similarly to pos.
Also, in the result screen, it could be a hyperlink or a shortcut on a pointer that you can click on, and it sends you to the pointed variable.
And lastly, it is best to view results in order as they appear in a binary file, so maybe there could be a rearrangement button, so all variables would be arranged by the offsets?
