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.
Post Reply
AlphaTwentyThree
double-veteran
double-veteran
Posts: 982
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 76 times
Been thanked: 660 times

My quickBMS scripts

Post by AlphaTwentyThree »

WELCOME TO MY QuickBMS GAME SCRIPTS!

I thought I'd share the quickBMS scripts I wrote with you here. From time to time I'll just edit this very post to update.
QuickBMS by Luigi Auriemma can be found here: http://aluigi.org/quickbms.htm
If you're coding QuickBMS, here's a link to some tips for speeding up your scripts: viewtopic.php?f=13&t=9594
General scripts at the beginning, game-specific scripts at the end of each platform. :)

First of all four really useful and powerful scripts to use for different purposes:
file deinterleaver, updated version - very useful!
generic splitter - very useful!
XOR tester - very useful!
func_getTYPE.bms - determine file type in memory


Microsoft Xbox:
func_header_XADP.bms - add an Xbox ADPCM header
Xbox ADPCM mono to stereo merge - needed for some games

25 to Life (Xbox) - *.hog
Fable (Xbox) - *.lug/met pairs
Max Payne (Xbox) - *.emm/dir pairs
Gun (Xbox) - *.dat/wad pairs
The Suffering (Xbox) - *.sdu


Microsoft Xbox 360:
XMA converter - converts many different XMA variants to decodable xma files
XMA cue to WAV cue
*.baf extractor (X360 only)
UT3 engine *.SoundNodeWav to XMA converter *old*
RIFX converter *old*
RIFF/RIFX to unparsed XMA *old*
XMA RIFF header adder *old*

AFL Live 2 (2013) X360 - .wad0/.wad1
Are You Smarter Than A 5th Grader: Make the Mark (XBLA) - *.xen
Armored Core V (Xbox 360) - *.bdt/bht pairs
Backbreaker: Vengeance (XBLA) - *.pkh/pkd pairs
Beyond Good & Evil HD (XBLA) - Sally_PC_POLISH.bf
Breach (PC & XBLA) - *.?sp/spd pairs
Crystal Defenders (XBLA, WiiWare, PSN, PSP mini) - *.bin
Dark Souls (PC/X360) - *.bdt/bhd5
Darksiders II (Xbox 360) - *.pck
Gun (Xbox 360)[/b] - *.dat/wad pairs
Prototype (Xbox 360) - *.p3d
Quake 4 (Xbox 360) - *.xpr
Resident Evil 6 (Xbox 360) - correct the frequency of decoded XMA files (divide by 2)
Sleeping Dogs (Xbox 360) - SFX.pck
Sniper Elite V2 (Xbox 360) - StreamingSounds.asrBE
Star Wars: The Force Unleashed (Xbox 360) - *.xp/*.xd archives
Warriors Orochi 3 (Xbox 360) - *.bin/idx pairs, BGMLink.g1l

flog engine extractor (XBLA) - flog_x360.fpg with "30GF" identifier
FPK/FKP extractor (XBLA) - archives with "FKP" identifier
Tongas Pack - *.PAK (various XBLA and other console games)


Sony Playstation:
CDXA header adder (XA format) (PS) - needed after manual deinterleave
STR movie audio extract (PS) - can also demux
XA deinterleave (PS) - works only for certain games
XA extractor for deinterleaved XA packs (PS) - will be expanded a bit further in the future

Broken Sword: Shadow of the Templars (PS) - *.dat/tab pairs
WarCraft II: The Dark Saga (Saturn/PS) - *.war, *.cud
Broken Sword: Shadow of the Templars (PS) - *.dat/tab pairs


Sega Saturn/Sega CD:
CPK/SEG movies with 'FILM' id (Saturn/Sega CD) - extract audio stream
Sega CD *.bin movie audio demuxer - extracts headerless data

The Animals! (Sega CD) - MEDIA.RES extractor
WarCraft II: The Dark Saga (Saturn/PS) - *.war, *.cud

Sony PS2:
func_header_SS2.bms - add PS2 ADPCM header
MIC to SS2
SS2 0x10-byte re-interleave - important!!!
RWS to SS2
VAG to SS2 (mono-to-stereo channel joiner)
VAG scanner
AAAp (stereo vag) to ss2 converter

007: NightFire (PS2) - *.sfb
18 Wheeler: American Pro Trucker (PS2) - *.STR
Ace Combat Zero: The Belkan War (PS2) - NPSF to SS2 converter
Astro Boy: The Video Game (PS2) - DATA.WAD/DIR pair
Baldur's Gate: Dark Alliane (PS2) - *.GOB, *.LMP
Buzz! The Sports Quiz (PS2) - *.PAK ("BPAK" ident)
Half-Life (PS2) - *.PAK ("PACK" ident)
Headhunter: Redemption (PS2) - *.DAT
Mountain Bike Adrenaline - BIG file
Reservoir Dogs - *.PS2
SDF to SS2 - *.sdf (various PS2 games)
Turok: Evolution (PS2) - *.TRE


Sony PSP & PS3:
Atrac header adder - *.at3
AT3+ header adder - *.aa3 (hardly needed)
AT3 to AA3 converter - for codec number 0xfeff, incl. smpl extraction
MSF converter
PMF AT3 to AA3 - convert headerless aa3 to playable aa3
RSF converter
smpl extractor & injector (for post-processing of decoded *.aa3 files)
XWS extractor

Warhammer 40,000: Squad Command (PSP) - *.pak
Crystal Defenders (XBLA, WiiWare, PSN, PSP mini) - *.bin
Gangs of London (2006) PSP - *.bf
Payday 2 (2013) PS3 - all_#.bundle
The Awakened Fate: Ultimatum (PS3, 2015) - *.dat


Nintendo DS:
SDAT extractor - for standard NDS sound archives
SWAR extractor - for the NDS soundbanks
*.spk extractor
bank.bin extractor (for NDS roms that only contain bank.bin)
Glob.bin extractor (for NDS roms that only contain Glob.bin and sound_data.sdat)
"IM00" pac extractor - *.pac

Anpanman to Touch de Waku Waku Training (DS) - *.pb
Bratz (DS) - *.pkg
Bratz (DS) - BigFile.bin


PC:
9 Clues: The Secret of Serpent Creek - Game.cub
XIII Century (2008) PC - data.???.pak
Agon: The Mysterious Codex - *.sfl
Alien Rage: Unlimited (2013) PC - SNDTABLE.AFB/SNDCACHE.AFB
Atlantis: Pearls of the Deep (2012) PC - pearls_pc.vpb/.vpi
Breach (PC & XBLA) - *.?sp/spd pairs
Crazy Chicken: Pirates (2006) PC - datafile.dat
Culpa Innata (2007) PC - *.sfs
DARK - *.darkpack
Dark Souls (PC/X360) - *.bdt/bhd5
Dino R-R-rage Defense (2014) PC - data.dat
FTL: Faster Than Light (2012) PC - *.dat
Frozen Synapse Prime (2014) PC - FSalldata.pkdwin/.pkiwin
Full Mojo Rampage (2013) PC - DataPC.pak
Half Minute Hero: Super Mega Neo Climax Ultimate Boy (2012) PC - *.rvw
Iron Sky: Invasion (2012) PC - *.gpk/*_gpk.mod
Jagged Alliance: Back in Action / Jagged Alliance: Crossfire - *.pak
Midnight Mysteries 4: Haunted Houdini - Contents.dat
Hooligans: Storm Over Europe - *.x13
RAW: Realms of Ancient War (2012) PC - *.bf
Real Warfare: 1242 - data.000.pak
Scarygirl - str to wav converter
Shoot Many Robots (2012) PC - *.sar
StoneChess (2012) PC - data.scp
Strimko - assets.pfp
Star Wars: The Force Unleashed[/b] - *.pcp/pcd pair
Top Secret Finders (2012) PC - TSF.vst
War of the Human Tanks (2012) PC - *.ald
Yesterday (2012) PC - RESOURCE.*
Zak & Jack in Showdown at Monstertown - resources.pak


other games:
7 Wonders: Magical Mystery Tour (iPhone/iPad) - Contents.dat
The Amazing Spider-Man (all platforms) - *.pkz (decompressor only, no parser)
Baldur's Gate: Dark Alliance (GC) - *.lmp
Big Town Shoot Out (WiiWare) - *. PUB
Crash Bandicoot: Nitro Kart 2 (2010) iP - data.vfs
Crash Bandicoot: Nitro Kart 2 (2010) iP - *.psnd
Crystal Defenders (XBLA, WiiWare, PSN, PSP mini) - *.bin
Doom 3: BFG Edition (2012) - *.resources
Max Payne Mobile (2012) iPhone/iPad - MaxPayneSoundsv2.msf
Splinter Cell: Conviction (all platforms) - *.spk
Wind Blood (2012) Android - sound.pack


Wave manipulation tools:
frequency changer
func_header_PCM.bms - RIFF header adder (supports different codecs)
WAV scanner - many variants supported
WAV cue extractor & injector - to provide markers without file or transfer to other files
wave stream data reverser - converts wave stream from big to little endian and vice-versa


other audio/video/archive:
Activision BAF extractor (raw) (e.g. 007: Blood Stone)
CRI engine - snd/shd pairs (contains CRI audio)
Electronic Arts *.big extractor - e.g. NHL 13 (Xbox 360)
Electronic Arts mus scanner
Electronic Arts asf extractor (EAXA) - e.g. Skate 3 (PC)
Electronic Arts mus extractor (XMA) - e.g. Skate 3 (Xbox 360)
Electronic Arts ASF extractor (BGFA identifier) - e.g. NCAA Football 13 (Xbox 360) - still needs enhancements
Electronic Arts tgq video demultiplexer
F-22 Lightning II (1996) PC - *.vdk movies
Glacier Engine sound extractor - *.whd/*.wav pairs
Das Hexagon-Kartell (1996) PC - *.anm movies
Jane's Combat Simulation - *.cb8 movies
MJZ extractor -> THANKS LUIGI!
POD extractor (versions 2, 3 & 5) *.pod
PCM interleaved header adder - *.ads (used mostly in PS2 movies)
Unity3D engine - *.assets
WiiWare Extractor (enhanced) - various formats
Wwise sound engine - *.pck with 'AKPK' identifier
Wwise sound engine - *.bnk with 'BKHD' identifier
Wwise sound engine - ogg sorter
XNB to WAV converter - Microsoft XNA Framework *.xnb
XPR2 extractor - *.xpr (various XBLA games)


some standard functions I use in my scripts:
func_str2num.bms - convert string to number
func_num2hex.bms - convert number to its hex representation string
func_checkVAR.bms - checks if all variables for functions are set
func_writename.bms - write string to memory


generic batch file to apply quickBMS scripts to multiple files
If someone isn't very adept in batch file writing, here's a batch for processing multiple files with a quickBMS script. Just replace "*.ext" with the extension you need and "script.bms" with the script you want to apply. Save the text as *.bat and run it. Of course this only works if you've added the quickbms path with the "SET" command in Windows.

Code: Select all

for %%i in (*.ext) DO quickbms.exe -o script.bms "%%i" "%CD%" 
Otherwise, just put the quickbms.exe into the same folder as the script and the files and substiturte "quickbms.exe" with "%CD%\quickbms.exe" in the batch.

Critic and suggestions are always welcome. :)
Last edited by AlphaTwentyThree on Mon Jun 04, 2018 1:43 pm, edited 175 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 ;)
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 »

Thanks alot timo. :D

a thanks doesn't hurt people lol.
User avatar
shekofte
mega-veteran
mega-veteran
Posts: 221
Joined: Sun Jan 18, 2009 1:45 pm
Location: Sagittarius
Has thanked: 301 times
Been thanked: 20 times
Contact:

Re: My quickBMS scripts

Post by shekofte »

thanks AlphaTwentyThree
so much beautiful tread :bravo:
is it possible that we request about some BMS too , here ?
ILLUSORY VIDEO GAMES ARE MORE IMPORTANT THAN PRECIOUS INTERNATIONAL FOOTBALLs
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 »

Hm, why don't you just request in the main forum? ;)
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 »

CUE section extractor and adder for WAVE files
Ever worked with cue markers? Sadly all compressed formats lack the possibility to preserve the markers of wave files. To be able to save the markers and apply them to a decoded compressed file you maybe sent someone - use the following two scripts.
This one exracts the cue section and saves it as [name of wave file].cue:

Code: Select all

get NAME basename
string NAME += ".cue"

FindLoc OFFSET string "cue" 0 ""
if OFFSET != ""
   get SIZE asize
   math SIZE -= OFFSET
   log NAME OFFSET SIZE
endif
This one applies a cue section to a wave file with the same name. If the file already has a cue section, it saves it as [name of wave file].cueold and substitues it with the new one. Apply the script to the wave file, it will automatically open the *.cue file.

Code: Select all

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
log NAME 0 SIZE MEMORY_FILE
WAVE format scanner
I already posted this inside some other topic but I'll include it here, too. Simple wave scanner. Doesn't search for the "RIFF" string as I once accidentially found it inside some other data structures where it wasn't a wave file. Instead it searches for the WAVEfmt part and extracts the file.

Code: Select all

for i = 1
   FindLoc OFFSET STRING "WAVEfmt" 0 ""
   if OFFSET != ""
      math OFFSET -= 8
      goto OFFSET
      FindLoc DATA STRING "data" 0 ""
      math DATA += 4
      goto DATA
      get SSIZE long
      savepos HEADER
      math HEADER -= OFFSET
      set SIZE HEADER
      math SIZE += SSIZE
      get NAME basename
      string NAME += "_"
      string NAME += i
      string NAME += ".wav"
      log NAME OFFSET SIZE
   else
      cleanexit
   endif
next i

WMV format scanner
When I ripped Darksiders I needed to scan for WMV files but strangely I know of no file scanner that is able to scan for WMV files. So I wrote my own. ;)

Code: Select all

for i = 1
   FindLoc OFFSET string \x30\x26\xb2\x75\x8e\x66\xcf\x11 0 ""
   if OFFSET != ""
      get NAME BASENAME
      string NAME += "_"
      if i < 10
         string NAME += "0"
      endif
      string NAME += i
      string NAME += ".wmv"

      set SIZE OFFSET
      math SIZE += 0x176
      goto SIZE
      get SIZE long
      math SIZE += 0x176
      
      log NAME OFFSET SIZE
   endif
next i
Last edited by AlphaTwentyThree on Thu Nov 10, 2011 10:20 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 »

EA *.mus extractor
Extracts the segments from newer Electronic Arts games *.mus containers. Will soon post a pack how to decode contained xma segments from Xbox 360 games

Code: Select all

get BNAME basename
string BNAME += "_"

get DUMMY long
get FILES long
	set INFO 0x1c
	math INFO *= FILES
	math INFO += 0x28
	savepos MYOFF
	goto INFO
	set DUMMY 0
	DO
		get DUMMY long
	while DUMMY == 0
	savepos INFO
	math INFO -= 0x4
goto 0x28
for i = 1 <= FILES
	get UNKNOWN long
	get NUMBER short
	get ZERO short
	get UNKNOWN long
	get OFFSET long
	reverseLong OFFSET
	math OFFSET *= 0x80
	math OFFSET += START
	get UNKNOWN long
	get SIZE long
	reverseLong SIZE
	get ZERO long
	set NAME BNAME
	string NAME += i
		savepos MYOFF
		goto INFO
		get UNKNOWN short
		get FREQ short
		reverseShort FREQ
		get ID1 byte # unknown
		get ID2 byte # segment length
		get ID3 byte # segment number
		get ID4 byte # segment type
		get ZERO long
		get ZERO long
		savepos INFO
		goto MYOFF
		# string NAME += "_"
		# string NAME += ID1
		# string NAME += "_"
		# string NAME += ID2
		string NAME += "_"
		string NAME += ID3
		string NAME += "_"
		string NAME += ID4
		string NAME += "_"
		string NAME += FREQ
	string NAME += ".ea"
	log NAME OFFSET SIZE
next i
Explanation: all extracted files have the format "name_#_segid_segtype_freq.ea". # is just a successing number to avoid duplicates, segid is a segment ID (shows which segments belong together) and segtype shows some information about the segment, e.g. if there's a beat at the beginning or distinguishes different beats. freq is just the frequency. You'll need it for the header in addXMARIFFHeader.bms (see below). You may un-comment the lines for ID1 and ID2 but it's not really necessary.

EAMUS segment conversion batch (Xbox 360 only)
Put ea_multi_xma.exe (by HCS), xmaparse.exe (by HCS), addXMARIFFHeader.bms (see above) and towav.exe (by xplorer) in the folder with the extracted files and run it.
for %%i in (*.ea) DO ea_multi_xma.exe %%i
for %%i in (*.ea_stream1) DO xma_parse.exe %%i -1 -r "%%~ni.hxma"
for %%i in (*.hxma) DO quickbms.exe -o addXMARIFFHeader.bms "%%i" "%CD%"
@towav.exe *.*
@ECHO "Deleting temporary files..."
@del *.xma
@del *.hxma
@del *.ea_stream1
@md WAV
@move *.wav WAV
@ECHO "Done!"
pause
note 1: for XMA2 files skip the marked "-1".
note 2: adjust the sample rate in addXMARIFFHeader.bms to that of the segments
note 3: to process multilayered or multichannel streams, just add batch lines for each layer:
for %%i in (*.ea_stream2) DO xma_parse.exe %%i -1 -r "%%~ni_l2.hxma"
...
@del *.ea_stream2
Last edited by AlphaTwentyThree on Mon Jun 07, 2010 1:07 am, edited 4 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 ;)
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 »

Thanks alot Alpha.

EDIT; hmm can you adjust or tell me how to adjust the script for this mus file from the simpsons game?

http://www.megaupload.com/?d=BAI49Z7V

They seem to extract at the FC01 flag.
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 »

OrangeC wrote:EDIT; hmm can you adjust or tell me how to adjust the script for this mus file from the simpsons game?
Actually, no. Someone needs to write a script that extracts the mus files according to the header and not to the flag.
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 »

Ahh, Well can you take a look at my mus sample?
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 »

Ok, updated my original post!
Now with correct *.mus extraction and whole decoding procedure for MUS files that contain XMA segments! :)
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 »

This is incredible Alpha, THX!!, this alleviates any stress with EA so far. :D
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 »

EAMUS extractor for EAXA containers
Extracts MUS containers with the new Elextronic Arts XA format and automatically adds the frequency-adjusted header. All files can be decoded with toWAV.

Code: Select all

get BNAME basename
string BNAME += "_"

get DUMMY long
get FILES long
	set INFO 0x1c
	math INFO *= FILES
	math INFO += 0x28
	savepos MYOFF
	goto INFO
	set DUMMY 0
	DO
		get DUMMY long
	while DUMMY == 0
	savepos INFO
	math INFO -= 0x4
goto 0x28
for i = 1 <= FILES
	get UNKNOWN long
	get NUMBER short
	get ZERO short
	get UNKNOWN long
	get OFFSET long
	math OFFSET *= 0x80
	math OFFSET += START
	get UNKNOWN long
	get SIZE long
	get ZERO long
	set NAME BNAME
	string NAME += i
		savepos MYOFF
		goto INFO
		get UNKNOWN short
		get FREQ short
		get ID1 byte # unknown
		get ID2 byte # segment length
		get ID3 byte # segment number
		get ID4 byte # segment type
		get ZERO long
		get ZERO long
		savepos INFO
		goto MYOFF
		string NAME += "_"
		string NAME += ID3
		string NAME += "_"
		string NAME += ID4
	string NAME += ".xa"
	callfunction addEAXAheader
	log NAME 0 SIZE MEMORY_FILE
next i

startfunction addEAXAheader
	set MEMORY_FILE binary "\x3\x0\x0\x2\x8A\xEB\x2\x0\x20\x0\x0\x0\x0\x0\x0\x0\x4\x4\xBB\x80\x60\x8C\x2A\x0\x0\x0\x0\x0\x0\x0\x0\x0"
	putVarChr MEMORY_FILE 0x12 FREQ short
	putVarChr MEMORY_FILE 0x14 SIZE long
	append
	log MEMORY_FILE OFFSET SIZE
	append
	math SIZE += 0x20
endfunction
Last edited by AlphaTwentyThree on Sat Jul 17, 2010 1:54 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 ;)
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 »

SoundNodeWave2XMA.bms
Not much to say about. The script transforms the *.SoundNodeWave files from Xbox 360 UT3 Engine games into toWAV-decodable XMA files.

Code: Select all

# SoundNodeWave2XMA.bms
# transforms UT3 Engine sounds and music of Xbox 360 games into decodable XMA files
# by AlphaTwentyThree 06-2010

goto 0x56
get FREQ short
reverseShort FREQ
FindLoc OFFSET STRING \xfc\x01\xc0\x01 0 ""
math OFFSET -= 0x6
get SIZE asize
math SIZE -= OFFSET
get NAME basename
string NAME += ".xma"
set CH 2

set MEMORY_FILE binary "\x52\x49\x46\x46\xb8\x59\xa7\x0\x57\x41\x56\x45\x66\x6d\x74\x20\x20\x0\x0\x0\x65\x1\x10\x0\xd6\x10\x0\x0\x1\x0\x0\x3\xe3\x9a\x0\x0\x80\xbb\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x2\x2\x0\x64\x61\x74\x61\x0\x58\xa7\x0"
set RIFFSIZE SIZE
math RIFFSIZE += 0x34
putVarChr MEMORY_FILE 0x04 RIFFSIZE long
putVarChr MEMORY_FILE 0x24 FREQ long
putVarChr MEMORY_FILE 0x31 CH byte
putVarChr MEMORY_FILE 0x38 SIZE long

append
log MEMORY_FILE OFFSET SIZE
append
math SIZE += 0x3c
log NAME 0 SIZE MEMORY_FILE
Last edited by AlphaTwentyThree on Sat Jul 17, 2010 1:55 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 ;)
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 »

Another great script : :D
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 »

file_deinterleave.bms
Sometimes it's necessary to deinterleave certain formats, e.g. multilayer VAG files. Just adjust header (= unprocessed area), layer count and interleave inside the script.
If you set the layer count (LAYERS) to 1 and change the skip value, you can eleminate portions of data within a file that repeat, e.g. block headers. This is the case for an AT3 format sometimes used in PS3 games (HEADER: 0, INTERL: 0x2b8, SKIP: 0x8).
Note that the last block is divided into equal parts so that the resulting files will have the same size. If the last block isn't dividable by the layer count, the script stops with an error message.

Code: Select all

set HEADER 0x0
set INTERL 0x6000
set SKIP 0x0
set LAYERS 8
set JUMP INTERL
math JUMP *= LAYERS # JUMP = size of one block
math INTERL -= SKIP
	get TEST asize
	math TEST %= LAYERS
	if TEST != 0
		print "Illegal deinterleave parameters! Aborting..."
		cleanexit
	endif
get CYCLES asize
math CYCLES /= JUMP # number of interleave blocks
get RES asize
math RES %= JUMP # size of last interleave block
#print "residuum: %RES%"
math RES /= LAYERS # size of single last interleave

if RES != 0
	print "Warning: last block is incomplete! Check your parameters!"
endif


for i = 1 <= LAYERS
	log MEMORY_FILE 0 0
	set OFFSET i
	math OFFSET -= 1
	math OFFSET *= INTERL
	math OFFSET += HEADER
	append
	for k = 1 <= CYCLES
		log MEMORY_FILE OFFSET INTERL
		math OFFSET += JUMP
		math OFFET += SKIP
	NEXT k
	if RES != 0 # incomplete but valid last block
		set OFF i
		math OFF -= 1
		math OFF *= RES
		math OFFSET -= JUMP
		math OFFSET -= SKIP
		math OFFSET += OFF
		log MEMORY_FILE OFFSET RES
	endif
	append
	get SIZE asize MEMORY_FILE
	get NAME basename
	if LAYERS != 1
		string NAME += "_"
		string NAME += i
	endif
	log NAME 0 SIZE MEMORY_FILE
next i
Last edited by AlphaTwentyThree on Tue Sep 20, 2011 10:02 pm, edited 9 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 ;)
Post Reply