Cities in Motion
Posted: Fri Feb 04, 2011 10:53 pm
The contents of this post was deleted because of possible forum rules violation.
Code: Select all
## WRS, xentax.com
# packed zlib files, chunks, amusing footnote
idstring "GS10"
get FSIZE long
## verify
savepos pos
get SIZE asize
math FSIZE += POS
if FSIZE != SIZE
print "Unexpected filesize"
cleanexit
endif
## it's all chunked by id
get CHUNKTYPE1 long
get CHUNKSIZE1 long
if CHUNKTYPE1 != 0x01000000 # file info chunk expected first
print "FileInfo chunk expected"
cleanexit
endif
get CHUNKTYPE2 long
get CHUNKSIZE2 long
if CHUNKTYPE2 != 0x01100000
print "ResourceInfo chunk expected"
cleanexit
endif
# continue resourceinfo
get FILES long
get CHUNKTYPE3 long # folder: 0x01130000
get STRSIZE long
getdstring FOLDERNAME STRSIZE
# now the files
for f = 1 to FILES
savepos CSTART
get CHUNKTYPE long # file: 0x01120000
get CHUNKSIZE long # 144
getdstring CHUNKID 4
## noted the "fu" id for the .script type ..
get ZLIBPNTR long
savepos POS
math POS -= CSTART
math ZLIBPNTR += POS # it's 16 btw
get RSIZE long
get ZSIZE long
getdstring FILENAME STRSIZE
string FNAME = FOLDERNAME
string FNAME += FILENAME
clog FNAME ZLIBPNTR ZSIZE RSIZE
next f
# next chunk is the compressed data
get CHUNKTYPE4 long
get CHUNKSIZE4 long
if CHUNKTYPE4 != 0x01200000
print "ZLibData chunk expected" # well.. it's already parsed..
cleanexit
endif
savepos POS
math POS += CHUNKSIZE4
goto POS
## funny footnote
get CHUNKTYPE5 long
get CHUNKSIZE5 long
if CHUNKTYPE5 != 0x00000001
print "Missing the footnote :("
cleanexit
endif
getdstring FOOTNOTEMSG CHUNKSIZE5
print "Footnote: '%FOOTNOTEMSG%'"
# eof
i only write the scripts as proof-of-concept, and quickbms doesn't handle repackingMicrosnakey wrote:Thanks a lot, it works great. Is they a way to repack the files