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 »

Wave data reverser
Sometimes you encounter wave files that just play static but you can see that they are normal PCM files. Those are big endian streams with a little endian header. Normal process would be to strip the header, save the data as raw, open as big endian in an audio editor and save as PCM again. As this process can be pretty exhausting, I've written a little script that just reverses the wave data. The header stays untouched.
Note that the input has to be a standard PCM file with 4-byte block align.

Code: Select all

# reverse the data of a standard wave file
# (c) 2012-07-07 by AlphaTwentyThree of XeNTaX

idstring "RIFF"
do
	findLoc HEADER string "data" 0 ""
	goto HEADER
	idstring "data"
	get SIZE long
while SIZE == 0
math HEADER += 0x8

get SIZE asize
putVarChr MEMORY_FILE SIZE 0
log MEMORY_FILE 0 0
set LOOPS SIZE
math LOOPS -= HEADER
math LOOPS /= 2
append
log MEMORY_FILE 0 HEADER # write header
set OFFSET HEADER
goto OFFSET
for i = 1 <= LOOPS
	get WRITE short
	reverseShort WRITE
	putVarChr MEMORY_FILE OFFSET WRITE short
	math OFFSET += 2
next i
append
get NAME basename
string NAME += "_littled"
string NAME += ".wav"
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 »

Crystal Defenders bin extractor

Works for XBLA, WiiWare, PSN and PSP mini. :)

Code: Select all

# extract *.bin files from Crystal Defenders (XBLA, WiiWare, PSN, PSP)
#
# (c) 2012-07-08 by AlphaTwentThree of XeNTaX

get IDENT long
get FILES long
goto 0x20
if IDENT == 0x58424201 # XBLA
	endian big
	callfunction XBB 1
elif IDENT == 0x01424258 # PSP/PSN
	callfunction XBB 1
else
	get FSIZE asize
	math FSIZE -= 0x20
	reverseLong IDENT
	if IDENT == FSIZE # WiiWare
		endian big
		reverseLong FILES
		callfunction Wii_bin
	else
		cleanexit
	endif
endif

startfunction XBB
	for i = 1 <= FILES
		get OFFSET long
		get SIZE long
		get NAMEPOS long
		get NAME_CRC long
		if NAMEPOS != 0
			savepos MYOFF
			goto NAMEPOS
			get NAME string
			goto MYOFF
		else
			string NAME_CRC p= "_%08x" NAME_CRC
			get NAME basename
			string NAME += NAME_CRC
		endif
		log NAME OFFSET SIZE
	next i
endfunction
startfunction Wii_bin
	set OFFSET 0x20
	for i = 1 <= FILES
		goto OFFSET
		get SIZE long
		get NAME basename
		string NAME += "_"
		string NAME += i
		log NAME OFFSET SIZE
		math 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 ;)
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 »

aluigi's script also have this:
Image
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 »

Enhanced WiiWare extractor
As I wasn't quite satisfied with the procedure to extract the contents of extracted WiiWare *.wad images, I wrote my own script. The basis is just a U-8 archive extractor, but it does more than just extract/decompress it's contents:
- it searches for a U-8 archive within a file, dumps the data before the found identifier and processes the U-8
- it analyzes the content of each file from the U-8 after dumping it into memory:
-> if the data has an "LZ77" identifier, it automatically decompresses the contents
-> if the data has an "IMD5" identifier, it looks for either a "BNS " (sound) or "LZ77" identifier. If the latter is found, it decompresses the content
- the above two steps also apply to files that are no U-8 archives but have these three identifiers.
If you have ever worked with WAD WiiWare images, you know that the process of extracting everything can be rather tedious. This script will fasten the process a bit. :)
Just to get an idea what the potential is:
- when you extract the 00000000.app, the banner.bin, icon.bin and sound.bin are already decompressed. If the sound.bin wasn't compressed, it's already named sound.bin.bns and ready to be played in Winamp with the vgmstream input
- when you extract some other U-8 archive, all the contents will be fully decompressed, even if they start with the LZ77 identifier and not with 0x10/0x11.
- you can throw in LZ77-compressed files with either 0x10/0x11 or "LZ77" identifier and decompress them. Any found data with IMD5 identifier will be analyzed further.
- you can throw in files with "IMD5" identifier and the content will be decompressed.
So after all, this is quite a powerful script. :)

Code: Select all

# enhanced WiiWare extractor
# supported formats: U-8 archives, LZ77-compressed files ("LZ77" or 0x10/0x11 identifier) and files with "IMD5" identifier
# - if LZ77-compressed data is found in an IMD5 file within a U-8 archive or if the IMD5 file is the input, it is automatically decompressed
# - if a BNS sound file is found in a IMD5 file within a U-8 archive or if the IMD5 file is the input, it is automatically extracted
# - if the input is an LZ77-compressed file (all identifiers), it is decompressed and analyzed further with the above criteria
# (c) 2012-07-08 by AlphaTwentyThree of XeNTaX

set SUBFOLDER 1 # decide if you want to take the archive name as root folder (U-8 only)
if SUBFOLDER == 1
	get AFOLDER basename
	string AFOLDER += "/"
endif

endian big
comtype COMP_LZ77WII
FindLoc OFFSET string \x55\xaa\x38\x2d 0 ""
get SIZE asize
if OFFSET == "" # something else -> test in MEM2
	log MEMORY_FILE 0 0
	goto 0
	get TEST byte
	if TEST == 0x10
		endian little
		get ZSIZE threebyte
		endian big
		clog MEMORY_FILE2 0 SIZE ZSIZE
	elif TEST == 0x11
		get ZSIZE threebyte
		clog MEMORY_FILE2 0 SIZE ZSIZE
	else
		log MEMORY_FILE2 0 SIZE
	endif
	get WNAME basename
	callfunction testMEM2 1
else
	if OFFSET != 0
		get NAME basename
		string NAME += ".dump"
		if SUBFOLDER == 1
			set WNAME AFOLDER
			string WNAME += NAME
		else
			set WNAME NAME
		endif
		log WNAME 0 OFFSET
	endif
	math SIZE -= OFFSET
	putVarChr MEMORY_FILE SIZE 0
	log MEMORY_FILE 0 0
	append
	log MEMORY_FILE OFFSET SIZE # plain U-8 archive
	append
	callfunction processU8 1
endif


startfunction processU8
	goto 0 MEMORY_FILE
	idstring \x55\xaa\x38\x2d MEMORY_FILE # U-8
	get OFF_INFO long MEMORY_FILE
	get INFOSIZE long MEMORY_FILE
	get UNK long MEMORY_FILE
	callfunction getFiles 1 # number of files
	set OFFNAMES FILES
	math OFFNAMES *= 0xc
	math OFFNAMES += OFF_INFO
	set FOLDER ""
	for i = 1 <= FILES
		goto OFF_INFO MEMORY_FILE # FID in main U-8
		get FIDENT byte MEMORY_FILE
		get OFF_NAME threebyte MEMORY_FILE
		get OFFSET long MEMORY_FILE
		get SIZE long MEMORY_FILE # compressed size
		savepos OFF_INFO MEMORY_FILE # continue from here after if
		math OFF_NAME += OFFNAMES
		goto OFF_NAME MEMORY_FILE
		get NAME string MEMORY_FILE
		if FIDENT == 1
			callfunction setFolder 1
		else # file decompression or copy to MEMORY_FILE2
			set WNAME FOLDER
			string WNAME += NAME # complete name
			goto OFFSET MEMORY_FILE
			get IDENT byte MEMORY_FILE
			log MEMORY_FILE2 0 0
			if IDENT == 0x10
				endian little
				get ZSIZE threebyte MEMORY_FILE
				endian big
				clog MEMORY_FILE2 OFFSET SIZE ZSIZE MEMORY_FILE # decompress to MEM2
				print "ok"
			elif IDENT == 0x11
				get ZSIZE threebyte MEMORY_FILE
				clog MEMORY_FILE2 OFFSET SIZE ZSIZE MEMORY_FILE
				print "ok"
			else # no matter what else
				log MEMORY_FILE2 OFFSET SIZE MEMORY_FILE
				print "ok"
			endif
			get SIZE asize MEMORY_FILE2
			if SIZE >= 4
				callfunction testMEM2 1
			else
				log WNAME 0 SIZE MEMORY_FILE2
			endif
		endif
	next i
endfunction

startfunction testMEM2
	get SIZE asize MEMORY_FILE2
	set OFFSET 0
	goto 0 MEMORY_FILE2
	getDstring IDENT 4 MEMORY_FILE2
	if IDENT == "IMD5" # test for BNS or LZ77
		goto 0x20 MEMORY_FILE2
		getDstring IDENT 4 MEMORY_FILE2
		if IDENT = "BNS "
			set OFFSET 0x20
			math SIZE -= OFFSET
			string WNAME += ".bns"
			log WNAME OFFSET SIZE MEMORY_FILE2
		elif IDENT == "LZ77"
			set OFFSET 0x24
			math SIZE -= OFFSET
			get TYPE byte MEMORY_FILE2
			if TYPE == 0x10
				endian little
			endif
			get ZSIZE threebyte MEMORY_FILE2
			endian big
			string WNAME += ".decomp"
			clog WNAME OFFSET SIZE ZSIZE MEMORY_FILE2
		else
			set OFFSET 0x20
			math SIZE -= OFFSET
			string WNAME += ".imd"
			log WNAME OFFSET SIZE MEMORY_FILE2 # change nothing
		endif
	else
		if IDENT == "BNS "
			string WNAME += ".bns"
		endif
		get SIZE asize MEMORY_FILE2
		log WNAME 0 SIZE MEMORY_FILE2 # change nothing
	endif
endfunction

startfunction setFOLDER
	if SUBFOLDER == 1
		set FOLDER AFOLDER
		string FOLDER += NAME
		if NAME != ""
			string FOLDER += "/"
		endif
	else
		if NAME != ""
			set FOLDER NAME
			string FOLDER += "/"
		else set FOLDER ""
		endif
	endif
endfunction

startfunction getFiles
	set TEST OFF_INFO
	goto TEST MEMORY_FILE
	for
		get IDENT1 byte MEMORY_FILE
		get IDENT2 byte MEMORY_FILE
		if IDENT2 > 0
			break
		else
			math TEST += 0xc
			goto TEST MEMORY_FILE
		endif
	next
	savepos FILES MEMORY_FILE
	math FILES -= 2
	math FILES -= OFF_INFO
	math FILES /= 0xc
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 »

WiiWare: Big Town Shoot Out *. PUB extractor

Code: Select all

# extract *.PUB files from Big Town Shoot Out (WiiWare)
# (c) 2012-07-08 by AlphaTwentyThree of XeNTaX

comtype COMP_LZ77WII
endian big
goto 0x24
get FILES long
get INFO long
goto INFO
for i = 1 <= FILES
	get NAME_CRC long
	string NAME_CRC p= "_0x%08x" NAME_CRC
	get OFFSET long
	get UNK long
	get SIZE long
	get ZSIZE long
	get ZERO long
	get UNK long
	get NAME basename
	string NAME += NAME_CRC
	if SIZE == ZSIZE
		log NAME OFFSET SIZE
	else
		clog NAME OFFSET SIZE ZSIZE
	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 ;)
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 a little update on what I'm currently doing: I've encountered several *.brsar sound archives from WiiWare games now (the Bit.Trip series to be precise) and as there's currently no extractor available, I'm trying to write my own. :)
The structure reminds of the *.sdat files from Nintendo DS games, but not as sophisticated. Still, it's no simple extraction because there are several sections with different infos (like in the SDATs). Additionally, the files are divided into RWAR packs, each containing numbers of files. I'm currently searching for a way to link the names to the files. I guess, there's some ID for every file and somewhere there are pointers from the offsets to the files. Else, I didn't yet figure out why there are more names than RWAV entries - they probably correlate to the pack names. Some analyzing to do but I think it'll be worth the effort and many games will be correctly rippable from then on! :)
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 »

Playstation XA extractor
This script splits deinterleaved XA files to playable XA files.
To get a correctly deinterleaved XA files:
- raw-copy the big XA to your HD (i.e. with ISOBuster)
- open the file with a hex editor, set the jump parameter to 0x930, look at the byte at cursor +0x11, it will increase each 0x930 jump
- as soon as the counter reaches 00 again, you have your desired layer count (highest number plus one as the counting starts at zero) - always a power of two (normally either 0x4, 0x8 or 0x10)
- set your deinterleave parameters accordingly with INTERLEAVE 0x930 and the above layer count and deinterleave with my script or any program that can do this operation
Each of the deinterleaved files will be the same size of course and will contain a number of xa streams, which you can extract with this sript. Don't worry if the size of the extracted files is by far smaller than the size of the layer - that's because there's plenty of filling bytes and the main reason why PSX images can be compressed with such a high ratio.
I might extend this script to do all of the above steps automatically but I'm too lazy at the moment. ;)
As you can see, the script is just a simplified version of my generic file splitter. Remember to put the needed func_header_CDXA.bms into the same directory as this script.

Code: Select all

# Playstation XA extractor
# extracts playable cdxa files from deinterleaved xa packs
# (c) 2012-07-14 by AlphaTwentyThree of XeNTaX

include "func_header_CDXA.bms"
set OFFSET 0x0
set NEGBIAS 4
set EXT ".xa"
set SEARCH OFFSET
set QUIT 0
set SINGLE 0
set i 1
do
	goto SEARCH
	FindLoc SIZE string \xA2\xF1\xA6\x1B 0 "" # negbias 4 (CDXA split marker)
	if SIZE == ""
		set QUIT 1
		get SIZE asize
		if i == 0
			goto 0
			set SINGLE 1
		endif
	endif
	math SIZE -= OFFSET
	get NAME basename
	if SINGLE != 1
		string NAME += "_"
		string NAME += i
		if i != 0
			string NAME += EXT
		endif
	else
		string NAME += EXT
	endif
	if QUIT != 1
		math SIZE += NEGBIAS
	endif
	if SIZE > 0x930
		callfunction CDXA 1
		math i += 1
	endif
	if QUIT != 1
		math OFFSET += SIZE
		set SEARCH OFFSET
		math SEARCH += 4
	endif
while QUIT != 1
Last edited by AlphaTwentyThree on Thu Aug 09, 2012 1:27 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 »

Electronic Arts AST archive extractor (BGFA identifier)
For those big ast archives with BGFA identifier. Only tested with BGFA version 1.05, but enough work to figure out the format, which was quite a hazzle because the length of the variables varies between archives, which is really uncommon.
No file names but if getTYPE doesn't recognize the type the internal type is used as an extension (although I'm not entirely sure if that's really the file type ;) ). If you encounter any ast archive that doesn't work with this script or if you need other extensions implemented, post here. I've only looked for extensions that the games I tested use.
Newest func_getTYPE.bms needed!

Code: Select all

# extract Electronic Arts BGFA containers
# (c) 2012-09-17 by AlphaTwentyThree of XeNTaX

set SUBFOLDER 1
include "func_getTYPE.bms"
idstring "BGFA"
getDstring VER 4
if VER != "1.05"
	print "Unsupported BGFA version (%VER%)! Please contact me at XeNTaX"
endif
goto 0x21 # determine information per file
	get LENGTH_FTYPE byte # boolean (?)
	if LENGTH_FTYPE == 0
		set FTYPE == ""
		set SUBFOLDER 1
	endif
	get LENGTH_HASH byte
	get LENGTH_OFFSET byte
	get LENGTH_ZSIZE byte
	get LENGTH_SIZE byte # 0 -> only uncompressed data
	
	math LENGTH_INFO = 1
	math LENGTH_INFO += LENGTH_FTYPE
	math LENGTH_INFO += LENGTH_HASH
	math LENGTH_INFO += LENGTH_OFFSET
	math LENGTH_INFO += LENGTH_ZSIZE
	math LENGTH_INFO += LENGTH_SIZE
	if LENGTH_SIZE != 0
		set MULTI_OFF 0x10
		if LENGTH_OFFSET == 3
			set MULTI_OFF 4
		endif
		if LENGTH_ZSIZE == 0
			set MULTI_OFF 1
		endif
	endif

goto 0x10
get HEADER long
goto 0x28
get JUMP long
math JUMP *= 4

goto 0x18
get LENGTH_TOC long # file table plus unknown 4byte variable at start
math LENGTH_TOC -= HEADER
	#set FILES LENGTH_TOC
	#math FILES /= LENGTH_INFO
set OFF_INFO HEADER
math OFF_INFO += JUMP
goto 0xc
get FILES long
goto OFF_INFO

for i = 0 < FILES
    get DUMMY byte # always
	if LENGTH_FTYPE == 1
		get FTYPE byte
	endif
	if LENGTH_HASH == 8
		get HASH longlong
	elif LENGTH_HAS == 4
		get HASH long
	endif
	if LENGTH_OFFSET == 2
		get OFFSET short
	elif LENGTH_OFFSET == 3
		get OFFSET threebyte
	elif LENGTH_OFFSET == 4
		get OFFSET long
	endif
	if LENGTH_ZSIZE == 2
		get ZSIZE short
	elif LENGTH_ZSIZE == 3
		get ZSIZE threebyte
	elif LENGTH_ZSIZE == 4
		get ZSIZE long
	endif
	if LENGTH_SIZE == 2
		get SIZE short
	elif LENGTH_SIZE == 3
		get SIZE threebyte
	elif LENGTH_SIZE == 4
		get SIZE long
	endif
	math OFFSET *= MULTI_OFF
	putVarChr MEMORY_FILE ZSIZE 0
	log MEMORY_FILE 0 0
    if LENGTH_SIZE != 0 # if compressed data present
		if SIZE == 0
			log MEMORY_FILE OFFSET ZSIZE
		else
			math SIZE += ZSIZE
			
			clog MEMORY_FILE OFFSET ZSIZE SIZE
		endif
	else # only uncompressed data
		log MEMORY_FILE OFFSET ZSIZE
	endif
	savepos MYOFF
	callfunction getTYPE 1
	goto MYOFF
	get NAME basename
	string NAME += "_"
	string NAME += i
	if EXT == ""
		string NAME += "."
		string NAME += FTYPE
		if FTYPE == 11
			string NAME += ".xml"
		elif FTYPE == 0
			string NAME += ".xml"
		endif
	else
		string NAME += EXT
	endif
	set WNAME ""
	if SUBFOLDER == 1
		get WNAME basename
		string WNAME += "/"
	endif
	#string WNAME += FTYPE
	#string WNAME += "/"
	string WNAME += NAME
	get SIZE asize MEMORY_FILE
	log WNAME 0 SIZE MEMORY_FILE
next i
Last edited by AlphaTwentyThree on Mon Sep 17, 2012 2:20 pm, edited 2 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 »

Sega CD *.bin movie audio demuxer
I have no idea about the audio format, never seen something like that. The header doesn't hold any information about the audio data so currently I'm stuck with a raw demux feature.

Code: Select all

# extracts the raw audio from Sega CD *.bin movies
# tested games:
# The Amazing Spider-Man vs. The Kingpin
#
# (c) 2012-07-17 by AlphaTwentyThree of XeNTaX

idstring "CONF"
endian big
set OFFSET 0
do
	goto OFFSET
	getDstring IDENT 4
	get SIZE long
	math OFFSET += 8
	math SIZE -= 8
	if IDENT == "AUDI"
		append
		log MEMORY_FILE OFFSET SIZE
		append
	endif
	math OFFSET += SIZE
while IDENT != "MEND"
get SIZE asize MEMORY_FILE
set OFFSET 0
get NAME basename
string NAME += ".raw"
log NAME OFFSET 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 ;)
SnarbleBarb
n00b
Posts: 17
Joined: Thu Dec 15, 2011 9:24 am
Has thanked: 9 times
Been thanked: 1 time

Re: My quickBMS scripts

Post by SnarbleBarb »

Hi AlphaTwentyThree,

Thanks so much for giving some attention to the EA .AST archives! I tried your AST script on NCAA Football '13 (XBOX360) and I'm having some errors extracting the files.

"qkl_heisman1.AST" and "qkl_heisman2.AST" works great. They both spit out a bunch of .vp6 files. "qkl_interface.AST" spits out 618 smaller .AST files and a lot of system beeps. However,

"qkl_boot.AST" gives me the following error:

Code: Select all

00000083 01  72  clog MEMORY_FILE OFFSET ZSIZE SIZE
             <get MEMORY_FILE (27) "MEMORY_FILE"
             <get OFFSET (23) 0x00001890
             <get ZSIZE (25) 0x00000f92
             <get SIZE (26) 0x000037b3
- create a memory file from offset 00001890 of 14259 bytes

Error: the compressed zlib/deflate input is wrong or incomplete (-3)

Error: there is an error with the decompression
       the returned output size is negative (-1)

"qkl_fe2ig.AST" gives the same error:

Code: Select all

00000092 01  72  clog MEMORY_FILE OFFSET ZSIZE SIZE
             <get MEMORY_FILE (27) "MEMORY_FILE"
             <get OFFSET (23) 0x001abac4
             <get ZSIZE (25) 0x00000049
             <get SIZE (26) 0x0000005e
- create a memory file from offset 001abac4 of 94 bytes

Error: the compressed zlib/deflate input is wrong or incomplete (-3)

Error: there is an error with the decompression
       the returned output size is negative (-1)
"qkl_stream.AST" does the same with some added system beeps when it fails:

Code: Select all

0000015c 01  72  clog MEMORY_FILE OFFSET ZSIZE SIZE
             <get MEMORY_FILE (27) "MEMORY_FILE"
             <get OFFSET (23) 0x092f3d60
             <get ZSIZE (25) 0x0000f551
             <get SIZE (26) 0x000c8c88
- create a memory file from offset 092f3d60 of 822408 bytes

Error: the compressed zlib/deflate input is wrong or incomplete (-3)

Error: there is an error with the decompression
       the returned output size is negative (-1)
For sanity's sake, I'm using quickbms.exe 0.5.13 in this manner: ">quickbms.exe -v ncaa.bms qkl_boot.AST outputfolder" where I named your script as ncaa.bms.

Any ideas of what I may have done wrong or how I can help you debug it?

Thanks!!
User avatar
Dinoguy1000
Site Admin
Posts: 786
Joined: Mon Sep 13, 2004 1:55 am
Has thanked: 154 times
Been thanked: 163 times

Re: My quickBMS scripts

Post by Dinoguy1000 »

AlphaTwentyThree wrote:Sega CD *.bin movie audio demuxer
I have no idea about the audio format, never seen something like that. The header doesn't hold any information about the audio data so currently I'm stuck with a raw demux feature.
Does http://wiki.multimedia.cx/index.php?tit ... er-Man_BIN help any with this format? (you may want to spend some time looking around this wiki, BTW; Multimedia Mike has reversed a huge number of audio/video formats and documented his findings there)
Welcome to Xentax!

Rules | Requests | Wiki | Discord

If you run across a post that breaks the rules, please report the post - a mod or admin will handle it from there.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: My quickBMS scripts

Post by Ekey »

SnarbleBarb wrote: For sanity's sake, I'm using quickbms.exe 0.5.13 in this manner: ">quickbms.exe -v ncaa.bms qkl_boot.AST outputfolder" where I named your script as ncaa.bms.

Any ideas of what I may have done wrong or how I can help you debug it?

Thanks!!
try

Code: Select all

quickbms -9 "ncaa.bms" "qkl_boot.AST" "C:\Out"
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, well I got the same problem with the boot archive, but all the others worked fine. I don't have the image anymore so I can't research the problem with the boot file. There's one possibility though. You may change the script so that it doesn't try to decompress the files but just dumps the compressed files to disk and then use comtype_scan2 to figure out the compression used there. Another possibility could be that the script tries to decompress a file that isn't compressed, but then there would be something wrong with the script altogether. Maybe some variable length problem. That format basically just p***** me off. ;)
For your running question: I've linked *.bms files to open with QuickBMS, I don't use any options when running a script. Works fine for me that way.
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 ;)
SnarbleBarb
n00b
Posts: 17
Joined: Thu Dec 15, 2011 9:24 am
Has thanked: 9 times
Been thanked: 1 time

Re: My quickBMS scripts

Post by SnarbleBarb »

Ekey wrote: try

Code: Select all

quickbms -9 "ncaa.bms" "qkl_boot.AST" "C:\Out"

Thanks Ekey, but same output from that command.
AlphaTwentyThree wrote:There's one possibility though. You may change the script so that it doesn't try to decompress the files but just dumps the compressed files to disk and then use comtype_scan2 to figure out the compression used there.
OK I tried this. I swapped this line:

Code: Select all

clog MEMORY_FILE OFFSET ZSIZE SIZE
with

Code: Select all

log MEMORY_FILE OFFSET ZSIZE
(I've tried SIZE instead of ZSIZE too, same output files)

qkl_fe2ig.AST and qkl_stream.AST both extracted into lots of files (with lots of system beeps!). I ran many of them through the comtype_scan2 and couldn't find anything that resembled a 4byte header in any of the output files. COMP_LZFU_RAW (#219) came the closest because the files had references to fonts (New Times Roman, Sans Serif, etc.) and colors (red, blue, etc.) in them in plain English, but no 4byte Header.
AlphaTwentyThree wrote:I don't have the image anymore so I can't research the problem with the boot file.
If I can help with this, would you take a peek at the fe2ig and stream files? I don't know which one the models and textures are in... that's all that I want.
AlphaTwentyThree wrote:That format basically just p***** me off.
I'm right there with ya!!!

Frustrated. What's the next step?
Apollo
veteran
Posts: 145
Joined: Sat Oct 21, 2006 12:58 pm
Has thanked: 5 times
Been thanked: 24 times

Re: My quickBMS scripts

Post by Apollo »

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.
Post Reply