Offtopic: Into Commodore 64 (6502) coding, pixeling or music?
Xentax is looking for new members for the C64 activities!
Just drop us a message at forum@xentax.com and join the Scene Team!
Forum rules: Click here
Xentax is looking for new members for the C64 activities!
Just drop us a message at forum@xentax.com and join the Scene Team!
Forum rules: Click here
My quickBMS scripts
-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Just did a major update with the PCM and XMA header. Now with correct use of functions!
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
NDS SPK extractor
Extracts the *.spk sound packs from NDS games. These usually contain *.swav files. Don't forget to include the func_getTYPE.bms.
Extracts the *.spk sound packs from NDS games. These usually contain *.swav files. Don't forget to include the func_getTYPE.bms.
Code: Select all
include "func_getTYPE.bms"
idstring "SMPK"
get FILES long
goto 0x10
for i = 1 <= FILES
get TYPE long
get OFFSET long
get SIZE long
get ZSIZE long
log MEMORY_FILE 0 0
log MEMORY_FILE OFFSET SIZE
callfunction getTYPE 1
get NAME basename
string NAME += "_"
string NAME += i
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Bratz DS pkg extractor
Extractor for three of the Bratz games for Nintendo DS.
Extractor for three of the Bratz games for Nintendo DS.
Code: Select all
# extracts the *.pkg file from the following games:
# - Bratz: 4 Real (DS)
# - Bratz: Forever Diamondz (DS)
# - Bratz: Girlz Really Rock (DS)
# (c) 2012-03-20 by AlphaTwentyThree of XeNTaX
idstring "pkg"
comtype gzip
goto 8
get FILES long
goto 0x30
for i = 1 <= FILES
getDstring NAME 0x20
get FNUMB short
get COMP short
get ZSIZE long
get SIZE long
get OFFSET long
get ZERO long
if COMP == 0
log NAME OFFSET SIZE
elif COMP == 1
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
BigFile.bin Extractor for Bratz DS
Thanks to comtype_scan2.bms, I got the compression type easily! =)
Thanks to comtype_scan2.bms, I got the compression type easily! =)
Code: Select all
# extracts the BigFile.bin from the following games:
# - Bratz Kidz: Party (DS)
# - Bratz Kidz: Slumber Party (DS)
# - Bratz Ponyz (DS)
#
# (c) 2012-03-20 by AlphaTwentyThree of XeNTaX
comtype PUYO_LZ01
get FILES long
for i = 1 <= FILES
get OFFSET threebyte
get COMP byte
get ZSIZE long
get SIZE long
savepos MYOFF
math MYOFF += 0x20
get NAME string
goto MYOFF
get ZERO long
get UNK long
if COMP == 1
clog NAME OFFSET SIZE ZSIZE
else
log NAME OFFSET SIZE
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Yesterday RESOURCE extractor
Extracts the files from the new Pendulo Studios game. Make sure you have the latest func_getTYPE.bms (extended and corrected again)!
Extracts the files from the new Pendulo Studios game. Make sure you have the latest func_getTYPE.bms (extended and corrected again)!
Code: Select all
# extract RESOURCE files from the game 'Yesterday' (Pendulo Studios)
#
# (c) 2012-03-24 by AlphaTwentyThree of XeNTaX
include "func_getTYPE.bms"
set EXT ""
get FILES long
get SUFFIX extension
set TEST ""
getVarChr T SUFFIX 0
putVarChr TEST 0 T
getVarChr T SUFFIX 1
putVarChr TEST 1 T
if TEST == "S0"
callfunction type1 1
else
callfunction type2 1
endif
startfunction type1
for i = 1 <= FILES
get OFFSET long
get SIZE long
get ZERO long
get FILETYPE byte
if SIZE != 0x2c # only header, i.e. empty stream
log MEMORY_FILE 0 0
log MEMORY_FILE OFFSET SIZE
get NAME basename
string NAME += "."
get SUFFIX extension
string NAME += SUFFIX
string NAME += "_"
string NAME += i
callfunction getTYPE 1
string NAME += EXT
log NAME 0 SIZE MEMORY_FILE
endif
next i
endfunction
startfunction type2 # all but sounds
set SIZEOFF FILES
math SIZEOFF += 4
math FILES /= 4
for i = 1 <= FILES
get OFFSET long
savepos MYOFF
goto SIZEOFF
get SIZE long
savepos SIZEOFF
if SIZE != 0
log MEMORY_FILE 0 0
log MEMORY_FILE OFFSET SIZE
get NAME basename
string NAME += "."
get SUFFIX extension
string NAME += SUFFIX
string NAME += "_"
string NAME += i
callfunction getTYPE 1
string NAME += EXT
log NAME 0 SIZE MEMORY_FILE
endif
goto MYOFF
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Just updated func_getTYPE and my Armored Core V script.
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Had to correct the header_adder_XMA.bms due to a wrong if case when reading the channel count from the file name. Works now. 

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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
POD5 extractor
I guess there are other games with this format.
I guess there are other games with this format.
Code: Select all
# extracts POD5 archives
#
# supported games:
# Kinect Star Wars (Xbox 360)
# Country Dance All-Stars (Xbox 360)
#
# (c) 2012-04-04 by AlphaTwentyThreee of XeNTaX
idstring "POD5"
goto 0x58
get FILES long
goto 0x108
get INFO long
set NAMEOFF FILES
math NAMEOFF *= 0x1c
math NAMEOFF += INFO
goto INFO
for i = 1 <= FILES
get NAMEPOS long
math NAMEPOS += NAMEOFF
get SIZE long
get OFFSET long
get ZSIZE long
get ZERO long
get UNK long
get UNK long
savepos MYOFF
goto NAMEPOS
get NAME string
if SIZE == ZSIZE
log NAME OFFSET SIZE
else
clog NAME OFFSET SIZE ZSIZE
endif
goto MYOFF
next i
Last edited by AlphaTwentyThree on Wed Apr 04, 2012 5:25 am, 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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Warriors Orochi 3 (Xbox 360) - [g1l] & [idx/bin]
The BGMLink.g1l contains the music (6ch XMA2).
The bin files contain all other game files including the sounds as XMA (large packs at the end of the archive).
The BGMLink.g1l contains the music (6ch XMA2).
Code: Select all
# extracts the BGMLink.g1l from Warriors Orochi 3 (Xbox 360)
#
# (c) 2012-04-01 by AlphaTwentyThree of XeNTaX
include "func_getTYPE.bms"
idstring "G1L_0000"
endian big
get FILESIZE long
get DATASTART long
get UNK long
get FILES long
for i = 1 <= FILES
get OFFSET long
if i != FILES
savepos MYOFF
get SIZE long
goto MYOFF
else
get SIZE asize
endif
math SIZE -= OFFSET
log MEMORY_FILE SIZE 0 # pre-alloc
log MEMORY_FILE 0 0
log MEMORY_FILE OFFSET SIZE
callfunction getTYPE 1
get NAME basename
string NAME += "_"
string NAME += i
string NAME += EXT
endian little
log NAME 0 SIZE MEMORY_FILE
endian big
next i
Code: Select all
# Extracts the contents of the bin/idx pairs from Warriors Orochi 3 (Xbox 360)
#
# (c) 2012-04-02 by AlphaTwentyThree of XeNTaX
include "func_getTYPE.bms"
open FDDE IDX 0
open FDDE BIN 1
endian big
set FN 1
get ENTRIES asize 0
math ENTRIES /= 0x20
for i = 1 <= ENTRIES
get ZERO long 0
get OFFSET long 0
get ZERO long 0
get UNK long 0
get ZERO long 0
get SIZE long 0
get ZERO long 0
get UNK long 0
if SIZE > 1
log MEMORY_FILE SIZE 0 # pre-alloc
log MEMORY_FILE 0 0
log MEMORY_FILE OFFSET SIZE 1
endian little
callfunction getTYPE 1
endian big
get NAME basename 0
string NAME += "_"
string NAME += FN
math FN += 1
string NAME += EXT
log NAME 0 SIZE MEMORY_FILE
endif
next i
Last edited by AlphaTwentyThree on Tue Apr 03, 2012 5:06 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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

- chrrox
- Moderator
- Posts: 2557
- Joined: Sun May 18, 2008 3:01 pm
- Has thanked: 57 times
- Been thanked: 1289 times
Re: My quickBMS scripts
AlphaTwentyThree wrote:Warriors Orochi 3 (Xbox 360) - [g1l] & [idx/bin]
The BGMLink.g1l contains the music (6ch XMA2).The bin files contain all other game files including the sounds as XMA (large packs at the end of the archive).Code: Select all
# extracts the BGMLink.g1l from Warriors Orochi 3 (Xbox 360) # # (c) 2012-04-01 by AlphaTwentyThree of XeNTaX include "func_getTYPE.bms" idstring "G1L_0000" endian big get FILESIZE long get DATASTART long get UNK long get FILES long for i = 1 <= FILES get OFFSET long if i != FILES savepos MYOFF get SIZE long goto MYOFF else get SIZE asize endif math SIZE -= OFFSET log MEMORY_FILE 0 0 log MEMORY_FILE OFFSET SIZE callfunction getTYPE 1 get NAME basename string NAME += "_" string NAME += i string NAME += EXT endian little log NAME 0 SIZE MEMORY_FILE endian big next i
Code: Select all
# Extracts the contents of the bin/idx pairs from Warriors Orochi 3 (Xbox 360) # # (c) 2012-04-02 by AlphaTwentyThree of XeNTaX include "func_getTYPE.bms" open FDDE IDX 0 open FDDE BIN 1 endian big set FN 1 get ENTRIES asize 0 math ENTRIES /= 0x20 for i = 1 <= ENTRIES get ZERO long 0 get OFFSET long 0 get ZERO long 0 get UNK long 0 get ZERO long 0 get SIZE long 0 get ZERO long 0 get UNK long 0 if SIZE > 1 log MEMORY_FILE 0 0 log MEMORY_FILE SIZE 0 # pre-alloc log MEMORY_FILE OFFSET SIZE 1 endian little callfunction getTYPE 1 endian big get NAME basename 0 string NAME += "_" string NAME += FN math FN += 1 string NAME += EXT log NAME 0 SIZE MEMORY_FILE endif next i
if you decompress the xex file you should be able to spot the file table without much trouble.
-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
I've decompressed some xex files and I didn't find a list of files inside archives. Can you explain further please?
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
convert XMA cue markers to WAVE cue marers
Wrote this one when I encountered XMA2 files with markers (Kinect Star Wars). The script takes the xma cue file, reads available information into an array and constructs a new cue file from scratch, including the ltxt section per marker. Conversion from big to little endian is also implemented.
Find the func_writename.bms in the post below.
Wrote this one when I encountered XMA2 files with markers (Kinect Star Wars). The script takes the xma cue file, reads available information into an array and constructs a new cue file from scratch, including the ltxt section per marker. Conversion from big to little endian is also implemented.
Find the func_writename.bms in the post below.
Code: Select all
# convert xma cue markers to wave cue markers
#
# (c) 2012-04-03 by AlphaTwentyThree of XeNTaX
include "func_writename.bms"
endian big
idstring "cue "
get CUESIZE long
if CUESIZE >= 0x100000 # work-around
endian little
endif
get MARKERS long
for i = 1 <= MARKERS
get MID long # marker ID
get MSAMP1 long # always same as MSAMP2 (?)
idstring "data"
get ZERO long
get ZERO long
get MSAMP2 long
putArray 0 MID MSAMP1 long
putArray 1 MID MSAMP2 long
putArray 2 MID "" string # reset
next i
idstring "LIST"
get LISTSIZE long
if LISTSIZE == 0 # lables are optional
callfunction wavcue 1
cleanexit
endif
idstring "adtl" # table, empty in XMA markers
get CSIZE asize
math CSIZE -= 1 # last byte is 0
do
get IDENT long
if IDENT == 0x6c6162
savepos MYOFF
math MYOFF += 1
goto MYOFF
endif
get LSIZE long
get MID long
set MNAMEL LSIZE
math MNAMEL -= 4
getDstring MNAME MNAMEL
putArray 2 MID MNAME string
savepos TEST
while TEST < CSIZE
callfunction wavcue 1
startfunction wavcue
endian little
putVarChr MEMORY_FILE 0 0x20657563 long # "cue "
set CUESIZE MARKERS
math CUESIZE *= 0x18
math CUESIZE += 4
putVarChr MEMORY_FILE 4 CUESIZE long
putVarChr MEMORY_FILE 8 MARKERS long
set WPOS CUESIZE
math WPOS += 8
putVarChr MEMORY_FILE WPOS 0x5453494c long # "LIST"
math WPOS += 4
set LISTSZ WPOS # position of LIST size
math WPOS += 4
putVarChr MEMORY_FILE WPOS 0x6c746461 long # "adtl"
math WPOS += 4
set LTXTPOS WPOS
set WPOS 0xc
for i = 1 <= MARKERS # "cue " section
putVarChr MEMORY_FILE WPOS i long # MID
math WPOS += 4
getArray MSAMP1 0 i
putVarChr MEMORY_FILE WPOS MSAMP1 long
math WPOS += 4
putVarChr MEMORY_FILE WPOS 0x61746164 long # "data"
math WPOS += 0xc
getArray MSAMP2 1 i
putVarChr MEMORY_FILE WPOS MSAMP2 long
math WPOS += 4
set NXT i
math NXT -= 1
math NXT *= 0x1c
math NXT += LTXTPOS
putVarChr MEMORY_FILE NXT 0x7478746c long # "ltxt"
math NXT += 4
putVarChr MEMORY_FILE NXT 0x14 long
math NXT += 4
putVarChr MEMORY_FILE NXT i long
math NXT += 8
putVarChr MEMORY_FILE NXT 0x206e6772 long # "rgn "
next i
set WPOS NXT
math WPOS += 0xc
for i = 1 <= MARKERS
getArray LABEL 2 i
if LABEL != ""
putVarChr MEMORY_FILE WPOS 0x6c62616c long # "labl"
math WPOS += 4
strlen LABSIZE LABEL
math LABSIZE += 5
putVarChr MEMORY_FILE WPOS LABSIZE long
math WPOS += 4
putVarChr MEMORY_FILE WPOS i long # MID
math WPOS += 4
set STRPOS WPOS
set NAME LABEL
callfunction writename 1
get WPOS asize MEMORY_FILE
putVarChr MEMORY_FILE WPOS 0 byte
math WPOS += 1
endif
next i
get SIZE asize MEMORY_FILE
set PUTLSIZE SIZE
math PUTLSIZE -= LISTSZ
math PUTLSIZE -= 4
putVarChr MEMORY_FILE LISTSZ PUTLSIZE long
get NAME basename
string NAME += ".wcue"
log NAME 0 SIZE MEMORY_FILE
endfunction
Last edited by AlphaTwentyThree on Tue Apr 03, 2012 8:38 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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
func_writename.bms
Write a string to memory. Isn't implemented in QuickBMS but needed sometimes.
Write a string to memory. Isn't implemented in QuickBMS but needed sometimes.
Code: Select all
# writes a given string NAME to offset STRPOS of the MEMORY_FILE
#
# (c) 2012-04-03 by AlphaTwentyThree of XeNTaX
startfunction writename
strlen NAMESZ NAME
for z = 0 < NAMESZ
set TMP STRPOS
math TMP += z
getvarchr CHR NAME z
putvarchr MEMORY_FILE TMP CHR byte
next z
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
*.fpk "FKP" extractor
Found one game so far that uses this format but I guess there are others.
Found one game so far that uses this format but I guess there are others.
Code: Select all
# extracts the GameData.fpk from various XBLA games
#
# supported games:
# - Flock!
#
# (c) 2012-04-04 by AlphaTwentyThree of XeNTaX
idstring "FKP"
get IDENT byte
goto 8
get FILES long
get UNK long
for i = 1 <= FILES
savepos MYOFF
getCT NAME string 0xcc
math MYOFF += 0x30
goto MYOFF
get UNK long
get UNK long
get SIZE long
get OFFSET long
log NAME OFFSET SIZE
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks

-
- double-veteran
- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Re: My quickBMS scripts
Important update on the func_getTYPE.bms! Update your files!
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


And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks
