Re: My quickBMS scripts
Posted: Mon Mar 19, 2012 2:50 am
Just did a major update with the PCM and XMA header. Now with correct use of functions!
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 iCode: 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 iCode: 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 iCode: 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
endfunctionCode: 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 iCode: 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 iCode: 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 iAlphaTwentyThree 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 iCode: 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
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
endfunctionCode: 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
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