Important information: this site is currently scheduled to go offline indefinitely by end of the year.

My quickBMS scripts

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

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Wwise sound engine *.pck/AKPK extractor

Finally had the motivation to write a (hopefully) working script for this format now. Most games that use the Wwise engine also use that format - which applies to tons of games from the '10 era.
Sadly, the names are only saved as a CRC value. :-\
Be sure to grab the newest func_getTYPE.bms, I've changed some basic things regarding the detection of RIFF/RIFX-headered files. Detects xWMA, ms_adpcm, ima_adpcm, xbox_adpcm and Wwise ogg now.

Code: Select all

# extracts archives with AKPK identifier (Wwise sound engine)
# newest func_getTYPE.bms is located at http://forum.xentax.com/viewtopic.php?f=13&p=69577#p69577
# (c) 2012-12-10 by AlphaTwentyThree of XeNTaX
#
# tested and working on
# ---------------------
# Kinect Rush: A Disney Pixar Adventure (X360, 2012)
# Assassin's Creed III (PC, 2012)
# Dishonored (PC, 2012)
# Warhammer 40,000: Space Marine (PC, 2012)
# Halo 4 (X360, 2012)
# Assasin's Creed: Revelations (PC, 2011)
# BioShock: Infinite (PC/PS3/X360, 2013)

include "func_getTYPE.bms"
getDstring IDENT 4
if IDENT == "AKPK"
elif IDENT == "1KCP" # The Saboteur (PC)
else
	print "Error: no valid Wwise sound pack"
	cleanexit
endif
set PC 0
endian big
get SIZE_HEADER long # data start offset
get TEST long
get FSIZE asize
if TEST != 1
	reverselong SIZE_HEADER
	endian little
	set PC 1
endif
get BNAME basename
string BNAME += "/"

goto 0xc
get IDENT long
set FOLDER_NAMES 1
if IDENT == 0xc6
	set NBIAS 0x18
elif IDENT == 0x14
	set NBIAS 0x1c
	set PC 1
else
	set NBIAS 0x1c # also in PC versions
endif
goto NBIAS
get NUM_FOLDERS long
if NUM_FOLDERS > 10
	math NBIAS -= 4
	goto NBIAS
	get NUM_FOLDERS long
endif
savepos MYOFF
set INFO NUM_FOLDERS
math INFO *= 8
math INFO += MYOFF # = start of names, will hold offset to jump to for TOC
set ALLNAMES 0 # for ceil after names

for i = 0 < NUM_FOLDERS
	goto MYOFF
	get OFF_NAME_FOLDER long
	math OFF_NAME_FOLDER += NBIAS
	get ID_FOLDER long
	savepos MYOFF
	goto OFF_NAME_FOLDER
	if PC == 0
		get NAME_FOLDER string
	else
		callfunction getPCstring 1
	endif
		strlen LENGTH NAME_FOLDER
		math ALLNAMES += LENGTH
		math ALLNAMES += 1
	string NAME_FOLDER += "/"
	string NAME_FOLDER += BNAME
	putArray 0 ID_FOLDER NAME_FOLDER
next i
if PC == 1
	math ALLNAMES *= 2
	math INFO += ALLNAMES
else
	savepos INFO
	math INFO x= 4
endif
goto INFO
set RUNS 1
callfunction extract 1
cleanexit

startfunction getPCstring
	set NAME_FOLDER ""
	for s = 0
		get CHAR byte
		get NULL byte
		putVarChr NAME_FOLDER s CHAR
		if CHAR == 0
			break
		endif
	next s
endfunction
	
startfunction extract
	savepos INFO
	get NUM_FILES long
	if NUM_FILES == 0
		if RUNS == 1
			get NUM_FILES long
		else
			cleanexit
		endif
	endif
	print "extracting %NUM_FILES% files (number at offset %INFO%)"
	for i = 1 <= NUM_FILES
		get NAME_CRC long
		get MULTI long # in certain cases only
		get SIZE long
		if SIZE == 0
			get SIZE long
		endif
		get OFFSET long
		get ID_FOLDER long
		if OFFSET == 0
			set OFFSET ID_FOLDER
			get ID_FOLDER long
		endif
		string NAME_CRC p= "0x%08x" NAME_CRC		
		if MULTI != 0
			math OFFSET *= MULTI
		endif
		
		savepos MYOFF
		getArray NAME_FOLDER 0 ID_FOLDER
		set NAME NAME_FOLDER
		#string NAME += "/"
		#string NAME += RUNS
		#string NAME += "/"
		string NAME += NAME_CRC
		putVarChr MEMORY_FILE SIZE 0
		log MEMORY_FILE 0 0
		append
		log MEMORY_FILE OFFSET SIZE
		append
		callfunction getTYPE 1
		if PC == 0
			endian big
		endif
		string NAME += EXT
		log NAME 0 SIZE MEMORY_FILE
	next i
	math RUNS += 1
	callfunction extract 1
endfunction
Last edited by AlphaTwentyThree on Mon Oct 28, 2013 6:21 pm, edited 2 times in total.
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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Just updated the above script and added PC version support (little endian). Not quite sure if it works, it's just a workaround. Just try it on some files to check. At least it works for the PC version of Borderlands 2...
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: 23 times

Re: My quickBMS scripts

Post by Researchman »

Alpha, dont works again on PC .pcks yet.
You do not have the required permissions to view the files attached to this post.
OrangeC
double-veteran
double-veteran
Posts: 868
Joined: Sun Apr 20, 2008 2:58 am
Has thanked: 5 times
Been thanked: 41 times

Re: My quickBMS scripts

Post by OrangeC »

I now getting errors from all wwwise packs that i try to test on, creed 3 is giving me the array element error without extracting anything and other pck that use to work will not now extract and gives me "incomplete file number 0 can't read from 1 bytes"
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

I've updated the script, can you check if it works now?
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 ;)
OrangeC
double-veteran
double-veteran
Posts: 868
Joined: Sun Apr 20, 2008 2:58 am
Has thanked: 5 times
Been thanked: 41 times

Re: My quickBMS scripts

Post by OrangeC »

Nope same errors as before. I have even updated quickbms to latest version and have the latest func_getTYPE.bms
Researchman
mega-veteran
mega-veteran
Posts: 315
Joined: Fri Jun 11, 2010 12:08 pm
Has thanked: 78 times
Been thanked: 23 times

Re: My quickBMS scripts

Post by Researchman »

Dont understand why dont works in any version script.

Alpha, could I send some files for tests in PM?
You do not have the required permissions to view the files attached to this post.
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Wind Blood (2012) Android - sound.pack extractor

Code: Select all

# extracts the sound.pack of Wind Blood (2012) Android
# (c) 2012-10-27 by AlphaTwentyThree of XeNTaX

get FSIZE asize
goto -0xe
get FILES short
set OFFSET 0
goto OFFSET
for i = 1 <= FILES
	idstring "GBMP"
	math OFFSET += 0x12
	goto OFFSET
	get ZSIZE long
	get SIZE long
	get NAMEL long
	getDstring NAME NAMEL
	savepos OFFSET
	if SIZE == ZSIZE
		log NAME OFFSET ZSIZE
	else
		clog NAME OFFSET SIZE ZSIZE
	endif
	math OFFSET += SIZE
	if OFFSET < FSIZE
		goto OFFSET
	endif
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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Shoot Many Robots *.sar extractor

Code: Select all

# extracts *.sar files found in "Shoot Many Robots" (2012, PC)
# (c) 2012-10-28 by AlphaTwentyThree of XeNTaX

idstring \x7f\xda\x0\x0
get FSIZE asize
get UNK long
get INFO long
goto INFO
for
	get OFFSET long
	get ZERO long
	get SIZE long
	get ZERO long
	get NAMEL long
	getDstring NAME NAMEL
	savepos TEST
	log NAME OFFSET SIZE
	if TEST == FSIZE
		cleanexit
	endif
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 ;)
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: My quickBMS scripts

Post by Ekey »

AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Yay, thanks. :)
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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Mountain Bike Adrenaline - BIG extractor

Code: Select all

# extracts the BIG file from Mountain Bike Adrenaline (PS2)
# (c) 2012-10-29 by AlphaTwentyThree of XeNTaX

get FILES long
get UNK long
get MULTI long
savepos INFO
set NAMEBIAS FILES
math NAMEBIAS *= 0x14
math NAMEBIAS += INFO
for i = 1 <= FILES
	get NAMEPOS long
	math NAMEPOS += NAMEBIAS
	get OFFSET long
	math OFFSET *= MULTI
	get FILE_END long
	get TYPE long
	get SIZE long
	savepos MYOFF
	goto NAMEPOS
	get NAME string
	goto MYOFF
	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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

UPDATE

Updated the func_getTYPE.bms once more. :) Added five or six new types and corrected a stupid mistake that sometimes prevented it from working correctly.
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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Added X360 support to the bdt/bht5 extractor. I don't know if the switch between offset and 4byte zero is connected to the endianness. I'd need other games to check this with.
viewtopic.php?f=13&t=4450&p=78048#p78048
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 »

AlphaTwentyThree wrote:Just made a really extensive update for both the EA ast extractor and func_getTYPE.bms (faster and more sophisticated)! Extreme enhancements FTW! ;)

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?
Post Reply