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 »

XBLA flog_x360.fpg extractor
Two games found so far. The sg2 files inside the archives hold their file name each which is pretty neat. :)
Update your func_getTYPE.bms for that option!

Code: Select all

# extracts contents of FPG archives
#
# supported games:
# - Super Puzzle Fighter II Turbo - HD Remix (XBLA)
# - Super Street Fighter II Turbo - HD Remix (XBLA)
#
# (c) 2012-04-04 by AlphaTwentyThree of XeNTaX

include "func_getTYPE.bms"
idstring "30GF"
get FILES long
goto 0x800
for i = 1 <= FILES
	get NAME_CRC long
	string NAME_CRC p= "%08x" NAME_CRC
	get OFFSET long
	get SIZE long
	get ZSIZE long
	if SIZE == ZSIZE
		putVarChr MEMORY_FILE SIZE 0
		log MEMORY_FILE 0 0
		log MEMORY_FILE OFFSET SIZE
	else
		putVarChr MEMORY_FILE ZSIZE 0
		log MEMORY_FILE 0 0
		clog MEMORY_FILE OFFSET SIZE ZSIZE
		set SIZE ZSIZE
	endif
	callfunction getTYPE 1
	if ZNAME != ""
		set NAME ZNAME
	else
		get NAME basename
		string NAME += "_0x"
		string NAME += NAME_CRC
	endif
	string NAME += EXT
	log NAME 0 SIZE MEMORY_FILE
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 »

PFP extractor

Code: Select all

# extracts pfp files with PFPK identifier
# supported games:
# - Strimko (PC)
# - Witch Hunters: Stolen Beauty (PC, BigFish Games)
# - Strange Cases: The Secret of Grey Mist Lake (PC, 2012, BigFish Games)
#
# (c) 2012-04-08 by AlphaTwentyThree of XeNTaX

idstring "PFPK"
get FILES long
for i = 1 <= FILES
	get NAMEL byte
	getDstring NAME NAMEL
	get OFFSET long
	get SIZE long
	log NAME OFFSET SIZE
next i
Last edited by AlphaTwentyThree on Sat Oct 27, 2012 5:14 am, 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 »

Resident Evil: Operation Raccoon City (Xbox 360) - streamed.pck
I know that other games use this format, too but I need to find out how to automatically retrieve those variables behind the goto commands first. ;)
For now, you can use this just for one game. I'll update this post when I update the script.
func_getTYPE.bms: viewtopic.php?f=13&p=69577#p69577

Code: Select all

# extracts the contents of the streamed.pck of Resident Evil: Operation Raccoon City (Xbox 360)
#
# (c) 2012-04-07 by AlphaTwentyThree of XeNTaX

include "func_getTYPE.bms"
idstring "AKPK"
endian big
set FOLDEROFF 0x58
goto 0x18
for i = 0 <= 7
	get DUMMY long
	get INDEX long
	savepos MYOFF
	goto FOLDEROFF
	for k = 0 < INDEX
		get FOLDERNAME string
	next k
	putArray 0 INDEX FOLDERNAME
	goto MYOFF
next i

goto 0xa4
get FILES long
for i = 1 <= FILES
	get NAME_CRC long
	string NAME_CRC p= "%08x" NAME_CRC
	get MULTIPLIER long
	get SIZE long
	get OFFSET long
	math OFFSET *= MULTIPLIER
	get TYPE long # folder number
	get FNAME basename
	string FNAME += "_0x"
	string FNAME += NAME_CRC
	getArray WNAME 0 TYPE
	string WNAME += "/"
	string WNAME += FNAME
	log MEMORY_FILE OFFSET SIZE
	callfunction getTYPE 1
	endian big
	string WNAME += EXT
	log WNAME 0 SIZE MEMORY_FILE
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 »

Just updated my SS2 header adder to a more sophisticated script with the use of the include function. The old onw still works but this additionally has a memory preallocation and thus is multiple times faster. Practical when you batch big files. :)
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 »

rws_to_ss2.bms
Some PS2 games use the rws header. Those files can be played with vgmstream but the plugin doesn't take the name from the RWS header. My script does. ;)
This is a good example how easy header manipulations get with my adjusted func_header_SS2.bms! :)

Code: Select all

# convert PS2 ADPCM RWS header to SS2 header
# (c) 2012-04-10 by AlphaTwentyThree of XeNTaX

include "func_header_SS2.bms"
idstring \xd\x8\x0\x0
goto 0x48
get OFFSET long
goto 0x68
get NAME string
string NAME += ".ss2"
goto 0x90
get SIZE long
goto 0xD4
get INTERLEAVE short
goto 0xE4
get FREQ short
goto 0xF1
get CH byte
callfunction SS2 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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

Extractor for Broken Sword: Shadow of the Templars
Another good example for the use of external scripts.

Code: Select all

# extracts the TUNES.DAT/.TAB and SPEECH.DAT/.TAB from 
# Broken Sword: Shadow of the Templars (PSX)
# (c) 2012-04-10 by AlphaTwentyThree of XeNTaX

include "func_header_SS2.bms"
open FDDE DAT 0
open FDDE TAB 1
get FILES asize 1
math FILES /= 0x8
for i = 1 <= FILES
	get OFFSET long 1
	math OFFSET *= 0x800
	get SIZE long 1
	if SIZE == 0xffffffff
	elif SIZE == 0
	else
		set FREQ 11025
		set CH 1
		set INTERLEAVE 0x10
		get NAME basename 1
		string NAME += "_"
		string NAME += i
		string NAME += ".ss2"
		callfunction SS2 1
	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 »

CPK/SEG "FILM" audio extractor

While working on several older console games, I encountered this format first in Saturn, then in Sega CD games. The audio has no info, but there's some infor area after the block info, which is saved. Sometimes the audio is just Motorola (big endian) raw PCM, normally mono but I also encountered an audio format which I have never seen.
Used a workaround to pre-allocate the memory file, so it's pretty fast for bigger files, too.

Code: Select all

# extracts the raw audio stream from Sega Saturn and Sega CD movies with FILM signature
# e.g. found in:
# - 3 Ninjas Kick Back (SCD)
# - Shellshock (SS)
# - Tomb Raider (SS)
# - X-Men: Children of the Atom (SS)
# (c) 2012-08-09 by AlphaTwentyThree of XeNTaX

endian big
idstring "FILM"
get BIAS long
getDstring VER 4
get ZERO long
idstring "FDSC"
get STAB_OFF long
math STAB_OFF += 0x10
goto STAB_OFF

idstring "STAB"
get STAB_SIZE long
get UNK long
get ENTRIES long
savepos MYOFF
set OFF_HEADER ENTRIES
math OFF_HEADER *= 0x10
math OFF_HEADER += MYOFF
set SIZE_HEADER BIAS
math SIZE_HEADER -= OFF_HEADER

set PSIZE 0
for p = 0 < 2
	for i = 1 <= ENTRIES
		get OFFSET long
		math OFFSET += BIAS
		get SIZE long
		get UNK long
		get TYPE long
		if TYPE == 1 # audio
			if p == 0
				math PSIZE += SIZE
			else
				append
				log MEMORY_FILE OFFSET SIZE
				append
			endif
		endif
	next i
	if p == 0
		putVarChr MEMORY_FILE PSIZE 0
		log MEMORY_FILE 0 0
	endif
	goto MYOFF
next p
get SIZE asize MEMORY_FILE
get NAME basename
string NAME += ".raw"
log NAME 0 SIZE MEMORY_FILE
get NAME basename
string NAME += ".info"
log NAME OFF_HEADER SIZE_HEADER
Last edited by AlphaTwentyThree on Thu Aug 09, 2012 1:18 am, 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 »

func_header_PCM.bms
Like the name tell you: just a header adder for standard wave pcm. Somehow I forgot to post it here. ;)
BTW: standard wave files have CODEC 1, BITS 16, but the BLOCKALIGN may vary between 1 and 4.

Code: Select all

# add a wave pcm header to any data and write to disk
# input variables: SIZE, OFFSET, FREQ, CH, BITS, BLOCKALIGN, CODEC, NAME (or set to "")
# (c) 2012-10-16 by AlphaTwentyThree of XeNTaX

startfunction PCM
	endian little
	set PRE SIZE
	math PRE += 0x2c
	putVarChr MEMORY_FILE PRE 0
	log MEMORY_FILE 0 0
	set MEMORY_FILE binary "\x52\x49\x46\x46\x20\xC0\xB1\x00\x57\x41\x56\x45\x66\x6D\x74\x20\x10\x00\x00\x00\x01\x00\x02\x00\x44\xAC\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00\x64\x61\x74\x61\xFC\xBF\xB1\x00"
	append
	log MEMORY_FILE OFFSET SIZE
	append
	set RIFFSIZE SIZE
	math RIFFSIZE += 36
	set AVGBYTES FREQ
	if CODEC != 2
		math AVGBYTES *= BLOCKALIGN
	endif
	
	putvarchr MEMORY_FILE 0x04 RIFFSIZE long
	putvarchr MEMORY_FILE 0x14 CODEC short          # wFormatTag: Microsoft PCM Format (0x0001)
	putvarchr MEMORY_FILE 0x16 CH short   # wChannels
	putvarchr MEMORY_FILE 0x18 FREQ short   # dwSamplesPerSec
	putvarchr MEMORY_FILE 0x1c AVGBYTES long    # dwAvgBytesPerSec
	putvarchr MEMORY_FILE 0x20 BLOCKALIGN short # wBlockAlign
	putvarchr MEMORY_FILE 0x22 BITS short       # wBitsPerSample
	putvarchr MEMORY_FILE 0x28 SIZE long
	if NAME == ""
		get NAME basename
		if CODEC == 2
			string NAME += ".lwav"
		else
			string NAME += ".wav"
		endif
	endif
	get SIZE asize MEMORY_FILE
	log NAME 0 SIZE MEMORY_FILE
endfunction
Example script to add a header to a file:

Code: Select all

include "func_header_PCM.bms"
set OFFSET 0
get SIZE asize
math SIZE -= OFFSET
set CODEC 1
set FREQ 44100
set CH 2
set BITS 16
set BLOCKALIGN 4
set NAME ""
callfunction PCM 1
Last edited by AlphaTwentyThree on Tue Oct 16, 2012 11:06 pm, edited 3 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 »

Scarygirl *.str to *.wav
What a lazy format... ;)

Code: Select all

# converts the str files from Scarygirl (PC) to standard wave files
# (c) 2012-04-16 by AlphaTwentyThree of XeNTaX

include "func_header_PCM.bms"
get CODEC short
get CH short
get FREQ long
get AVGBYTES long
get BLOCKALIGN short
get BITS short
get UNK long
get UNK long
savepos OFFSET
get SIZE asize
math SIZE -= OFFSET
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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

25 to Life *.hog extractor
Works for the Xbox version. Will update as soon as I get my hands on the other platforms.

Code: Select all

# extracts the contents of *.hog archives from
# 25 to Life (Xbox)
# (c) 2012-04-18 by AlphaTwentyThree of XeNTaX

get IDENT long
if IDENT != 0x20001
	cleanexit
endif
get INFO long
goto 0x10
get FILES long
goto INFO
for i = 1 <= FILES
	get NAMEPOS long
	get OFFSET long
	get SIZE long
	get DUMMY 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 ;)
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 »

Hello alpha can you look at the attached file from prototype 2 archive? Your script probably needs editing to handle prototype 2. :)
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 »

Scarface engine *.rcf extractor for Xbox 360

Nothing to say here, just a normal extractor. Haven't tested on older games but should work as well. ;)

*EDIT* something's badly wrong with the names - need to check the script again...
Last edited by AlphaTwentyThree on Tue May 01, 2012 12:32 am, edited 1 time 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 ;)
User avatar
Tosyk
double-veteran
double-veteran
Posts: 1027
Joined: Thu Oct 22, 2009 10:24 am
Location: Russia, Siberia
Has thanked: 269 times
Been thanked: 154 times
Contact:

Re: My quickBMS scripts

Post by Tosyk »

AlphaTwentyThree wrote:POD5 extractor
I guess there are other games with this format.

Code: Select all

# extracts POD5 archives
#
# supported games:
# Kinect Star Wars (Xbox 360)
# Country Dance All-Stars (Xbox 360)
...
it's not working for me, just nothing happen, i'm trying to unpack star wars kinect pod files

edit: my bad, works fine
Thank you for all you do here
my blog | my forum
WrappedInBlack
ultra-n00b
Posts: 9
Joined: Thu Apr 26, 2012 10:51 pm

Re: My quickBMS scripts

Post by WrappedInBlack »

So does anyone have a p3d converter?
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 »

Sniper Elite V2 - StreamingSounds.asrBE extractor
Strange file table, but works with a dumb work-around.

Code: Select all

# extracts the StreamingSounds.asrBE from Sniper Elite V2 (Xbox 360)
# (c) 2012-05-01 by AlphaTwentyThree of XeNTaX

idstring "Asura   STSA"
endian big
get FSIZE long
get UNK long
get ZERO long
get FILES long
get DUMMY byte
goto 0x1d
for i = 1 <= FILES
	get NAME string
	if i != FILES
		FindLoc NXT string "sounds" 0 ""
	else
		FindLoc NXT string "RIFF" 0 ""
	endif
	math NXT -= 8
	goto NXT
	get SIZE long
	get OFFSET long
	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 ;)
Post Reply