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 »

Apollo wrote:Just a small note on CDXA, there are actually XA files using 18,900khz stereo playback rates too than just 37,800Hz and 2 channels which is admittedly more common.

Like for example the PSX versions of C&C RA1.

As for ima adpcm header adder, you would need to add the various default block sizes as per each khz in default MS encoder.

mono
8khz/11khz/16khz= 256

22khz/32khz=512

44khz/48khz=1024

for stereo previous apply except double the block size so 8khz stereo=512

xbox adpcm uses always 36 mono or 72 stereo blocksizes regardless of khz but such small block sizes waste tons of space.

fact chunk can be left unwritten but the last field before it or data is sadly demanded by most players too except vlc.
OMG, thans a lot for all this information!!! I'll definitely look into implementing that! :):):)
18,900khz stereo? Only encountered mono so far. Anyway, the header should be the same as channels and frequency isn't stated at all. ;)
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 MSF converter by some variants and formats: viewtopic.php?f=13&t=4450&p=43570#p43570 :)
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 ;)
radical dreamer
ultra-n00b
Posts: 1
Joined: Sun Jul 15, 2012 12:16 pm
Location: California, USA
Has thanked: 10 times
Contact:

MSF converter update

Post by radical dreamer »

Darn, I was hoping the MSF converter update would successfully convert my msf's from Castlevania HoD (PS3) but it's giving me at3's that don't play and ss2's that give errors in MFAudio. ("Specified format is not supported or cannot be translated")

Here are some examples of msf's that I'm trying to convert if you have time to look at them. http://www.mediafire.com/?km5qeflgmzeep9j
And there are a bunch more I can provide if it interests you. :D
radical dreamer [no-life code finder] of the Codemasters-Project
PSN: radicldreamr
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 »

18 Wheeler: American Pro Trucker (PS2) *.str extractor

Code: Select all

# extracts the MUSIC.STR and VOICES.STR from 18 Wheeler: American Pro Trucker for PS2
# (c) 2012-08-07 by AlphaTwentyThree of XeNTaX

include "func_header_SS2.bms"
get FILES long
goto 0x10
for i = 1 <= FILES
	getDstring NAME 0x20
	get OFFSET long
	get SIZE long
	get UNK long
	get CH short
	get FREQ short
	get INTERLEAVE long
	callfunction SS2 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 ;)
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

Just made a major update for my CPK/SEG movie 'FILM' id audio extractor (Saturn/Sega CD). :) The previous version eventually produced wrong results.
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 »

The Animals! (Sega CD) - MEDIA.RES extractor

One of the few Sega CD games that doesn't contain audio tracks. The MEDIA.RES can only be extracted with IsoBuster as the file system is non-standard.
And yes, those *.seg movies can be demultiplexed with my tool. :)

Code: Select all

# extracts the MEDIA.RES from "The Animals!" for Sega CD
# (c) 2012-10-18 by AlphaTwentyThree of XeNTaX

goto 0x14
get BIAS long
math BIAS *= 0x800
goto 0x20
for i = 1 <= 0xa50
	getDstring NAME 0x10
	get OFFSET1 long
	get SIZE1 long
	get SIZE long
	get OFFSET long
	math OFFSET += BIAS
	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 ;)
Graczdari
ultra-n00b
Posts: 2
Joined: Fri Mar 25, 2011 11:47 pm

Re: My quickBMS scripts

Post by Graczdari »

Welcome. Could you write a script that allows you to rework "PCM" to "msf"? or "PCM" to "AA3" and then "AA3" to "msf"? I really depend on that.

Thanks for possible help :)
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 »

Darksiders II *.pck extractor

Don't forget the current func_getTYPE.bms: viewtopic.php?f=13&p=69577#p69577

Code: Select all

# extracts the *.pck archives from Darksiders II (Xbox 360)
# (c) 2012-08-16 by AlphaTwentyThree of XeNTaX

include "func_getTYPE.bms"
idstring "AKPK"
get BNAME basename
string BNAME += "_"
endian big
goto 0xc
get INFO long
math INFO += 0x20
goto INFO
for i = 1
	get DUMMY long # 0/1
	get NAME_CRC long
	if NAME_CRC == 0
		cleanexit
	endif
	get MULTI long
	get SIZE long
	get OFFSET long
	math OFFSET *= MULTI
	string NAME_CRC p= "%08x" NAME_CRC
	set NAME BNAME
	string NAME += i
	string NAME += "_0x"
	string NAME += NAME_CRC
	log MEMORY_FILE OFFSET SIZE
	savepos MYOFF 0
	callfunction getTYPE 1
	endian big
	goto MYOFF 0
	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 ;)
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 post the full auto 2 script you sent me a while back?
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 »

Wave cue extractor and injector

Needed when decoding from non-standard wave headers to save the cue marker section. Can be imported with the second script later-on.
Very practical if you want to add comments to a compressed file, e.g. mp3 or ogg. Just take the decoded file, add your markers and export them. You can later on decode the compressed file again and inject the markers from before. Works with every marker type.
Also needed when working with rifx files from the Wwise system as RIFX files containing ogg streams can contain markers. So to get the markers to their correct positions, you just need to extract them from the original rifx, transform the rifx with ww2ogg and revorb, decode the ogg to wav and inject the cue markers again. :)

Extractor:

Code: Select all

# extract cue section from wave files
# RIFF and RIFX header supported
# (c) 2012-08-16 by AlphaTwentyThree of XeNTaX

getDstring HEAD 4
if HEAD == "RIFX"
	endian big
endif

get NAME basename
string NAME += ".cue"

FindLoc OFFSET1 string "cue" 0 ""
if OFFSET1 != ""
	goto OFFSET1
	idstring "cue "
	get SIZE1 long
	math SIZE1 += 0x8
	set OFFSET2 OFFSET1
	math OFFSET2 += SIZE1
	goto OFFSET2
	getDstring LIST_test 0x4
	set SIZE SIZE1
	if LIST_test = "LIST"
		get SIZE2 long
		math SIZE2 += 0x8
		math SIZE += SIZE2
	endif
	set OFFSET OFFSET1
	log NAME OFFSET SIZE
endif
Injector:

Code: Select all

# inject *.cue files containing markers into wave files
# (c) 2012-08-16 by AlphaTwentyThree of XeNTaX


get NAME basename 0
string NAME += ".cueold"
FindLoc OFFSET string "cue " 0 ""
if OFFSET != ""
   get SIZE asize 0
   math SIZE -= OFFSET
   log NAME OFFSET SIZE
else
   get SIZE asize
endif
log MEMORY_FILE 0 SIZE
open FDDE CUE 1
get CSIZE asize 1
append
log MEMORY_FILE 0 CSIZE 1
append
get NAME filename  0
math SIZE += CSIZE
set RIFFSIZE SIZE
math RIFFSIZE -= 8
putVarChr MEMORY_FILE 4 RIFFSIZE long
log NAME 0 SIZE MEMORY_FILE
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 »

Sleeping Dogs (Xbox 360) - SFX.pck extractor

First folder contains sfx, the second one music and ambients.

Code: Select all

# extract the SFX.pck from Sleeping Dogs (Xbox 360)
# (c) 0212-08-16 by AlphaTwentyThree of XeNTaX

include "func_getTYPE.bms"
idstring "AKPK"
endian big
goto 0x28
set FOLDER "SFX_1/"
callfunction extract_folder 1
goto 0x3dac
set FOLDER "SFX_2/"
callfunction extract_folder 1


startfunction extract_folder
	get FILES long
	for i = 1 <= FILES
		get NAME_CRC long
		get MULTI long
		get ZERO long
		get SIZE long
		get OFFSET long
		get ZERO long
		math OFFSET *= MULTI
		putVarChr MEMORY_FILE SIZE 0
		log MEMORY_FILE 0 0
		log MEMORY_FILE OFFSET SIZE
		callfunction getTYPE 1
		get NAME basename
		set WNAME FOLDER
		string NAME_CRC p= "%08x" NAME_CRC
		string NAME += "_"
		string NAME += i
		string NAME += "_0x"
		string NAME += NAME_CRC
		string NAME += EXT
		endian big
		string WNAME += NAME
		log WNAME OFFSET SIZE
	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 ;)
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 »

Zak & Jack in Showdown at Monstertown (PC, 2006) - resources.pak extractor

Code: Select all

# extract the resources.pak from Zak & Jack in Showdown at Monstertown (PC, 2006)
# (c) 2012-08-20 by AlphaTwentyThree of XeNTaX

get DUMMY long
get FILES long
get NAMEOFF long
math NAMEOFF += 0x10
get ZERO long
for i = 1 <= FILES
	get NAMEL long
	get OFFSET long
	get SIZE long
	get ZSIZE long
	get ZERO long
	savepos MYOFF
	goto NAMEOFF
	getDstring NAME NAMEL
	savepos NAMEOFF
	if SIZE == ZSIZE
		log NAME OFFSET SIZE
	else
		clog NAME OFFSET SIZE ZSIZE
	endif
	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: 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 found out that my pak script for Jagged Alliance: Back in Action also works for the new Jagged Alliance: Crossfire! :)
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 »

MJZ extractor
If anyone encounters another game that uses this format, let me know. :)

Code: Select all

# extracts MJZ0 files (e.g. Luxor Evolved)
# (c) 2012-08-27 by AlphaTwentyThree of XeNTax

comtype "COMP_ZLIB_NOERROR"
idstring "MJZ0"
get UNK long
get FILES long
get ENTRIES long
for i = 1 <= FILES
	get TYPE long
	get OFFSET long
	get DSIZE long
	get CSIZE long
	get NAMEL byte
	getDstring NAME NAMEL
	if TYPE == 0
		log NAME OFFSET DSIZE
	elif TYPE == 0xa
		clog NAME OFFSET CSIZE DSIZE
	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 ;)
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 664 times
Contact:

Re: My quickBMS scripts

Post by aluigi »

MJZ0 is used for Mumbo Jumbo archives, I have a complete script for them supporting all the known variants:
http://aluigi.org/papers/bms/mumbojumbo.bms
Post Reply