Code:
goto 0x80 0 SEEK_CUR
get basename basename
get fullsize asize
savepos start
get entryCount long
get unk2 long
get dataStart long
xmath dataStart "start + dataStart + 16"
goto dataStart
for i = 0 < entryCount
get tableOffset long
goto 0x8 0 SEEK_CUR
getdstring type 0x24
strlen typeLen type
math typeLen -= 2
string subtype = type
string subtype > typeLen
goto 0x90 0 SEEK_CUR
savepos next
if tableOffset != 0
goto tableOffset 0 SEEK_SET
goto 0x20 0 SEEK_CUR
get actualDataOffset long
xmath actualDataOffset "tableOffset + actualDataOffset"
get dataSize long
string name = basename
string name += "_"
string name += i
string name += .
if subtype == "T-"
#string name += type
string name += ".TMX"
elif subtype == "MO"
#string name += type
string name += ".RMD"
elif subtype == "P-"
#string name += type
string name += ".TMX"
else
string name += type
endif
if fullsize > actualDataOffset
if fullsize > dataSize
if datasize > 8
log name actualDataOffset dataSize
endif
endif
endif
endif
goto next 0 SEEK_SET
next i