Call for Help: Creating WTB's

Binary formats and related hacking.

Moderator: Skyfaller

User avatar
Skyfaller
Clan 2nd MechWarrior
Clan 2nd MechWarrior
Posts: 991
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Call for Help: Creating WTB's

Post by Skyfaller » Fri Feb 27, 2009 11:32 am

I'm trying to use the knowledge about how texturing works in MW2 to create new WTB files (objects in the MW2 sim). Unfortunately, without success.

Here's how far I got: I have created two .OBJ test files and written an algorithm to convert them to .WTB's. I can display them in MechVM, but not in the MW2 sim. So I started doing some experiments: I took other WTB files and edited them. The meaning of byte 4 to 16 in this file type is unclear at this time. Adding one to one byte and subtracting one from the next byte in this part of the header apparently leave the file intact. All other changes I made make the WTB invisible. I'll attach the two files I created so you can experiment with them yourselves (plural in case someone else besides Kell is interested ... ;)).
Attachments
wtb-test.zip
.WTB files for the Shadowcat and mountain
(3.86 KiB) Downloaded 287 times
scat.png
A simple Shadowcat torso for testing
scat.png (1.16 KiB) Viewed 5545 times
mnt.png
A simple mountain model for testing
mnt.png (2.54 KiB) Viewed 5548 times
Download MechVM

If you have problems with MechVM, please attach the files MechVM.cfg and install-report.txt from the folder where MechVM installed your game.

User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: Call for Help: Creating WTB's

Post by Col.Kell » Fri Feb 27, 2009 12:16 pm

sweet. :P
So do I just pick any type of equal-or-larger WTB file and replace them with these?
I wanna give this a try. Especialy the shadowcat head. I have tried before to make a shadowcat in KAM using maddog legs, a maddog arm, a battlemaster handgun and a firemoth head. :)
MechWarrior 2: 31stCC
Image

User avatar
Skyfaller
Clan 2nd MechWarrior
Clan 2nd MechWarrior
Posts: 991
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Call for Help: Creating WTB's

Post by Skyfaller » Fri Feb 27, 2009 3:27 pm

While it's possible that the new objects are present in MW2, and simply invisible due to a texturing or similar error, I doubt that's the case, because MW2's original .WTB files can be made invisible by simply changing single bytes in the header. So, unless we can figure out the meaning of those header bytes, we're stuck. It's possible that these are simple checksums, but which algorithm was used, and what parts of the file went into what checksum?

Any tools? Any documentation I forgot to consult?
Download MechVM

If you have problems with MechVM, please attach the files MechVM.cfg and install-report.txt from the folder where MechVM installed your game.

User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: Call for Help: Creating WTB's

Post by Col.Kell » Sat Feb 28, 2009 10:59 am

Can you repost that WTB test download? I had to format my flashdrive when I left the house to download a microsoft visual studio express .iso file. :oops:
MechWarrior 2: 31stCC
Image

User avatar
Skyfaller
Clan 2nd MechWarrior
Clan 2nd MechWarrior
Posts: 991
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Call for Help: Creating WTB's

Post by Skyfaller » Sun Mar 01, 2009 12:07 am

Re-uploaded the attachments above. Thanks, MMPD.
Download MechVM

If you have problems with MechVM, please attach the files MechVM.cfg and install-report.txt from the folder where MechVM installed your game.

User avatar
Sir MMPD Radick
Clan Nova Captain
Clan Nova Captain
Posts: 1614
Joined: Tue Jan 22, 2008 10:07 am

Re: Call for Help: Creating WTB's

Post by Sir MMPD Radick » Sun Mar 01, 2009 9:12 am

np, sorry about that the modifications from the other night changed the folder permissions.
James 3:5-10: My Reminder
And the tongue is a fire, a world of iniquity: so is the tongue among our members, that it defileth the whole body. Out of the same mouth proceedeth blessing and cursing. My brethren, these things ought not so to be.

User avatar
Skyfaller
Clan 2nd MechWarrior
Clan 2nd MechWarrior
Posts: 991
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: Call for Help: Creating WTB's

Post by Skyfaller » Tue Mar 03, 2009 1:27 am

Too bad those forum modifications didn't work, but I'm relieved to see my attachments appear to be the only problem that was caused.
Download MechVM

If you have problems with MechVM, please attach the files MechVM.cfg and install-report.txt from the folder where MechVM installed your game.

User avatar
quota4stupid
House Steiner Private First Class
House Steiner Private First Class
Posts: 81
Joined: Mon Dec 29, 2008 7:40 am
Location: Australia

Re: Call for Help: Creating WTB's

Post by quota4stupid » Wed May 20, 2009 9:51 am

Skyfaller wrote:The meaning of byte 4 to 16 in this file type is unclear at this time. Adding one to one byte and subtracting one from the next byte in this part of the header apparently leave the file intact. All other changes I made make the WTB invisible.
Well, you can cross 8 more bytes from the mystery list: bytes from offset 8 to 15 are the name of the WTB file, without the extension, and with each character *NEGATED* (so, for example -65 represents the letter "A", instead of +65) :-P The same format is used to store names in the TBL files in the TABL directory of the project file. The purpose of storing the name this way escapes me, but the important thing is that we have 8 less bytes of the WTB header to decode :-)

It should be noted that in the ATI version of the WTB format, the name is stored as plain ASCII - no negation (which was how I stumbled across the answer in the first place).

I remember Skyfaller mentioning in another post somewhere that he thought the header might contain some sort of checksum (which is why the geometry vanishes when you try to change vertex/poly data) - I suspect that this checksum is bytes 4 & 5 in the header but can't quite figure out how the checksum is calculated (although adding together the 16-bit words that make up the vertex and poly data and masking it with 0xFFFF gives a value very close to that stored at bytes 4-5 of the header - in smaller files these values aren't off by much, so I'm hoping that means I'm close ;-))

Will post more if/when I find it.

User avatar
quota4stupid
House Steiner Private First Class
House Steiner Private First Class
Posts: 81
Joined: Mon Dec 29, 2008 7:40 am
Location: Australia

Re: Call for Help: Creating WTB's

Post by quota4stupid » Wed May 20, 2009 9:55 am

quota4stupid wrote:...bytes from offset 8 to 15 are the name of the WTB file...
Actually, not the name of the file, just a name as it turns out (in the files I initially tested it WAS the filename, but another one I just looked at - "PLANET.WTB" from Mercs - places "frobozz_" here).

Also, it appears that this field is longer than 8 bytes - I can prove up to 12 bytes, but I suspect it may be 16 bytes. The proof is "MECHCNK0.WTB" (again from Mercs), where the value here is "mech-chunk0" (11 characters). Also, in ALL the WTB files from DOS Mercs, the four bytes at offset 20 are always zero, so I suspect they are just a continuation of this field.

So in summary, I believe this field occupies bytes 8 to 23.

User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: Call for Help: Creating WTB's

Post by Col.Kell » Wed May 20, 2009 11:07 am

wow you certainly have a lot of free time quota :) every time i've tried to look at the WTBs I somehow end up scratching my head in some way... not realy my field of expertese anyway :roll:
MechWarrior 2: 31stCC
Image

Post Reply