The problem is that the MDS files are of unknown size. There is information in the SCN header about the files contained within and their filesizes but I don't know how to parse all that data.
I'm trying to find a way to scan for \x4D\x44\x53\x00\x01\x00\x00\x00 which is the start of the MDS file, then I try to find the second instance of the same header and extract the data in between.
This is what I'm experimenting with:
Code: Select all
for FILES = 0
FindLoc OFFSET1 string "\x4D\x44\x53\x00\x01\x00\x00\x00"
goto OFFSET1
idstring "\x4D\x44\x53\x00\x01\x00\x00\x00"
print "offset1: %offset1%"
FindLoc OFFSET2 string "\x4D\x44\x53\x00\x01\x00\x00\x00"
goto OFFSET2
idstring "\x4D\x44\x53\x00\x01\x00\x00\x00"
print "offset2: %offset2%"
set SIZE LONG OFFSET2
math SIZE -= OFFSET1 #Subtract OFFSET1 from OFFSET 2
Log "" OFFSET1 SIZE
math OFFSET1 += SIZE
goto OFFSET1
print "SIZE %SIZE%"
next FILES
NOTES: There's a PTS header that contain the filenames within each model set and the size.
My current script only extracts some of the files successfully, the rest don't open correctly.
More simply, I'm trying to find the first MDS to the second MDS and extract the file in between. Then move on to the next.
Thanks in advance