Users browsing this thread: 3 Guest(s)
[TUTORIAL] Making BMS Scripts; Post and get help with your BMS scripts!
#31
Can a BMS script help for doing this http://www.vg-resource.com/thread-28403.html

Maybe yes because is a compressed file ?
Reply
Thanked by:
#32
(01-07-2016, 05:44 AM)iyenal Wrote: Can a BMS script help for doing this http://www.vg-resource.com/thread-28403.html

Maybe yes because is a compressed file ?

Yes sir, here you go: http://pastebin.com/raw/PiQnry6F, I took a quick look at the decompressed data, and it looks like the texture data is GTX, so you may want to check with Random Talking Bush in order to figure it out Wink
I'd like to say: If you want more difficult and different archives to try out, I can provide some and walk you through them Smile
Reply
Thanked by:
#33
(01-07-2016, 07:30 PM)ThatTrueStruggle Wrote:
(01-07-2016, 05:44 AM)iyenal Wrote: Can a BMS script help for doing this http://www.vg-resource.com/thread-28403.html

Maybe yes because is a compressed file ?

Yes sir, here you go: http://pastebin.com/raw/PiQnry6F, I took a quick look at the decompressed data, and it looks like the texture data is GTX, so you may want to check with Random Talking Bush in order to figure it out Wink
I'd like to say: If you want more difficult and different archives to try out, I can provide some and walk you through them Smile

Do you happen to have any simple archives for a beginner to test out and analyze? I would really like to learn, but I'm having difficulty learning haha
Reply
Thanked by:
#34
Here's a simple archive ;3


Attached Files
.zip   0001.zip (Size: 251.24 KB / Downloads: 465)
Reply
Thanked by:
#35
(01-08-2016, 03:49 PM)TGE Wrote: Here's a simple archive ;3

Thank youSmile. I will look at it in a few!Smile
Reply
Thanked by:
#36
(01-08-2016, 04:09 PM)Anexenaumoon Wrote:
(01-08-2016, 03:49 PM)TGE Wrote: Here's a simple archive ;3

Thank youSmile. I will look at it in a few!Smile

I acutally figured out the format just now. If you need help, me or TGE can help you out Smile
Reply
Thanked by:
#37
(01-08-2016, 05:07 PM)ThatTrueStruggle Wrote:
(01-08-2016, 04:09 PM)Anexenaumoon Wrote:
(01-08-2016, 03:49 PM)TGE Wrote: Here's a simple archive ;3

Thank youSmile. I will look at it in a few!Smile

I acutally figured out the format just now. If you need help, me or TGE can help you out Smile

I'm looking at it hahaSmile I've got as far as the magic id right now xD trying to figure out endiness

EDIT: I'm absolute crap at this. I don't understand a single thing. I'm just not a script writer. I'm frustrated right now, I give up. This is embarrassing.
Reply
Thanked by:
#38
(01-08-2016, 05:12 PM)Anexenaumoon Wrote:
(01-08-2016, 05:07 PM)ThatTrueStruggle Wrote:
(01-08-2016, 04:09 PM)Anexenaumoon Wrote: Thank youSmile. I will look at it in a few!Smile

I acutally figured out the format just now. If you need help, me or TGE can help you out Smile

I'm looking at it hahaSmile I've got as far as the magic id right now xD trying to figure out endiness

EDIT: I'm absolute crap at this. I don't understand a single thing. I'm just not a script writer. I'm frustrated right now, I give up. This is embarrassing.

Here's my code for this file:
Code:
idstring "TGP0"
get unk long
get dummy long
get fileCount long

for i = 0 < fileCount
get filename string
do
get advance byte
while advance == 0
savepos pos
math pos - 1
goto pos
get offset long
get dummy long
get size long
get dummy long
log filename offset size
next i

I'll walk you through it, and help you to figure it out for yourself. Remember that reverse engineering is a process, and takes a while to learn the tools of the trades, keep at it, and remember to ask questions. Questions are essential to learning Smile

First is the idstring. This is four bytes that make up the string, "TGP0". This goes down in our script. This prevents the script from being used with incompatible files.
Code:
idstring "TGP0"

Next is a unknown value. However we don't need to know all the values of a file to extract the contents, This value looks like a 4 byte value, so we list that down as "get unk long". A long, is a 4 byte value.
Code:
idstring "TGP0"
get unk long

Right here is a group of dummy bytes, with the value of zero. We read past this:
Code:
idstring "TGP0"
get unk long
get dummy long

So next value, We'll assume this is the file count. If you count the amount of filenames, you can see there are 139, which 0x8b, which is our filecount. So list this as "get FileCount long".
Code:
idstring "TGP0"
get unk long
get dummy long
get FileCount long

That's our file header. We've read through the header, so now to the file table. For reading our file data, we can use a for loop. This'll allow us to have a variable ("i" in this case) and keep looping the code until i equals FileCount, which is 139. So the code in our loop will loop 139 times. So let's get started on that.
Code:
idstring "TGP0"
get unk long
get dummy long
get FileCount long
for i = 0 < FileCount
   CODE HERE
next i

So we create a variable called i, with the value of 0. FileCount is greater than zero, so it does the code in between the for and next tags once. Then QuickBMS increases i by one. It will do this until i equals FileCount or exceeds it.

Looks like the format goes like this: FileName, Null Bytes, then the Offset and Size of the file. FileName should be self explanatory. Null bytes are a group of bytes with the value of 0. Offset is the position of the data of the file, and the Size is the amount of bytes in the file. So our code will look like this:
Code:
idstring "TGP0"
get unk long
get dummy long
get FileCount long
for i = 0 < FileCount
   get FileName string
   do
       get Advance byte
   while Advance == 0
   savepos Position
   math Position - 1
    goto Position
   get Offset long
   get Dummy long
   get Size long
next i

You might be wondering what this part is:
Code:
do
    get Advance byte
while Advance == 0
savepos Position
math Position - 1
goto Position

This is another type of loop, that in this case allows us to skip past all those null bytes. You might also wonder, since we read past those dummy/null bytes before, why can't we do it the same way here? Well the way the file works is that the dummy bytes adds padding to make the file align to a certain offset, which lets the game console's CPU load the data without modifying it. This allows for faster loading ingame. To make a long story short, the loop reads one byte at a time, and checks if it's equal to 0. Until it equals something other than 0, it will continue to go one byte at a time. Now that the byte doesn't equal 0, we save the our current position, and subtract 1. Since we had to read the byte to make sure it wasn't zero, we need to go back in order to properly read it. Then we go to the new position that we created.

So finally we're almost done. Now we need to make QuickBMS save the data to a file. We do this by using the "log"
command. It works like this: log filename offset size. All of those values, we read before. So we just need to feed those values to the log command:
Code:
idstring "TGP0"
get unk long
get dummy long
get FileCount long
for i = 0 < FileCount
    get FileName string
    do
        get Advance byte
    while Advance == 0
    savepos Position
    math Position - 1
    goto Position
    get Offset long
    get Dummy long
    get Size long
    log FileName Offset Size
next i

Then finally we can save it to a file and load it up using QuickBMS, and it'll extract the files from the archive! If you have any questions on the script writing process, please post them. I'll try to answer them to the best of my ability!
Reply
Thanked by:
#39
maybe you guys can help me out, I've been trying to rip models from Socom 2.

Here is a folder for one of the multiplayer maps I'm trying to get the model from. https://www.dropbox.com/s/a9k19z3nx6u6vco/MP9.7z?dl=0

here are the couple of bms scripts I've been using

SOCOMZDB.bms
Code:
GoTo 0x98 0 ;
Get files Long 0 ;
GoTo 0x4 0 SEEK_CUR ;
SavePos base 0 ;
For x = 1 To files ;
GoTo base 0 ;
GoTo 0x4 0 SEEK_CUR ;
Get name String 0 ;
GoTo base 0 ;
GoTo 0x44 0 SEEK_CUR ;
Get offset Long 0 ;
Get size Long 0 ;
GoTo base 0 ;
GoTo 0x5c 0 SEEK_CUR ;
SavePos base 0 ;
Log name offset size 0 ;
Next x ;


SOCOMzarZED.bms
Code:
GoTo 0x0 0 ;
Get test Long 0 ;
If test != 0 ;
CleanExit ;
EndIf ;
GoTo 0x4 0 ;
Get files Long 0 ;
Math files -= 1 ;
GoTo 0x8 0 ;
Get base Long 0 ;
Math base += 0x64 ;
Math base += 0xC ;
GoTo 0xC 0 ;
Get adj Long 0 ;
GoTo 0x54 0 ;
Get realbase Long 0 ;
Get fsize ASIZE 0 ;
Math fsize -= realbase ;
Math realbase = fsize ;
GoTo 0x64 0 ;
SavePos namebase 0 ;
For x = 1 To files ;
GoTo base 0 ;
Get notyetused Long 0 ;
Get toname Long 0 ;
Get offset Long 0 ;
Get size Long 0 ;
SavePos base 0 ;
Math toname -= adj ;
Math toname += namebase ;
GoTo toname 0 ;
Get name String 0 ;
Math offset += realbase ;
Log name offset size 0 ;
Next x ;

this bit of info was on the ps23dformat site

03 02 00 01 04 80 XX 6D
{2ByteSignedIntegerVertexes(X,Y,Z)+2ByteSignedIntegerNormalMappings(X,Y,Z)+2ByteSignedIntegerTextureMappings(U,V)}
02 01 00 01

so far I can get it extracted and it gives me a list of models with no extension and that's where I'm stuck because I'm not sure what it should be.
Reply
Thanked by:
#40
Mind if I dump my QuickBMS scripts here? I feel this would be a better place for them than my own model ripping thread.

Archives:
Bomberman Hardball - MRG Extractor
Kamen Rider Battride War II & Summonride - NativePS.NCAT Extractor
Mario Party 10 & Animal Crossing: amiibo Festival - BIN Extractor
NES Remix - VEW ARC Extractor
Super Smash Bros. for Wii U - PAC Extractor

Decompression:
Game & Wario - Decompression
Hyrule Warriors - GZ Decompression
Kirby and the Rainbow Curse - ZCMP Decompression
Mario & Sonic at the Sochi 2014 Olympic Winter Games - Decompression
Mega Man Powered Up & Maverick Hunter X - CPK Decompression
Mario Tennis: Ultra Smash - Decompression
Super Monkey Ball: Banana Blitz - AVLZ Decompression
Wii Sports Club - Decompression

Textures:
Bayonetta 2 - WTA/WTP to GTX
Donkey Kong Tropical Freeze - TXTR to GTX
Hyrule Warriors - G1T to GTX
Mercenary Kings - XNB to DDS
Super Smash Bros. for Wii U - NUT to GTX
The Wonderful 101 - WTB to GTX
Wii U - BFFNT to GTX
Wii U - BFLIM to GTX
Wii U - BFRES to GTX
Wii U - TexConv2 DDS Repair
Reply
#41
I'll just dump everything I have in my folder too, then.

Persona 3 Portable *.abin archives
Maverick Hunter X *.arc archives
Azure Striker Gunvolt *.irlist/irarc archives
Age of Mythology *.bar archives
Eagle games *.bun archives
Megaman X 7 *.emi archives
DJMax Technika  *.fpk archives
Android *.jet archives
King Oddball *.pak archives
Little Endian U8 archives
Initial D Special Stage *.pac archives
Persona 2 EP/IS PSP *.bin audio archives
Atlus games (PS2 and later) .epl containers
Rayman 3 Hoodlum Havoc (PC) *.cnt archives
Shadow The Hedgehog *.mtp archives
Shadow The Hedgehog *.one archives
Sonic Heroes PS2 *.pac files
Sonic Riders (PC) Archives 
Sonic Unleashed (PS2, Wii) NEP archives
Fairy Bloom Freesia *.tgp archives
Sonic and Sega All Stars Racing PC *.xpac
Zelda Ocarina of Time/ Majora's Mask 3D *.zar archives
Eagle *.asf dumper
CRI *.awb dumper
Wii *.brres dumper
3ds *.cgfx dumper
Sega NN Library resource (*.sno/gno/eno/xno/cno/other 'no' formats) dumper
Reply
#42
(01-10-2016, 09:46 AM)TGE Wrote: I'll just dump everything I have in my folder too, then.
-large list of scripts-
Cool dude, I'll add this to the 3rd post Smile

(01-10-2016, 04:24 AM)Random Talking Bush Wrote: Mind if I dump my QuickBMS scripts here? I feel this would be a better place for them than my own model ripping thread.
-large list of scripts-
I didn't even see this! Sorry, I'll add them too Smile

EDIT: Added the both of your scripts Smile
Reply
#43
Hi, great job I'm a novice at this but followed a little guide, I could not unzip this file if good so kind to give me a hand as a serious guide helpfu
https://mega.nz/#!g0QgnCwb!UyGNZFXbXLOS7...O6B2Gb3SGo
Reply
Thanked by:
#44
I recall that once I used quickbms, but the models came without textures and even non uv mapped.

How much things changed?
Reply
Thanked by:
#45
Question. Is there a quickbms script that can extract .bin files from games made by JADE Engine?
[Image: 33426ca52b.png]
Reply
Thanked by:


Forum Jump: