Page 8 of 32

Re: My quickBMS scripts

Posted: Thu Nov 18, 2010 1:07 pm
by OrangeC
The contents of this post was deleted because of possible forum rules violation.

Re: My quickBMS scripts

Posted: Thu Nov 18, 2010 3:01 pm
by AlphaTwentyThree
The contents of this post was deleted because of possible forum rules violation.

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 1:20 pm
by Researchman
The contents of this post was deleted because of possible forum rules violation.

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 3:15 pm
by AlphaTwentyThree
The contents of this post was deleted because of possible forum rules violation.

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 3:25 pm
by AlphaTwentyThree
Generic file splitter
This is a VERY powerful script if you encounter a game archive with various files of one type in it but without information table. Happens quite often in PS2 games I realized now. The script searches for occurances of a given string and splits up the file where such an occurance is found.
You find some really useful suggestions for some split types inside the script. Remember to adjust the other variables accordingly of you use one of them (see comments in script).
What you have to adjust:
  • set OFFSET # - offset where the first file to be written starts. If you leave it at zero, the script will also write the area before the first occurance of the search string to disk
  • set SKIP # - if you want to leave out bytes after the designated searchstring, put that here. Can be negative (e.g. when you don't want to distinguish between RIFF and RIFX files, just search for "WAVEfmt" and set SKIP to -8)
  • set NEGBIAS # - if the split identifier is at the end of a file (like stop markers), adjust this to the length of the identifier. E.g. if some file type always ends in 0xFFFFFFFFFFFFFFFF, search for \xff\xff\xff\xff\xff\xff\xff\xff and set NEGBIAS to 8.
  • set SIZEBIAS # - STANDARD VALUE IS -1! If you want to extract only one type of file and the file size is given in the header, set this to the according value. With this option, the script works as a file scanner (!).
  • set REV 0/1 - if the file size from the above offset is big endian, just set this to 1
  • FindLoc SIZE string # 0 "" - String or hex code to be searched. Hex code as always in C notation (see posted script)
Note 1: The first file to be written doesn't have any extension. It's the data block before the first found instance of the search string.
Note 2: If the search string isn't found, no data is written to disk
Note 3: The last extracted file always stops at the end of the file, so it usually contains more data than what you need.
Note 4: If you have an archive with more than one file type inside (multiple identifiers), run the script multiple times (first on the main archive, then on the extracted files).
Note 4: another use of this script is to split a file by zero blocks. For this, set the search string to the minimum zero block you need and set NEGBIAS to the length of the block you provided. Of course the script won't leave out zeros at the start of the next found split point but as a hint: you can run this script multiple times. ;)

Example to use this as a wave scanner:
set EXT ".wav"
set SIZEBIAS 4
set REV 0
set MINSIZE 0x10 (just estimated)
FindLoc SIZE string "RIFF" 0 ""

Code: Select all

# generic splitter / scanner
# very powerful for raw ripping
# (c) 2013-10-30 by AlphaTwentyThree of XeNTaX
# script for QuickBMS http://quickbms.aluigi.org

set OFFSET 0 # begin scan here
set SKIP 0x0 # skip bytes at start of search string 
           # (use negative value if search identifier is after file start)
set NEGBIAS 0x0 # search string at end of file e.g. stop markers (positive value!)
set EXT ".segs" # add this extention
set NAMEPOS "" # if all files are the same type and you know the position of the names
set SIZEBIAS 0xc # offset bias where file size is found
set REV 1 # 0 = leave, 1 = big endian
set MINSIZE 0x4 # minimal size of extracted file
set WRITEOFFSET 0 # toggle between file.ext@offset and file_#
get FSIZE asize

if SKIP < 0
	math OFFSET -= SKIP
else
	math OFFSET += SKIP
endif
set SEARCH OFFSET
set QUIT 0
set SINGLE 0
set i 0
do
	goto SEARCH
	#print "searching from offset %SEARCH%"
	#FindLoc SIZE string \x7\x0\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77 0 "" # VAG stop marker 1
	#FindLoc SIZE string \x7\x0\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x7\x0\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77 0 ""
	#FindLoc SIZE string \x00\x07\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77 0 ""
	#FindLoc SIZE string \x00\x07\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0 0 ""
	#FindLoc SIZE string \xC\x3\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0 0 "" # VAG stop marker 2
	#FindLoc SIZE string \xC\x6\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0 0 "" # VAG stop marker 3
	#FindLoc SIZE string \xC\x7\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0 0 "" # VAG stop marker 4
	#FindLoc SIZE string \x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0 0 "" # 0x10 zero block
	#FindLoc SIZE string \x2\x28\x3\x3\x\x\x\x28 0 "" # ubisoft packet *.ubipack
	#FindLoc SIZE string "FUNlXMA2" 0 "" # xma2 container (Men in Black: Alien Crisis)
	#FindLoc SIZE string \x8D\x0C\x53\x4F 0 ""
	#FindLoc SIZE string \x5D\0\x\x80 0 "" # lzma signature
	#FindLoc SIZE string "MUSX" 0 ""
	#FindLoc SIZE string "MSFC" 0 ""
	#FindLoc SIZE string \xFF\xFF\x0\x0\xFF\xFF\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\xFF\xFF\x0\x0\xFF\xFF\x0\x0 0 "" # Xbox ADPCM silence
	#FindLoc SIZE string \x0C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 0 "" # Xbox ADPCM silence
	#FindLoc SIZE string \x02\x28\x03\x03\x00\x00\x00\x28 0 "" # ubi sound pack
	#FindLoc SIZE string \x48\x00\x00\x0C\x13 0 "" # eaxma stream start
	#FindLoc SIZE string \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 0 "" # 32bytes of zeros
	#FindLoc SIZE string \x00\x00\x01\xBA\x44\x00\x04\x00 0 "" # PSS movie
	#FindLoc SIZE string \x30\x26\xB2\x75\x8E\x66\xCF\x11 0 "" # wmv
	#FindLoc SIZE string \x48\x00\x00\x0c 0 "" # EA
	#FindLoc SIZE string \x48\x00\x00\x0C 0 "" # EAlayer3
	#FindLoc SIZE string "FSB5" 0 ""
	#FindLoc SIZE string \x80\x00\x00\x24 0 "" # adx
	#FindLoc SIZE string \x51\x5A\x49\x50\x00\x44\x43\x5F\x49\x4E\x46\x4F 0 "" # QZIP (Heavy Rain)
	FindLoc SIZE string "segs" 0 ""
	#FindLoc SIZE string "Interplay MVE File" 0 ""
	#FindLoc SIZE string \x48\x00\x00\x0C\x16\x04 0 ""
	
	if SIZE == ""
		set QUIT 1
		get SIZE asize
		if i == 0
			cleanexit
		endif
	else
		#print "split point found at offset %SIZE%"
	endif
	math SIZE -= OFFSET
	if SIZE == 0 # no residual data at start
		math i += 1
	elif SIZE > 4
		if NAMEPOS == ""
			get NAME basename
			if WRITEOFFSET == 1
				string NAME += "@"
				string NAME += OFFSET
			else
				string NAME += "_"
				string NAME += i
			endif
			if i != 0
				if SINGLE != 1
					string NAME += EXT
				endif
			endif
		else
			savepos MYOFF
			goto NAMEPOS
			get NAME string
			savepos NAMEPOS
		endif
		math OFFSET += SKIP
		if QUIT != 1
			math SIZE -= SKIP
			math SIZE += NEGBIAS
		endif
		if SIZE >= MINSIZE
			if SIZEBIAS > 0
				savepos MY
				set GO OFFSET
				math GO += SIZEBIAS
				goto GO
				get SIZE2 long
				if REV == 1
					reverselong SIZE2
				endif
				goto MY
				log NAME OFFSET SIZE2
			else
				log NAME OFFSET SIZE
			endif
			print "found %SIZE% bytes file @ %OFFSET% (read from %GO%)"
			math i += 1
		endif
	else
	endif
	if QUIT != 1
		math OFFSET += SIZE
		set SEARCH OFFSET
		if SKIP > 0
			math OFFSET += SKIP
		else 
			math OFFSET -= SKIP
		endif
		math SEARCH += 4 # needs to be the length of the search string
		if SEARCH >= FSIZE
			set QUIT 1
		endif
	endif
while QUIT != 1

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 4:37 pm
by Researchman
The contents of this post was deleted because of possible forum rules violation.

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 6:06 pm
by AlphaTwentyThree
The script already converts msf to playable at3 - that's why it's called msf2at3... dude, look at the files in hex.

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 6:22 pm
by Researchman
I have a problem with playing at3 files. I install Atrac3 codec, but Winamp, Windows Media Player, Media Player Classic, Sony SoundForge, SonicStage cant play audio.

At3 audio, which normal decode to aa3 cant be played in Media Player Classic.

At3 audio, which cant decode to aa3 can be played in Media Player Classic, but no music.

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 7:04 pm
by AlphaTwentyThree
Researchman wrote:I have a problem with playing at3 files. I install Atrac3 codec, but Winamp, Windows Media Player, Media Player Classic, Sony SoundForge, SonicStage cant play audio.

At3 audio, which normal decode to aa3 cant be played in Media Player Classic.

At3 audio, which cant decode to aa3 can be played in Media Player Classic, but no music.
I just checked, I can play the files with Windows Media Player. Where did you download the Atrac codec from? Can you play the file with KMPlayer?

Re: My quickBMS scripts

Posted: Sun Nov 28, 2010 8:36 pm
by mauzerX
AlphaTwentyThree wrote:gen_split.bms
This is a VERY useful script if you encounter a game archive with various files of one type in it but without information table. Happens quite often in PS2 games I realized now.
Great!Universal scanner :up:

Re: My quickBMS scripts

Posted: Mon Nov 29, 2010 11:48 am
by OrangeC
AlphaTwentyThree wrote:gen_split.bms
This is a VERY useful script if you encounter a game archive with various files of one type in it but without information table. Happens quite often in PS2 games I realized now. The script searches for occurances of a given string and splits up the file where such an occurance is found.
What you have to adjust:
set OFFSET # - offset where the first file to be written starts. If you leave it at zero, the script will also write the area before the first occurance of the search string to disk
math SEARCH += # - enter the length of the search string here
FindLoc SIZE string "#" 0 "" - String or hex code to be searched. Hex code as always in C notation (see posted script)

Code: Select all

get BNAME basename
string BNAME += "_"
set OFFSET 0
set SEARCH OFFSET
math SEARCH += 8
set QUIT 0
for i = 1
	goto SEARCH
	FindLoc SIZE string "\x41\x48\x56\x0\x44\x0\x0\x0" 0 ""
	if SIZE == ""
		get SIZE asize
		set QUIT 1
	endif
	math SIZE -= OFFSET
	set NAME BNAME
	string NAME += i
	log NAME OFFSET SIZE
	if QUIT != 1
		math OFFSET += SIZE
		set SEARCH OFFSET
		math SEARCH += 8 # needs to be the lengh of the search string
	else
		cleanexit
	endif
next i

Example: if you don't need the information before the first occurance of "RGHJ", which is at OFFSET 0x354, the lines are

Code: Select all

...
set OFFSET 0x354
...
math SEARCH += 4
....
FindLoc SIZE string "RGHJ" 0 ""

How to convert hex code to C notation format?

Re: My quickBMS scripts

Posted: Mon Nov 29, 2010 2:42 pm
by AlphaTwentyThree
OrangeC wrote:How to convert hex code to C notation format?
You can see it inside the script - that \x.. \x.. format, that's C notation. For longer sequences, use byte2hex here: http://aluigi.altervista.org/mytoolz.htm#both (that's what I used for the long headers). But you don't need that for those short search terms as you normally don't search for hex code that's longer than 8 bytes.

Oh and please don't just quote everything when you're referring to just one tiny subject of the post... ;)

Re: My quickBMS scripts

Posted: Mon Nov 29, 2010 3:45 pm
by OrangeC
Thanks so much man it worked!!

very useful script, would save me and alot of people time :D

Re: My quickBMS scripts

Posted: Mon Nov 29, 2010 4:00 pm
by Researchman
AlphaTwentyThree wrote:
Researchman wrote:I have a problem with playing at3 files. I install Atrac3 codec, but Winamp, Windows Media Player, Media Player Classic, Sony SoundForge, SonicStage cant play audio.

At3 audio, which normal decode to aa3 cant be played in Media Player Classic.

At3 audio, which cant decode to aa3 can be played in Media Player Classic, but no music.
I just checked, I can play the files with Windows Media Player. Where did you download the Atrac codec from? Can you play the file with KMPlayer?
I download Atrac3 codec from here - http://www.free-codecs.com/download/son ... _codec.htm
KMPlayer cant play at3 files.

Maybe I dont fully install Atrac3 codec.

Re: My quickBMS scripts

Posted: Mon Nov 29, 2010 4:11 pm
by AlphaTwentyThree
Researchman wrote:I download Atrac3 codec from here - http://www.free-codecs.com/download/son ... _codec.htm
KMPlayer cant play at3 files.

Maybe I dont fully install Atrac3 codec.
Ok, last chance: send me the AT3 file that you can't play.