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

Re: My quickBMS scripts

Post by AlphaTwentyThree »

pmfAT3_to_aa3.bms
Converts dumped AT3 streams from PMF movies to decodable *.aa3 files.

Code: Select all

get UNKNOWN short
get CODE short

set INTERL 0x2b8
set SKIP 0x8
set LAYERS 1
set JUMP INTERL
math JUMP *= LAYERS
math INTERL -= SKIP
get FSIZE asize
for i = 1 <= LAYERS
    log MEMORY_FILE 0 0
    set OFFSET i
    math OFFSET -= 1
    math OFFSET *= INTERL
    math OFFSET += SKIP
    append
    DO
        log MEMORY_FILE OFFSET INTERL
        math OFFSET += JUMP
        math OFFET += SKIP
        set TEST OFFSET
        math TEST += INTERL
    WHILE TEST <= FSIZE
    if OFFSET < FSIZE # write last block
        get LB asize
        math LB -= OFFSET
        log MEMORY_FILE OFFSET LB
    endif
    append
next i

set MEMORY_FILE2 binary "\x65\x61\x33\x3\x0\x0\x0\x0\x7\x76\x47\x45\x4f\x42\x00\x00\x01\xc6\x00\x00\x02\x62\x69\x6e\x61\x72\x79\x00\x00\x00\x00\x4f\x00\x4d\x00\x47\x00\x5f\x00\x4c\x00\x53\x00\x49\x00\x00\x00\x01\x00\x40\x00\xdc\x00\x70\x00\x08\x00\x00\x00\x00\x00\x00\x4b\x45\x59\x52\x49\x4e\x47"
putVarChr MEMORY_FILE2 0x400 0x1334145 long
putVarChr MEMORY_FILE2 0x404 0xffff6000 long
putVarChr MEMORY_FILE2 0x420 0x1 byte
putVarChr MEMORY_FILE2 0x422 CODE short
goto 0 MEMORY_FILE
get FIRST long MEMORY_FILE
putVarChr MEMORY_FILE2 0x460 FIRST long
savepos DATA MEMORY_FILE
get SIZE asize MEMORY_FILE
math SIZE -= 4
print "here"
append
log MEMORY_FILE2 4 SIZE MEMORY_FILE1
append
get NAME basename
string NAME += ".aa3"
math SIZE += 0x460

log NAME 0 SIZE MEMORY_FILE2
Last edited by AlphaTwentyThree on Fri Oct 08, 2010 10:59 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 »

I've attached a program that can convert PMF to parsed AT3+ files (with RIFF header). I downloaded it from some chinese site, can't remember which one. Use my at3toaa3.bms to convert the results into decodable aa3 files (open with SoundForge).
You do not have the required permissions to view the files attached to this post.
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 »

Thanks! Works.

pmfdemux don`t work with .pam ps3 video files(message - this is not PMF).
PMF2AVI&AT3 has APPCRASH with .pam files from another game(White Knight Chronicles EX Edition).
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 »

The contents of this post was deleted because of possible forum rules violation.
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 contents of this post was deleted because of possible forum rules violation.
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 »

MSF converter
Converts PS3 *.msf files into valid *.at3, *.ss2 and *.wav files. Not all variants are supported yet so if you encounter some problem, just PM me and I'll try to add support. :)
Note that some MSF files with AT3 stream state the wrong frequency in the header. The script will tell you when such a file is found. You'll have to change the frequency with viewtopic.php?f=13&p=71565#p71565.
func_header_AT3.bms: viewtopic.php?f=13&p=42999#p42999
func_header_SS2.bms: viewtopic.php?f=13&p=44717#p44717
func_headre_PCM.bms: viewtopic.php?f=13&p=71565#p71565

Code: Select all

# msf_convert.bms
# converts PS3 *.msf containers to playable Atrac files
# (c) 2012-07-22 by AlphaTwentyThree of XeNTaX

include "func_header_AT3.bms"
include "func_header_PCM.bms"
include "func_header_SS2.bms"

IDstring MSF
endian big
set NAME ""
get SIGN byte
get BITSIGN long
get CH long
get SIZE long
if SIGN == 0xc9
	get DUMMY long
endif
get FREQ long
set OFFSET 0x40
math SIZE -= OFFSET
if SIGN == 0x43
	if BITSIGN >= 4
		print "Warning: frequency might be wrong!"
		set BITRATE 132
		callfunction AT3 1
		cleanexit
	endif
endif
if BITSIGN == 1 # wav PCM
	set BITS 16
	set BLOCKALIGN 1
	set CODEC 1
	callfunction PCM 1
elif BITSIGN == 3 # ss2 mono
	set INTERLEAVE 0x10
	callfunction SS2 1
elif BITSIGN == 4
	set BITRATE 66
	callfunction AT3 1
elif BITSIGN == 5
	set BITRATE 105
	callfunction AT3 1
elif BITSIGN == 6
	set BITRATE 132
	callfunction AT3 1
endif
Last edited by AlphaTwentyThree on Sun Jul 22, 2012 2:47 pm, edited 7 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 »

extractXWS.bms
Extracts the Atrac files from *.xws containers (used in some PS3 games). Header is automatically adjusted, files are playable with the Atrac codec installed. Note: DO NOT OPEN ATRAC FILES WITH SONY SOUNDFORGE - ONLY ATRAC3+ FILES!!! It somehow gets the samples of simple Atrac files totally wrong when the sample count isn't adjusted (which none of the scripts does). However, I'm not sure if it's necessary to adjust the samples because I have the feeling that the (necessarily) calculated samples of audio editors could be wrong. The samples could be the value at offset 0x8 into the "fact" area of the header. Compared to the calculated samples in Audition for example, there's quite a discrepancy. Can anyone explain or clear this?

Code: Select all

endian big
getdstring IDENT 8
get UNKNOWN long
get UNKNOWN long
get FILESIZE long
get UNKNOWN long
get UNKNOWN long
get UNKNOWN long
get INFO1OFF long
get INFO2OFF long # unknown informatin

goto INFO1OFF
get UOFF long # unknown information
get CODEOFF long
get MSF long # MSFBANK

goto INFO2OFF
get UNKNOWNOFF long
get UNKNOWNOFF long
get DATASIZE long # size from MSFBANK till end

set OFF MSF
math OFF += 0x14
goto OFF

get FILES long
math OFF += 0x1c
set OFFPOS OFF
set SIZEPOS FILES
math SIZEPOS *= 4
math SIZEPOS += OFFPOS
math SIZEPOS += 0xc
get BNAME basename
string BNAME += "_"

for i = 1 <= FILES
    endian big
    goto OFFPOS
    get OFFSET long
    math OFFSET += MSF
    
    savepos OFFPOS
    goto SIZEPOS
    get SIZE long
    savepos SIZEPOS
    set NAME BNAME
    string NAME += i
    goto OFFSET
    callfunction writeAT3 1
next i

startfunction writeAT3
    
    # read info from header and adjust size
    goto OFFSET
    getDstring MSIG 4 # "MSF0" or "MSFC"
    get BITSIGN long
    get UNK long
    get SIZE long
    get FREQ long
    math OFFSET += 0x40
    
    endian little
    set MEMORY_FILE binary "\x52\x49\x46\x46\x88\xb3\x6d\x0\x57\x41\x56\x45\x66\x6d\x74\x20\x20\x0\x0\x0\x70\x2\x2\x0\x80\xbb\x0\x0\x9a\x40\x0\x0\x80\x1\x0\x0\xe\x0\x1\x0\x0\x10\x0\x0\x0\x0\x0\x0\x1\x0\x0\x0\x66\x61\x63\x74\x8\x0\x0\x0\x91\x81\x24\x1\x1b\x4\x0\x0\x64\x61\x74\x61\x88\xb3\x6d\x0"
    string NAME += ".at3"
    set RIFFSIZE SIZE
    math RIFFSIZE += 0x44
    if BITSIGN == 4 # 66kbps
        putVarChr MEMORY_FILE 0x1c 0x204d long
        putVarChr MEMORY_FILE 0x20 0xc0 long
    elif BITSIGN == 5 # 105 kbps
        putVarChr MEMORY_FILE 0x1c 0x3324 long
        putVarChr MEMORY_FILE 0x20 0x130 long
    elif BITSIGN == 6 # 132 kbps
        putVarChr MEMORY_FILE 0x1c 0x409a long
        putVarChr MEMORY_FILE 0x20 0x180 long
    endif
    putVarChr MEMORY_FILE 0x04 RIFFSIZE long
    putVarChr MEMORY_FILE 0x16 0x2 byte
    putVarChr MEMORY_FILE 0x18 FREQ long
    putVarChr MEMORY_FILE 0x48 SIZE long
    append
    log MEMORY_FILE OFFSET SIZE
    append
    math SIZE += 0x4c
    log NAME 0 SIZE MEMORY_FILE
    endian big
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 ;)
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 for the MSF script :)
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 »

np :)
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 ;)
1212fg
ultra-n00b
Posts: 8
Joined: Sun Oct 03, 2010 2:07 pm

Re: My quickBMS scripts

Post by 1212fg »

thanks a lot AlphaTwentyThree for scripts. Im noob and until today i didn know about quickbms, but with Your scripts a had successful extracted tracks from Skate 3 on Xbox 360. I suggest better file naming - sorting in explorer doesnt work good with this filenames, but there is always search function ;) Also Your header script was useful for another rip. Is there any chance to make script which will combine WAV files? I combine one song manually and its painfull;
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 »

Glad you could use some of the scripts here. ;) Skate 3 was actually the game I wrote the EA script for. You can change the script if you want to use the information otherwise, I just throw all the info into the filename because it shows which segments belong together.
Combining segments is only easy when the files really match, i.e. if there's no silence or click at the transition. Try it first by combining the segments with Winamp. If you play the song and don't hear any transition: play and close your eyes to be unable to see where the transitions are - if you don't hear anything, the combining is ok. Then just switch to the old DiscWriter Plugin to write the merged file to disc. I think I also wrote this into the EA segments post. If you have any questions, just ask here. :)
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 ;)
1212fg
ultra-n00b
Posts: 8
Joined: Sun Oct 03, 2010 2:07 pm

Re: My quickBMS scripts

Post by 1212fg »

AlphaTwentyThree wrote:Glad you could use some of the scripts here. ;) Skate 3 was actually the game I wrote the EA script for. You can change the script if you want to use the information otherwise, I just throw all the info into the filename because it shows which segments belong together.
Combining segments is only easy when the files really match, i.e. if there's no silence or click at the transition. Try it first by combining the segments with Winamp. If you play the song and don't hear any transition: play and close your eyes to be unable to see where the transitions are - if you don't hear anything, the combining is ok. Then just switch to the old DiscWriter Plugin to write the merged file to disc. I think I also wrote this into the EA segments post. If you have any questions, just ask here. :)
I forgot about this winamp plugin, it much easier than cut& paste in wave editor;)
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 »

1212fg wrote:I forgot about winamp plugin, it much easier than cut& paste in wave editor;)
Hehe ;)
The plugin is neat because it stream-dumps the data onto disk DIGITALLY - unlike loop-recording with your soundcard, which is always ANALOGUE!
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 »

The plugin is really useful however the segments im using are 36hz and there is no setting for that in there, is there someway i can change it or should i just use another program?
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 frequency is taken from the archive information, so you shouldn't change it in the first place.
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