Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
-
Garo
- Posts: 20
- Joined: Wed Nov 18, 2020 5:54 pm
Post
by Garo »
I made an archive called GGTX or gtx.
This is the BMS script to decompress it
Code: Select all
comtype lzma2
idstring "GGTX"
get ZSIZE long
get SIZE long
get NAME basename
string NAME + ".amg"
savepos OFFSET
clog NAME OFFSET ZSIZE SIZE
But I made an archive called PTK or UKTP162N, that uses this script
Code: Select all
idstring "UKTP162N"
get FILES long
get NAMESZ long
for i = 0 < FILES
getdstring NAME NAMESZ
get OFFSET longlong
get SIZE longlong
log NAME OFFSET SIZE
For each subarchive in the archive, I want to specify the idstring "GGTX" and decompress the file with lzma2.
-
aluigi
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Post
by aluigi »
You can try something like the following:
Code: Select all
idstring "UKTP162N"
get FILES long
get NAMESZ long
for i = 0 < FILES
getdstring NAME NAMESZ
get OFFSET longlong
get SIZE longlong
savepos TMP
goto OFFSET
getdstring SIGN 4
if SIGN u== "GGTX"
callfunction ggtx_unpack 1
else
log NAME OFFSET SIZE
endif
goto TMP
next i
startfunction ggtx_unpack
comtype lzma2
#idstring "GGTX"
get ZSIZE long
get SIZE long
savepos OFFSET
clog NAME OFFSET ZSIZE SIZE
endfunction