Trying to learn some QuickBMS, please help.
Posted: Fri Mar 22, 2013 7:16 pm
Hi there, I'm currently trying to de-interleave and extract the mp3s from the audio files from Sly4. I've done this in the past with Journey using the script here: viewtopic.php?f=13&p=39344#p39344 but it was a slow and arduous task as I needed to make a separate script for each different header length, interleave and number of layers.
With Sly4 I'm trying to use the same script but trying to modify it so it retrieves those lengths automatically from the file itself. I've found the bytes in the file that determine the header length as well as the multiple of 300 bytes that winds up being the interleave. My problem is that I can't figure out how to take those values and use them in my script.
The length of the header is stored as a two-byte hex value at position 0x6 in the file. The interleave multiple is stored at 0x3B.
Currently my script is just trying to read in this Header length but I can't get it to keep it as a hex value, the command I'm using reads in the ASCII value and then I'm trying to convert that back to hex, but then it's stored as a string and not a hex offset.
If someone could please be gentle and guide me in the direction I need to go, I'd be much appreciative as I'm trying to learn, but the BMS language is still Greek to me.
Thanks!
With Sly4 I'm trying to use the same script but trying to modify it so it retrieves those lengths automatically from the file itself. I've found the bytes in the file that determine the header length as well as the multiple of 300 bytes that winds up being the interleave. My problem is that I can't figure out how to take those values and use them in my script.
The length of the header is stored as a two-byte hex value at position 0x6 in the file. The interleave multiple is stored at 0x3B.
Currently my script is just trying to read in this Header length but I can't get it to keep it as a hex value, the command I'm using reads in the ASCII value and then I'm trying to convert that back to hex, but then it's stored as a string and not a hex offset.
If someone could please be gentle and guide me in the direction I need to go, I'd be much appreciative as I'm trying to learn, but the BMS language is still Greek to me.
Thanks!
Code: Select all
GoTo 0x6
GetDString HEADERBYTE 2
String HEADER B HEADERBYTE
GoTo 0x0
#set HEADER 0x134
print "%HEADER%"
string
set INTERL 0x2D00
set SKIP 0x0
set LAYERS 2
set JUMP INTERL
math JUMP *= LAYERS # JUMP = size of one block
math INTERL -= SKIP
get TEST asize
math TEST %= LAYERS
if TEST != 0
print "Illegal deinterleave parameters! Aborting..."
cleanexit
endif
get CYCLES asize
math CYCLES /= JUMP # number of interleave blocks
get RES asize
math RES %= JUMP # size of last interleave block
#print "residuum: %RES%"
math RES /= LAYERS # size of single last interleave
if RES != 0
print "Warning: last block is incomplete! Check your parameters!"
endif
for i = 1 <= LAYERS
log MEMORY_FILE 0 0
set OFFSET i
math OFFSET -= 1
math OFFSET *= INTERL
math OFFSET += HEADER
print "%OFFSET%"
append
for k = 1 <= CYCLES
log MEMORY_FILE OFFSET INTERL
math OFFSET += JUMP
math OFFET += SKIP
NEXT k
if RES != 0 # incomplete but valid last block
set OFF i
math OFF -= 1
math OFF *= RES
math OFFSET -= JUMP
math OFFSET -= SKIP
math OFFSET += OFF
log MEMORY_FILE OFFSET RES
endif
append
get SIZE asize MEMORY_FILE
get NAME basename
if LAYERS != 1
string NAME += "_"
string NAME += i
endif
log NAME 0 SIZE MEMORY_FILE
next i