Skip to content

Instantly share code, notes, and snippets.

@x1nixmzeng
Last active May 29, 2017 23:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x1nixmzeng/ffeab42c5d0d3549f945 to your computer and use it in GitHub Desktop.
Save x1nixmzeng/ffeab42c5d0d3549f945 to your computer and use it in GitHub Desktop.
First Alien Isolation BML work
// superseeded by https://github.com/x1nixmzeng/AlienBML
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//--------------------------------------
//--- 010 Editor v5.0 Binary Template
//--- Author: WRS (xentax.com)
// Types ----
// annoyingly we can't pass a structure with a local string
// to save off the value, even passing by reference
typedef uint BMLStr <read=GetBMLString>;
string GetBMLString( BMLStr ref )
{
string Val = ReadString(ref);
string info;
SPrintf(info, "%s (%u chars)", Val, Strlen(Val));
return info;
}
// Data structures ----
struct Header
{
char XML[4]; // "xml\0"
uint off1, off2, off3; // pointers to blocks
};
struct Attrib
{
BMLStr Name, Value;
};
struct Flags
{
uint AttribCount : 8,
a : 4, // ??
b : 4, //
c : 8,
d : 8;
Printf("%u %u %u %u\n", a, b, c, d);
};
struct Node;
struct Node//(int depth)
{
// if( depth > 5 ) Exit(0);
BMLStr Name;
Flags flags;
if( flags.AttribCount > 0 ) Attrib a[flags.AttribCount];
// xxxx the bit checks can be worked out from this switch table
switch(flags.a)
{
case 1:
case 9:
BMLStr lb; uint Child;
break;
case 7:
BMLStr l1, l2;
if(flags.b > 0) uint Child;
break;
case 3:
BMLStr l1, l2;
if(flags.b > 0) uint Child;
break;
case 2:
case 6:
BMLStr lb;
break;
case 8:
uint Child;
break;
case 11:
case 15:
BMLStr l1, l2; uint Child;
break;
default: Exit(2);
}
};
// Format ----
Header hdr;
//Node root(0);
do
{
Node node;
if( !(node.Name > hdr.off1 && node.Name < hdr.off2 ) )
{
Warning("Failed to read name");
}
}
while(FTell()+2<hdr.off1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment