I'm checking the script just now.
The script is able to handle 3 different formats that are basically just the same archive that can be splitted in compressed chunks (segs), compressed (dfas) and not compressed (pfd).
The problem is the first one, the chunks-based format.
I don't know if the game runs with a dfas or pfd archive if it expects a segs one, probably not.
That's the first part of the script, the second part is not a problem.
Anyway if you want to test:
STEP1.bms:
Code:
get BASE_NAME basename
string BASE_NAME += /
comtype deflate
endian big
getdstring SIGN 4
math WORKAROUND = 0
if SIGN == "segs"
get DUMMY short
get CHUNKS short
get FULL_SIZE long
get FULL_ZSIZE long
savepos BASE_OFF
xmath BASE_OFF "BASE_OFF + (CHUNKS * 8)"
#putvarchr "step1.dat" 0 FULL_SIZE
log "step1.dat" 0 0
append
for i = 0 < CHUNKS
get ZSIZE short
get SIZE short
get OFFSET long
math OFFSET -= 1
if i == 0
if OFFSET == 0
math WORKAROUND = 1
endif
endif
if WORKAROUND != 0
math OFFSET + BASE_OFF
endif
if SIZE == 0
math SIZE = 0x00010000
endif
clog "step1.dat" OFFSET ZSIZE SIZE
next i
append
elif SIGN == "DFAS"
endian little
comtype zlib
idstring "FPAC"
get SIZE long
get ZSIZE long
savepos OFFSET
clog "step1.dat" OFFSET ZSIZE SIZE
else
# pfd
get SIZE asize
log "step1.dat" 0 SIZE
endif
STEP2.bms:
Code:
goto 0
get FULL_SIZE asize
endian big
getdstring TYPE 4
if TYPE == "" # pfd
get DUMMY long
get DUMMY long
get FILES long
savepos BASE_OFF
for BASE_OFF = BASE_OFF < FULL_SIZE
get HEADDATA_SIZE long
get SIZE long
get OFFSET long
get DUMMY long
get DUMMY long
get NAME string
math OFFSET += BASE_OFF
set FNAME string BASE_NAME
string FNAME += NAME
log FNAME OFFSET SIZE
math BASE_OFF += HEADDATA_SIZE
goto BASE_OFF
next
elif TYPE == "FPAC"
endian little
get BASE_OFF long
get TOT_SIZE long
if TOT_SIZE != FULL_SIZE
endian big
ReverseLong BASE_OFF
ReverseLong TOT_SIZE
endif
get FILES long
get DUMMY long
get NAMELEN long
get DUMMY long
get DUMMY long
for i = 0 < FILES
getdstring NAME NAMELEN
get FILEID long
get OFFSET long
get SIZE long
Padding 16 0
math OFFSET += BASE_OFF
set FNAME string BASE_NAME
string FNAME += NAME
log FNAME OFFSET SIZE
next i
else
get NAME basename
get EXT extension
string NAME += "_unpacked."
string NAME += EXT
set FNAME string BASE_NAME
string FNAME += NAME
log FNAME 0 FULL_SIZE
endif
As you can see it's just like the original script but it's splitted in 2 parts and all the references to the output memory_file have been replaced with "step1.dat", while the input memory_file have been just removed