QUICKBMS GUIDE 3 IF ELSE
Posted: Sun Jun 21, 2009 11:24 pm
Ok sorry it took me a little longer for this tutorial but I wanted to make sure I had a good example to show for this.
Step 1
The game we will be looking at is Beach Fun Summer Challenge for the WII.
Step 2
Step 3
Step 5
and we end up here
Step 6
Step 7
Step 8
Step 9
Step 10
so now we have 0x14 bytes remaining before the next name begins
so lets break those down into long variables for now so we can visualize it better
get UNK1 long
get UNK2 long
get NULL1 long
get UNK3 long
get NULL2 long
so this completes our pattern for writing our extractor so lets clean up our code.
Step 11
Step 12
If we do a ctrl + f and go to that location in the archive we see it listed there and it looks the same
but if we look closer the value of ONE is set to 00 00 00 00
this means it must indicate weather the file is compressed or not
1 gives a value of compressed 0 says the file is un compressed.
so lets write that in bms
This says that when the value of ZIP "what we called ONE earlier"
is equal to 1 run the command
clog NAME OFFSET ZSIZE SIZE
but if it is not equal to 1 run the command
log NAME OFFSET ZSIZE
then we end it with the endif statement.
Now when we run our extraction it works without errors
As a bonus you can view these models and animations in granny viewer.
http://www.radgametools.com/granny/download.html
let me know what you think of the new format.
Step 1
The game we will be looking at is Beach Fun Summer Challenge for the WII.
Step 2
Open the file pc_only.dat in your favorite hex editor
I will be using HxD
Step 3
Step 4Looking at this file I notice 2 Files in this archive right away
dvdpc\pc\misc\fonts\debug.timg and dvdpc\common\misc\fonts\debug.fnt
So this tells us we have 2 files and the directory path is included in the name.
Make sure you just take note of that and we will move on to the next step.
The file starts with the words BeachFun
so this will be our idstring
so in bms we will write.
Code: Select all
idstring "BeachFun"
so now we haveNext we have 0x18 bytes of 0's so we could write
getdstring NULL1 0x18
but there is a better command called goto
so lets use this great command in bms like this
goto 0x20
this will take us to offset 0x20 in the archive
Code: Select all
idstring "BeachFun"
goto 0x20
Step 6
Now we are working with console archives so we need to change our endian
to get the right values and we do that with the command
endian BIG
this tells us to read the value as it appears in the archive so the number would be
00 00 00 02 and it will not get reversed to 02 00 00 00
so 00 00 00 02 is equal to 2 and hey that is the number of files in this archive
so lets write what we have so far in bms.
Code: Select all
idstring "BeachFun"
goto 0x20
endian BIG
get FILES long
so far we havethe next 0x1C bytes are the same in all archives from this game and so not seem to
mean anything so we will skip over them with out new command goto
so lets write it as this
goto 0x40
Code: Select all
idstring "BeachFun"
goto 0x20
endian BIG
get FILES long
goto 0x40
Now we are at the start of the file name.
lets see how long it goes on before we reach something besides a 0
remember always try to work in groups of 2 or 4 bytes as that is the
most common way variables will be stored.
so highlight the next 0x68 bytes and you will see it is the same length
between the archive name and the next long variable for both of the files.
so we will write in bms
getdstring NAME 0x68
Code: Select all
idstring "BeachFun"
goto 0x20
endian BIG
get FILES long
goto 0x40
getdstring NAME 0x68
Step 9
ok now we have the next 4 bytes 00 00 01 40
and if we look at your archive that seems to be where the data begins
so we have our offset value lets store that
get OFFSET long
Code: Select all
idstring "BeachFun"
goto 0x20
endian BIG
get FILES long
goto 0x40
getdstring NAME 0x68
get OFFSET long
so now we have 0x14 bytes remaining before the next name begins
so lets break those down into long variables for now so we can visualize it better
get UNK1 long
get UNK2 long
get NULL1 long
get UNK3 long
get NULL2 long
so this completes our pattern for writing our extractor so lets clean up our code.
Code: Select all
idstring "BeachFun"
goto 0x20
endian big
get FILES long
goto 0x40
for i = 0 < FILES
getdstring NAME 0x68
get OFFSET long
get UNK1 long
get UNK2 long
get NULL long
get UNK3 long
get NULL2 long
clog NAME OFFSET ZSIZE SIZE
next i
Step 11This code starts the loop with the command
for i = 0 < FILES
and it starts right at the begging of the file name.
I wrote clog NAME OFFSET ZSIZE SIZE
because there is nothing human readable and no 00's in
the archive where the data begins indicating it is compressed.
I saved the variables as UNK if they have a value other than 0
and as NULL if their value was 0
Now we just need to figure out ZSIZE and SIZE to extract these files.
lets look at our variables
UNK1 = 00 00 64 D0
UNK2 = 00 00 00 01
UNK3 = 00 02 AB 20
There are a few ways to figure out what values go where
method 1.
subtract the offset of file 1 from the offset of file 2
that will give us the zipped size of the file so
00 00 66 20 - 00 00 01 40 = 00 00 64 E0
this tells us 00 00 64 D0 must be the zip size
and there must be some padding in between the files.
Method 2 is just look at the values and use common sense
it is not a size of 1 do UNK2 is crossed out
and now what one is bigger UNK1 or UNK3
UNK3 is bigger so therefore it must be the uncompressed size.
so we have our variables
UNK1 = zipped size
UNK2 = one
unk3 = SIZE
so lets write that in bms
Code: Select all
idstring "BeachFun"
goto 0x20
endian big
get FILES long
goto 0x40
for i = 0 < FILES
getdstring NAME 0x68
get OFFSET long
get ZSIZE long
get ONE long
get NULL long
get SIZE long
get NULL2 long
clog NAME OFFSET ZSIZE SIZE
next i
Code: Select all
so lets extract pc_only.dat with quickbms.
yay it worked we got 2 files
but now lets try it on Characters.dat
hey wait we got a few files and then it got an error.
Step 12
If we do a ctrl + f and go to that location in the archive we see it listed there and it looks the same
but if we look closer the value of ONE is set to 00 00 00 00
this means it must indicate weather the file is compressed or not
1 gives a value of compressed 0 says the file is un compressed.
so lets write that in bms
Code: Select all
idstring "BeachFun"
goto 0x20
endian big
get FILES long
goto 0x40
for i = 0 < files
getdstring NAME 0x68
get OFFSET long
get ZSIZE long
get ZIP long
get NULL long
get SIZE long
get NULL2 long
if ZIP == 1
clog NAME OFFSET ZSIZE SIZE
else
log NAME OFFSET ZSIZE
endif
next i
is equal to 1 run the command
clog NAME OFFSET ZSIZE SIZE
but if it is not equal to 1 run the command
log NAME OFFSET ZSIZE
then we end it with the endif statement.
Now when we run our extraction it works without errors
As a bonus you can view these models and animations in granny viewer.
http://www.radgametools.com/granny/download.html
let me know what you think of the new format.