This is sad and terrifying lol
Code:
//Gobals
local int counter = 0;
local int rootPos = 0;
local int rootRot = 0;
local int boneRot = 0;
local int bonePos = 0;
local int subEntAddr[60];
//Data type declaration
typedef struct(int arraySize)
{
local int size = arraySize;
byte array[arraySize];
}ByteArray;
string FlagReader(int flag)
{
/*
0 - rotation
3 - position
5 - root rotation
6 - root position
*/
local string s0;
local int f = flag & ~0x80; //remove 0x80
switch(f)
{
case 0x0:
s0 = "rotation";
boneRot+= 1;
break;
case 0x3:
s0 = "position";
bonePos+= 1;
break;
case 0x5:
s0 = "Root_rot";
rootRot = rootRot + 1;
break;
case 0x6:
s0 = "Root_pos";
rootPos = rootPos + 1;
break;
}
local string s2;
SPrintf(s2, " (0x%02x)",flag);
return s0 +s2;
}
typedef struct
{
local int currPosition = FTell();
int addr; //Maybe +248
short index; //references an index in based on size
subEntAddr[index] = addr+addrbac;
ubyte typeFlag<read=FlagReader, bgcolor=cYellow>; //this is an enum flag bit
ubyte bitSz< bgcolor=cYellow>;
//debug
Printf("\n %02d) Addr: %d (+%d: %d)\n ----------------------------", index, addr,currPosition, addr+currPosition);
Printf("\n %s", FlagReader(typeFlag));
Printf("\n typeFlag: 0x%02x, bitSz: 0x%02x\n", typeFlag, bitSz);
}SubEntry<bgcolor=cLtBlue,optimize=false>;
typedef struct
{
Printf("\n\nEntryx[%d]:\n{", counter);
counter += 1;
uint _hash;
byte subCount; //int
short unkn;
byte pad;
if(subCount > 4)
{
SubEntry sEntry<optimize=false>;
}
else
{
SubEntry sEntry[subCount]<optimize=false>;
}
}Entryx<optimize=false,bgcolor=cLtRed>;
//Generic container?
typedef struct
{
int hash;
int a; //size a?
int fileSize;
// b[2] = number of files?
int b[5];
int hash2;
//c[0] = //size b?
//c[5] = motion headr size (skip char name)
int c[11];
//size of header = size a + size b
}MainHdr;
typedef struct
{
char sig[16];
int64 hash_;
int a,b;
int size;
int unkn;
int __[6];
}MotionHdr;
//Actual entry
MainHdr mHdr;
MotionHdr mothdr;
struct Motion
{
int entryCount; //defonitley
int subEntryCount; //subEntryCount is another count (refereneced by entry) Bones?
int a; //hash
int b; //header size for this motion struct
int c;
int entryAddr[entryCount]; //definitley
local int i = 0;
local int sum = 0;
for(i =0; i < 60; ++i)
{
subEntAddr[i] = -1;
}
subEntAddr[subEntryCount] = FileSize();
int pad[4];
//byte data[sum+16];
for(i = 0; i < entryCount; i++)
{
Entryx dataX;
Printf("}\n");
}
local int j = 0;
local int addrOff = FTell() - dataX[0].sEntry[0].addr;
local int idx =0;
for(i = 0; i < subEntryCount; i++)
{
Printf("\n%d - %d : %d",subEntAddr[i],subEntAddr[i+1], subEntAddr[i+1]-subEntAddr[i]);
ByteArray bArr(subEntAddr[i+1]-subEntAddr[i])<bgcolor=cLtGreen>;
}
}motion;
Printf("\n\nTrackStats: %d rootPosition(s), %d rootRotation(s), %d bonePos(s), %d boneRot(s)", rootPos, rootRot, bonePos, boneRot);