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 »

*.mic to *.ss2 converter
Encountered in Sniper Elite for PS2.

Code: Select all

# converts PS2 *.mic files to playable *.ss2 files
# known games with this format:
# - Sniper Elite (PS2)
# - Worms Forts: Under Siege (PS2)
# (c) 2012-05-03 by AlphaTwentyThree of XeNTaX

include "func_header_SS2.bms"
get OFFSET long
get UNK long
get CH long
get FREQ long
get INTERLEAVE long
get SIZE asize
math SIZE -= OFFSET
set NAME ""
callfunction SS2 1
Last edited by AlphaTwentyThree on Wed Sep 05, 2012 12:49 pm, 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 ;)
michalss
Moderator
Posts: 954
Joined: Sun Mar 27, 2011 8:42 pm
Has thanked: 10 times
Been thanked: 161 times

Re: My quickBMS scripts

Post by michalss »

AlphaTwentyThree wrote: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

Does it also work for X360 AV2010 text containning files pls ?
Quick BMS Editor GUI - simple easy to use
Goto : viewtopic.php?uid=34229&f=29&t=6797&start=0

Downloads from DropBox : https://dl.dropboxusercontent.com/u/
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 »

Nope. I'd have written otherwise. ;)
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 ;)
ebbelein
ultra-n00b
Posts: 2
Joined: Sat May 05, 2012 9:08 pm
Been thanked: 2 times

Re: My quickBMS scripts

Post by ebbelein »

Alpha,
could you by any chance do a script for extracting towav-compatible xma from aux files (found in Kinect Disneyland Adventures)... I got the orchestral score from a former vgm rip, but I´d also like to extract the voice elements and park bgm from my disc...

Thanks a lot
ebbelein
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 »

ebbelein wrote:Alpha,
could you by any chance do a script for extracting towav-compatible xma from aux files (found in Kinect Disneyland Adventures)... I got the orchestral score from a former vgm rip, but I´d also like to extract the voice elements and park bgm from my disc...

Thanks a lot
ebbelein
That's no extraction, that's a complete manipulation. I don't remember the header of those aux files but I guess they have RIFF headers, so procedure is the same as always:
- strip the header with RIFF_to_uxma
- parse with xma_parse (if it doesn't work, try 0x10000 blocksize)
- add header with my script
Resulting files are decodable with toWAV.
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 ;)
ebbelein
ultra-n00b
Posts: 2
Joined: Sat May 05, 2012 9:08 pm
Been thanked: 2 times

Re: My quickBMS scripts

Post by ebbelein »

thanks, alpha - i tried your method and it worked well, but only for a few files...

All of the aux files have a rifx wave fmt header or are bkhd files containing rifx wave fmt... Some of the files could be decoded with your method, some files got compatible for towav by just replacing the rifx header with a riff header in hex editor...
but on some of the files (like the one in the attached screenshot) i had no sucess with either method... There´s only digital noise after decoding it with towav... Perharps you could take a look on the file screenshots attached and give me a hint, what makes the left file so "special"...

thanks a lot...
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 »

Electronic Arts TGQ video demultiplexer
Tested with Need for Speed and WarCraft II: Dark Sage for Saturn.
I know there are other games that use the format so the script may be extended in the future.

Code: Select all

# demultiplexes Electronic Arts TGQ videos
# if audio is PCM, a valid header will automatically be added
# (c) 2012-05-17 by AlphaTwentyThree of XeNTaX

endian big
idstring "1SNh"
get SIZE_HEADER long
getDstring CODEC 4
if CODEC != "EACS"
	print "non-recognizable codec"
	cleanexit
endif
	# audio specs
	get FREQ long
	reverseLong FREQ
	get CH byte
	get BLOCKALIGN byte
	get CODEC byte
	if CODEC == 1 # some ADPCM
		reverselong FREQ
	endif
	set BITS 0x10
	
log MEMORY_FILE 0 0 # reserved for audio header
log MEMORY_FILE2 0 0 # 1SNd - audio
log MEMORY_FILE3 0 0 # pQGT (little endian)/TGVk (big endian) - video
set SIZE_VIDEO 0
set SIZE_AUDIO 0
get FSIZE asize


for i = 0 < 2
	set OFFSET SIZE_HEADER
	append
	do
		goto OFFSET
		getDstring TYPE 3
		get DUMMY byte
		get SIZE long
		if TYPE == "pQG"
			reverselong SIZE
		endif
		math OFFSET += 8
		math SIZE -= 8
		if TYPE == "TGV"
			if i == 0
				math SIZE_VIDEO += SIZE
			else
				log MEMORY_FILE3 OFFSET SIZE
			endif
		elif TYPE == "pQG"
			if i == 0
				math SIZE_VIDEO += SIZE
			else 
				log MEMORY_FILE3 OFFSET SIZE
			endif
		elif TYPE == "1SN"
			if i == 0
				math SIZE_AUDIO += SIZE
			else
				log MEMORY_FILE2 OFFSET SIZE
			endif
		else
			print "ERROR: block not recognizable - check file for consistency."
			cleanexit
		endif
		math OFFSET += SIZE
		math j += 1
	while OFFSET != FSIZE
	append
	if i == 0 # prealloc memory
		putVarChr MEMORY_FILE2 SIZE_AUDIO 0
		putVarChr MEMORY_FILE3 SIZE_VIDEO 0
		log MEMORY_FILE2 0 0
		log MEMORY_FILE3 0 0
		set SSIZE SIZE_AUDIO
		math SSIZE += SIZE_VIDEO
	else
		get NAME basename
		set SIZE SIZE_AUDIO
		set OFFSET 0
		if CODEC == 0
			string NAME += ".wav"
			callfunction PCM 1
		elif CODEC == 1
			string NAME += "_"
			string NAME += FREQ
			string NAME += "Hz_"
			string NAME += CH
			string NAME += "ch.aud"
			log NAME 0 SIZE MEMORY_FILE2
		endif
	
		get VNAME basename
		string VNAME += ".vid"
		log VNAME 0 SIZE_VIDEO MEMORY_FILE3
	endif
next i

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 MEMORY_FILE2
	append
	set RIFFSIZE SIZE
	math RIFFSIZE += 36
	set AVGBYTES FREQ
	math AVGBYTES *= BLOCKALIGN
	
	putvarchr MEMORY_FILE 0x04 RIFFSIZE long
	putvarchr MEMORY_FILE 0x14 1 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
		string NAME += ".wav"
	endif
	get SIZE asize MEMORY_FILE
	log NAME 0 SIZE MEMORY_FILE
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: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

Re: My quickBMS scripts

Post by AlphaTwentyThree »

BIGF extractor for WarCraft II: The Dark Saga (PSX/Saturn)

Extracts the *.war and *.cud archives from the game. Automatically adds a *.bank extension to the soundbanks for postprocessing. Had to use a little workaround for truncated archives.

Code: Select all

# extract archives with BIGF signature from 
# WarCraft II: The Dark Saga (Playstation & Saturn)
# (c) 2012-05-17 by AlphaTwentyThree of XeNTaX

idstring "BIGF"
# endian big # un-comment for Saturn version
get UNK long
get FILES long
get FSIZE asize
set i 1
for
	get OFFSET long
	if OFFSET == 0xadf0adf0
		cleanexit
	elif OFFSET == 0xf0adf0ad
		cleanexit
	endif
	get SIZE long
	set TEST SIZE
	math TEST += OFFSET
	if TEST > FSIZE # corrupt file end
		print "Warning: Last file may be truncated"
		get SIZE asize
		math SIZE -= OFFSET
	endif
	if SIZE != 0xffffffff
		get NAME basename
		string NAME += "_"
		string NAME += i
		savepos MYOFF
		goto OFFSET
		getDstring TYPE 4
		if TYPE == "BANK"
			string NAME += ".bank"
		endif
		goto MYOFF
		log NAME OFFSET SIZE
		math i += 1
	endif
next
Last edited by AlphaTwentyThree on Thu May 17, 2012 3:58 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 ;)
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 »

BANK extractor for WarCraft II: The Dark Saga (Playstation)

Just to have the sound extraction complete. ;)

Code: Select all

# extracts *.bank files from
# WarCraft II: The Dark Sagea (Playstation)
# (c) 2012-05-17 by AlphaTwentyThree of XeNTaX

idstring "BANK"
get FILES long
set BIAS FILES
math BIAS *= 0x10
math BIAS += 8
for i = 1 <= FILES
	getDstring NAME 8
	get OFFSET long
	math OFFSET += BIAS
	get SIZE 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 ;)
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 »

Agon *.sfl extractor
Extracts the main archives from Agon. Subfolder creation for better batch processing. :)

Code: Select all

# extracts *.sfl files from Agon (PC)
# (c) 2012-05-17 by AlphaTwentyThree of XeNTaX

idstring "SFL10"
get UNK long
get INFO long
get NAMEOFF long
get UNK long
get FILES threebyte
goto INFO
for i = 1 <= FILES
	get NAMEPOS long
	math NAMEPOS += NAMEOFF
	get DUMMY byte
	get FILE_NUMBER long
	get OFFSET long
	get SIZE long
	savepos MYOFF
	goto NAMEPOS
	get NAME string
	goto MYOFF
	get FNAME basename
	string FNAME += "/"
	string FNAME += NAME
	log FNAME OFFSET SIZE # use NAME to disable subfolder
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 »

Headhunter: Redemption (PS2) - *.DAT extractor
Unfortunately the file names are only saved as CRC so you have to post-process all files.
Main videos and some music is in FSKOLME.DAT, sounds, music and cutscenes are in FSPIENI.DAT. VAG interleave i 0x1000 if you're wondering. ;)

If anyone can provide me with a sample of the Xbox version, I'd be happy to check if it works for this console, too. :) PM me.

Code: Select all

# extracts the *.DAT archives from Headhunter: Redmption (PS2)
# (c) 2012-05-18 by AlphaTwentyThree of XeNTaX

get INFO asize
math INFO -= 0x800
goto INFO
get UNK long
get INFOSIZE long
get FILES long
math INFOSIZE /= 0x800
math INFOSIZE += 1
math INFOSIZE *= 0x800
math INFO -= INFOSIZE
goto INFO
for i = 1 <= FILES
	get NAME_CRC long
	string NAME_CRC p= "0x%08x" NAME_CRC
	get OFFSET long
	get SIZE long
	math OFFSET *= 0x800
	math OFFSET += 0x200000
	get NAME basename
	string NAME += "_"
	string NAME += NAME_CRC
	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 »

Astro Boy: The Video Game (2009) PS2

Code: Select all

# extracts the DATA.WAD/.DIR from "Astro Boy: The Video Game" for PS2
# (c) 2012-05-24 by AlphaTwentyThree of XeNTaX

open FDDE DIR 0
open FDDE WAD 1
get FILES long 0
for i = 1 <= FILES
	getDstring NAME 0x40 0
	get SIZE long 0
	get OFFSET long 0
	math OFFSET *= 0x800
	log NAME OFFSET SIZE 1
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 »

Hi alpha!

I am currently stuck trying to parse this particular XMA file from max Payne 3. Will Pm you the file ;)

As far as this structure goes, It appears to be a mono stream with dual channels blocked or interleave in a certain way. These blocked Intelreaved mono channels are also packed into packets separated by zeroes in the file. Some packets within a file have 2 channels in a packet but some have 12 channels. The first packet of every audio file has the mono XMA flag FC038000 which you can then identify and extract the channels easy of h first packet but the other packets don't have this flag and therefore have to find the interleaving. I tried to assume that the interleaving found in the first packet is the interleaving for all but such as not the case because when playing back the files it gives errors and the channels do not align right. So something is choking there. Hell im not even sure the FC038000 flag even states the correct interleaving in the first packet. :(
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 »

POD3 extractor

Code: Select all

# known games that use this format:
# BloodRayne (PS2)
# (c) 2012-05-25 by AlphaTwentyThree of XeNTaX

idstring "POD3"
goto 0x58
get FILES long
goto 0x108
get INFO long
goto INFO
set NAMEBIAS FILES
math NAMEBIAS *= 0x14
math NAMEBIAS += INFO
for i = 1 <= FILES
	get NAMEPOS long
	math NAMEPOS += NAMEBIAS
	get SIZE long
	get OFFSET long
	get UNK long
	get UNK 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 ;)
Teancum
veteran
Posts: 99
Joined: Tue Nov 27, 2007 8:30 pm
Has thanked: 22 times
Been thanked: 7 times

Re: My quickBMS scripts

Post by Teancum »

AlphaTwentyThree wrote:Headhunter: Redemption (PS2) - *.DAT extractor
Unfortunately the file names are only saved as CRC so you have to post-process all files.
Main videos and some music is in FSKOLME.DAT, sounds, music and cutscenes are in FSPIENI.DAT. VAG interleave i 0x1000 if you're wondering. ;)

If anyone can provide me with a sample of the Xbox version, I'd be happy to check if it works for this console, too. :) PM me.
I've got it on the Xbox. I'll check it out sometime soon.
Post Reply