Thanks for the help aluigi.
Note: Skips CAT 0x18 to avoid deciphering HEAP in R_PERM.
Code: Select all
get ARCHIVE_SIZE asize
get DUMMY long
get ENDTEST short
if ENDTEST == 0
endian big
math ENDIPAD = 0x20
endif
for OFFSET = 0 < ARCHIVE_SIZE
math valid = 1
goto OFFSET
get CAT short
get DUMMY short
get SIZE long
getdstring NAME 0x18
math OFFSET += 0x20
math OFFSET += ENDIPAD
if NAME == "EntityCount" || CAT == 0x18
math SIZE = 0
math valid = 0
endif
if valid != 0 && size > 0
log NAME OFFSET SIZE
endif
math OFFSET += SIZE
math OFFSET x= 0x10
next
List of non-standard WADs not covered by this script:
GoW2 - R_mcicon.wad_ps3
GoW3 - R_NETWORK.WAD
GoWA - R_MULTIPLAYER.WAD
And here's a 010 template I've started cobbling together. Seems pretty successful at parsing the data groups (Only tested against PS2 WADs thus far), but currently makes no attempt at further parsing the files that get exposed.
Code: Select all
//------------------------------------------------
//--- 010 Editor v13.0 Binary Template
//
// File: God of War, *.WAD
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
if (size > 0)
{
char data[size] <hidden=true>;
}
pad();
parse();
} PUSHHW;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
pad();
} POPHW;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
if (size > 0)
{
char data[size] <hidden=true>;
}
pad();
parse();
} PUSHCONTEXT;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
pad();
} POPCONTEXT;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
if (size > 0)
{
char data[size] <hidden=true>;
}
pad();
} CLIENTPARM;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
pad();
parse();
} GROUPSTART;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
pad();
} GROUPEND;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int val <hidden=true>;
char chunkName[0x18] <hidden=true>;
pad();
Printf("%s = %d\n", chunkName, val);
} DYNASTRING;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
if (size > 0)
{
char data[size] <hidden=true>;
}
pad();
} DATABLOCK;
typedef struct {
int16 chunkID <format=hex, hidden=true>;
int16 unk1 <hidden=true>;
int size <format=hex, hidden=true>;
char chunkName[0x18] <hidden=true>;
if (size > 0)
{
char unk[size] <hidden=true>;
}
pad();
} UNKCHUNK;
void parse()
{
local byte deeper = 1;
while (deeper == 1)
{
if (FEof()) {return;}
switch(ReadShort(FTell()))
{
case 0x18:
DYNASTRING DynaString <open=false, read=Str("%s = %d", chunkName, val)>;
break;
case 0x1E:
CLIENTPARM ClientParm <open=true, read=chunkName>;
break;
case 0x28:
GROUPSTART Group <open=true>;
break;
case 0x32:
GROUPEND GroupEnd <hidden=true>;
return;
break;
case 0x46:
case 0x29A:
PUSHCONTEXT PushContext <open=true, read=chunkName>;
break;
case 0x50:
case 0x309:
POPCONTEXT PopContext <hidden=true>;
break;
case 0x6f:
DATABLOCK DataBlock <read=chunkName>;
break;
case 0x378:
PUSHHW PushHW <open=true, read=chunkName>;
break;
case 0x3E7:
POPHW PopHW <hidden=true>;
return;
break;
default:
UNKCHUNK unkChunk <open=true, read=chunkName>;
break;
}
}
}
void pad()
{
local int pos = FTell();
local int pad = 0x10 - (pos % 0x10);
if (pad < 0x10)
{
char padding[pad] <hidden=true>;
}
}
struct FILE {
parse();
} file <open=true>;