Follow us on Facebook: https://www.facebook.com/xentax/ :)

My quickBMS scripts

Coders and would-be coders alike, this is the place to talk about programming.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Mon Nov 12, 2012 2:57 am

UPDATE
Don't ask me why but I forgot to add mp3 to my type detection script... ;)
SnarbleBarb wrote:I heart you AlphaTwentyThree! I haven't check this in months thinking that you may have given up on it, but lo and behold! It finally extracts all of the BIG .AST files! Out of curiosity, is there a recursive function to extract the resultant .ast files from the big one?
Not that I know of. Glad you like the updates. :)
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

SnarbleBarb
n00b
Posts: 17
Joined: Thu Dec 15, 2011 9:24 am
Has thanked: 9 times
Been thanked: 1 time

Re: My quickBMS scripts

Post by SnarbleBarb » Mon Nov 12, 2012 7:31 am

Yes I greatly appreciate you putting more time into this one!

Unfortunately, the output isn't quite usable yet... no 3d models or textures. There are a lot of additional .AST files that get spewed out from the big ones. Trying to extract those results in more .AST files. If you keep extracting them, you essentially see a pattern where the results are the same as all of the .AST files in the top level directory. So a tiny .AST file could extract into many many .AST files that are much larger than the tiny one that you started from which includes a copy of itself. (That sounds a little wordy to me, hopefully it makes sense!)

Some thoughts on some of the resultant file types:

Any idea what the .XPR files are? I tried your Quake 4 XPR bms script, but it didn't work (couldn't read 1 byte).

You mention in the func_getTYPE.bms that you are unsure of the usage of .GD files. Looking at them in a hex editor, they look like animation scripts of some sort. They contain some variable declarations and then mention animation parameters. I'm sure that you've already looked at that though, but just in the odd case that you haven't... maybe that could help diagnose their usage? :)

I heart you AlphaTwentyThree!

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Mon Nov 12, 2012 5:26 pm

Well, to check this phenomenon I'd need something that only you have on your HDD... all those AST files that is. I wrote the script for one game and it seemed to work ok, so I didn't bother anymore. :-\
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Mon Nov 26, 2012 9:24 pm

Code: Select all

# extracts the datafile.dat from "Crazy Chicken: Pirates (PC, 2006)"
# (c) 2012-11-26 by AlphaTwentyThree of XeNTaX

idstring "MHP XXL"
goto 0x50
for 
	getDstring NAME 0x40
	if NAME == "****"
		cleanexit
	endif
	get OFFSET long
	get SIZE long
	get ZERO long
	get ZERO long
	log NAME OFFSET SIZE
next 
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Urbana
ultra-n00b
Posts: 1
Joined: Wed Nov 28, 2012 1:03 pm

Re: My quickBMS scripts

Post by Urbana » Wed Nov 28, 2012 10:12 pm

Hi there,

Would it be possible to port the Sleeping Dogs script to work on the PC version? Happy to provide any info on folder layout, filenames etc.

Thanks

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Thu Nov 29, 2012 2:59 pm

Urbana wrote:Hi there,

Would it be possible to port the Sleeping Dogs script to work on the PC version? Happy to provide any info on folder layout, filenames etc.

Thanks
Not sure atm. PM me.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Thu Nov 29, 2012 3:36 pm

UPDATE

I just made some corrections in the Wwise pck/AKPK script.
- doesn't terminate in an error message
- supports those pck files with only one folder (sfx)
- added sub-folders with the archive name inside the internal folder names (to identify where a certain language file came from)
The PC support was only some really uncertain work-around and made the script extremely messy, so I've deleted that for now. Will add the correct lines as soon as I get my hands on a sample.
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Researchman
mega-veteran
mega-veteran
Posts: 315
Joined: Fri Jun 11, 2010 12:08 pm
Has thanked: 78 times
Been thanked: 21 times

Re: My quickBMS scripts

Post by Researchman » Thu Nov 29, 2012 10:43 pm

Works if .pck archives dont have much files. Problem .pcks - sounds_eng.pck, sounds_sfx.pck (Assasin`s Creed III (Xbox 360)). QuickBMS error - this BMS script uses more array elements than how much supported (0.5.15b).
Dont work with soundstream.pck (Halo 4) - dont do extracting (extracted 0 files from 0).

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Fri Nov 30, 2012 6:34 pm

Researchman wrote:Works if .pck archives dont have much files. Problem .pcks - sounds_eng.pck, sounds_sfx.pck (Assasin`s Creed III (Xbox 360)). QuickBMS error - this BMS script uses more array elements than how much supported (0.5.15b).
Dont work with soundstream.pck (Halo 4) - dont do extracting (extracted 0 files from 0).
Without samples, I can't check the new script I'm afraid... :-\
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Fri Nov 30, 2012 6:35 pm

Iron Sky: Invasion (2012) PC

All file information is stored in an XML file, so parsing is a bit more ugly than usual.

Code: Select all

# Iron Sky: Invasion (2012) PC - *.gpk extractor ( input file: *.mod)
# (c) 2012-11-30 by AlphaTwenyThree of XeNTaX

idstring "<?xml"
get NAME filename
string NAME -= 8
string NAME += ".gpk"
open FDSE NAME 1

for i = 0
	FindLoc POS string "<File alias=" 0 ""
	if POS == ""
		break
	endif
	math POS += 0x12
	goto POS 0
	getCT NAME string 0x22 0
	FindLoc POS string "size=" 0 ""
	math POS += 10
	goto POS 0
	get TEST byte 0
	if TEST != 0x20
		goto MYOFF 0
	endif
	getCT NUM string 0x22 0
	callfunction str2num 1
	set ZSIZE NUM
	FindLoc POS string "originalSize=" 0 ""
	math POS += 18
	goto POS 0
	get TEST byte 0
	if TEST != 0x20
		goto MYOFF 0
	endif
	getCT NUM string 0x22 0
	callfunction str2num 1
	set SIZE NUM
	FindLoc POS string "offset=" 0 ""
	math POS += 12
	goto POS 0
	get TEST byte 0
	if TEST != 0x20
		goto MYOFF
	endif
	getCT NUM string 0x22 0
	callfunction str2num 1
	set OFFSET NUM
	if SIZE != ZSIZE
		savepos MYOFF 0
		goto OFFSET 1
		callfunction decompress 1
		get SIZE asize MEMORY_FILE
		log NAME 0 SIZE MEMORY_FILE
		goto MYOFF 0
	else
		log NAME OFFSET ZSIZE 1
	endif
next i

startfunction str2num
	endian little
    set TONUM 0
    strlen l NUM
    for s = 0 < l
        set EXP l
        math EXP -= s
        math EXP -= 1
        set B 0xA
        math B p EXP
        getVarChr T NUM s
        math T -= 0x30
        math T *= B
        math TONUM += T
    next s
    set NUM TONUM
endfunction

startfunction decompress
	get DUMMY long 1
	get HEADERSIZE long 1
	reverselong HEADERSIZE
	get BLOCKS long 1
	get UNK long 1
	get ZSIZE long 1
	get SIZE long 1
	putVarChr MEMORY_FILE SIZE 0
	log MEMORY_FILE 0 0
	for k = 1 <= BLOCKS
		get ZSIZE long 1
		get ZOFFSET long 1
		math ZOFFSET += OFFSET # relative to file start
		set SIZE ZSIZE
		math SIZE *= 0x200
		append
		clog MEMORY_FILE ZOFFSET ZSIZE SIZE 1
		append
	next k
endfunction
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Wed Dec 05, 2012 11:32 pm

Crash Bandicoot: Nitro Kart 2 - data.vfs

You'll need the newest func_getTYPE.bms for this to work properly. Note that some files remain zlib-compressed after extraction. They have been compressed two times in a row and this script doesn't extract recursively. They all contain *.pif files.

Code: Select all

# extracts the contents of the data.vfs from Crash Bandicoot: Nitro Kart 2 (iP, 2010)
# (c) 2012-12-05 by AlphaTwentyThree of XeNTaX

include "func_getTYPE.bms"
idstring "FUFS"
get UNK long
get FILES long
for i = 1 <= FILES
	get OFFSET long
	get NAME_CRC long
	get SIZE long
	savepos MYOFF
	goto OFFSET
	get TEST byte
	set COMP 0
	if TEST == 0x78
		set COMP 1
		set ZSIZE SIZE
		math ZSIZE *= 0x300
	elif TEST == 0x50
		goto OFFSET
		getDstring TEST 4
		if TEST == "PLZP"
			set COMP 1
			get ZSIZE long
			math ZSIZE *= 0x10
			math OFFSET += 0xc
		endif
	else
		putVarChr MEMORY_FILE SIZE 0
		log MEMORY_FILE 0 0
		append
		log MEMORY_FILE OFFSET SIZE
		append
	endif
	if COMP == 1
		putVarChr MEMORY_FILE ZSIZE 0
		log MEMORY_FILE 0 0
		append
		clog MEMORY_FILE OFFSET SIZE ZSIZE
		append
	endif
	callfunction getTYPE 1
	get NAME basename
	string NAME_CRC p= "_0x%08x" NAME_CRC
	string NAME += NAME_CRC
	string NAME += EXT
	log NAME 0 SIZE MEMORY_FILE
	goto MYOFF
next i
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Wed Dec 05, 2012 11:34 pm

Crash Bandicoot: Nitro Kart 2 - *.psnd

Code: Select all

# psnd to wav
# converts the *.psnd files from Crash Bandicoot: Nitro Kart 2 (iP, 2010) to playable wave files
# find the func_header_PCM.bms at http://forum.xentax.com/viewtopic.php?f=13&p=71565#p71565
# (c) 2012-12-05 by AlphaTwentyThree of XeNTaX

include "func_header_PCM.bms"
idstring "PSND"
get UNK long
get UNK long
get FREQ short
get CH byte
get BITS byte
savepos OFFSET
get SIZE asize
math SIZE -= OFFSET
set BLOCKALIGN 1
set CODEC 1
set NAME ""
callfunction PCM 1
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Thu Dec 13, 2012 2:35 am

Max Payne Mobile - MaxPayneSoundsv2.msf extractor

Code: Select all

# extracts the main sound archive from Max Payne Mobile (2012) iP
# (c) 2012-12-13 by AlphaTwentyThree of XeNTaX

endian big
get UNK long
get UNK long
get FILES long
for i = 1 <= FILES
	get OFFSET long
	get SIZE long
	get NAMEL byte
	getDstring NAME NAMEL
	log NAME OFFSET SIZE
next i
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Sun Dec 23, 2012 2:51 am

Atlantis: Pearls of the Deep - pearls_pc.vpb/.vpi extractor

Code: Select all

# extract the contents of the main archive of the game 'Atlantis: Pearls of the Deep (PC, 2012)'
# (c) 2012-12-23 by AlphaTwentyThree of XeNTaX

open FDDE vpi 0
open FDDE vpb 1
for
	FindLoc NXT string "File " 0 ""
	if NXT == ""
		cleanexit
	endif
	math NXT += 6
	goto NXT
	getCT NAME binary 0x22
	get DUMMY byte
	getCT OFFSET binary 0x20
	getCT SIZE binary 0x0d
	
	set NUM OFFSET
	callfunction str2num 1
	set OFFSET NUM
	
	set NUM SIZE
	callfunction str2num 1
	set SIZE NUM
	
	log NAME OFFSET SIZE 1
next

startfunction str2num
	endian little
    set TONUM 0
    strlen l NUM
    for i = 0 < l
        set EXP l
        math EXP -= i
        math EXP -= 1
        set B 0xA
        math B p EXP
        getVarChr T NUM i
        math T -= 0x30
        math T *= B
        math TONUM += T
    next i
    set NUM TONUM
endfunction
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Wed Jan 09, 2013 6:48 pm

Gangs of London (2006) PSP - *.bf

Code: Select all

# extracts *.bf files from Gangs of London (2006) PSP
# (c) 2013-01-09 by AlphaTwentyThree of XeNTaX

include "func_getTYPE.bms"
callfunction parse 1

startfunction parse
	idstring "BFFB"
	get UNK long
	get FILES long
	get IDENT long # 1 -> only one compressed file
	get INFO long
	get DATASTART long
	goto INFO
	if IDENT == 0
		callfunction extract_list
	elif IDENT == 1
		log MEMORY_FILE 0 DATASTART
		set OFFSET DATASTART
		get SIZE asize
		math SIZE -= OFFSET
		set ZSIZE SIZE
		math ZSIZE *= 0x100
		clog MEMORY_FILE2 OFFSET SIZE ZSIZE
		get SIZE asize MEMORY_FILE2
		append
		log MEMORY_FILE 0 SIZE MEMORY_FILE2
		append
		putVarChr MEMORY_FILE 0xc 0 long
		get NAME basename
		string NAME += "_dec.bf"
		get SIZE asize MEMORY_FILE
		log NAME 0 SIZE MEMORY_FILE
		open FDSE NAME
		goto 0
		callfunction parse 1
	endif
endfunction

startfunction extract_list
	for i = 1 <= FILES
		get NAME_CRC long
		get OFFSET long
		get SIZE threebyte
		get UNK byte
		if UNK != 0x80
			savepos MYOFF
			math MYOFF -= 4
			goto MYOFF
			get SIZE long
		endif
		get ZSIZE long
		string NAME p= "0x%08x" NAME_CRC
		if SIZE == ZSIZE
			log MEMORY_FILE OFFSET SIZE
		else
			clog MEMORY_FILE OFFSET SIZE ZSIZE
		endif
		callfunction getTYPE 1
		string NAME += EXT
		get WNAME basename
		string WNAME += " - "
		string WNAME += EXT
		string WNAME += "/"
		string WNAME += NAME
		get SIZE asize MEMORY_FILE
		log WNAME 0 SIZE MEMORY_FILE
	next i
endfunction
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Post Reply