WDF files deciphered!

WDF files + wdfedit & wdftool & basic wdf file info; support/discussion/questions

Moderator: thunderchero

User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

Oh boy I cant wait, ive already started hacking my wdfs if you havent noticed in my wdf thread lol ;)
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

That's great! I actually have a wdftool written and working... on Linux. I've had a little trouble compiling on Windows. The tool should make it much easier to figure out all the unknowns. I'll try get it fixed up and uploaded today.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

Cool, I hope you get it sorted soon because it would really speed things up with viewing widget placement after editing. Fingers crossed.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

It's finally here. This was part of a larger prototype system that I wrote on Linux, so it took a while to separate the code from that system, clean it up, get it working on Windows, etc. I had added some nice features like direct reading from STBOF.RES, but I couldn't get it working on Windows properly, so bummer.

Here's wdftool, a command line utility for interacting with WDFs. Enjoy.

You can get it here, Windows binaries, or source code:
http://sourceforge.net/projects/botfwdftools/files/

For anyone wanting to compile from source: I had some trouble trying to get it to compile on Windows. If you need help, just ask.

Here are some examples of it's use:

To view a WDF from a directory:

Code: Select all

  wdftool C:\stbof_files\opening.wdf
To convert a WDF to a BMP:

Code: Select all

  wdftool -o opening.bmp C:\stbof_files\opening.wdf
To dump a lot of info on a WDF to the console, reading from stbof.res:

Code: Select all

  wdftool -dump stbof/opening.wdf
Or to save it to a text file, just use redirection:

Code: Select all

  wdftool -dump stbof/opening.wdf > opening.txt
Here is some example output using the dump option:

Code: Select all

H:\src\botf\wdftool\bin> wdftool -z C:\botf\stbof.res auto.wdf -dump

0x00000004: Window
          typeId: 1
      instanceId: 0
            rect: (  0,   0, 144,  96)
 backgroundImage: asavebkg.tga
   Total objects: 2
       NumWindow: 0
   NumPushButton: 2
         NumMenu: 0
       NumSlider: 0
    NumScrollBar: 0
      NumListBox: 0
      NumPictBox: 0
      NumTextBox: 0

0x00000069: PushButton
          typeId: 2
      instanceId: 8155
            rect: ( 20,  36, 124,  28)
 backgroundImage: yestxtop.tga
         unknown: -1
      ButtonType: 2 (TOGGLE)
          Repeat: 0
RepeatsPerSecond: 0
        outImage: yestxtop.tga
         inImage: yes_on.tga

0x000000b5: PushButton
          typeId: 2
      instanceId: 8156
            rect: ( 20,  68, 124,  28)
 backgroundImage: notxtop.tga
         unknown: -1
      ButtonType: 2 (TOGGLE)
          Repeat: 0
RepeatsPerSecond: 0
        outImage: notxtop.tga
         inImage: no_on.tga
Note the hex code 0x... at the start of each item is the offset in the WDF where the relevant object is located. This might be useful to modders until a full WDF editor is built. Also note, in viewer mode, you can get the same info by clicking on any item, and you'll see that item's info appear on the console.

I also have a larger WDF viewer in the works, one that's totally interactive with all the game screens; basically a full replica of the BotF GUI system. I'll post it when I get it finished.

If anyone wants particular features, I might be persuaded. In case you're wondering, I was considering writing a GUI, but I didn't have time. I have no use for such things anyway :D
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

I can not get it to run at all. It may be because I am on Windows 7 64 bit?
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

That's strange, the machine I used to compile it was running 64-bit Windows 7. And it runs on my 32-bit Linux box using Wine.

Does it give any error messages?

Again to reiterate, it's not a GUI program, just a command-line app.
You can either run it from a command prompt, or by dragging a WDF file onto wdftool.exe.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

Dragging the wdf onto the tool did the trick, I was trying to run the tool by itself but it would not load. Thanks, this helps me out very much.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

Awesome. Let me know if you have any trouble with it. It's really just a test program, and I can't guarantee it's bug-free. I might add a GUI to it if I have time, to make it more user-friendly.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

Im perfectly happy with it as it is, it saves me from loading wdfs into stbof.res every time I want to check text/image placement, with your tool I can see those 'placeholders' and load them quickly after editing.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

DCER wrote:The first three bytes in the font entry are indeed the font color, but not RGB or BGR, for some reason the order is RBG instead.

The last unknown value is a boolean switch. When set to 1 botf uses the color information found here, otherwise it will use the default color instead.
Thanks for the info. I've updated the main post. That leaves the other 7 unknowns in the font entry: if it helps, those 8 integers after the color are all booleans. I've run my wdftool over many of the WDFs, and those values are always 0 or 1.

P.S. I made a mistake in the original post for the ScrollBar object: thumbOnImage should come before thumbOff. I've changed it.
User avatar
DCER
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Re: WDF files deciphered!

Post by DCER »

Had a look a your tool and it works great. Had no problems with it.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

It is indeed a great work. But, one thing I have found that bugs me.

When viewing a wdf, when I click in the red box, in the command prompt I can see all of its specs, and which hex offset it begins.

Now, when I click one of the text boxes (green? yellow? sorry i get those 2 mixed up quite frequently) I get no information, and the program seemingly freezes up. Is there something I did wrong or something that was not loaded right? My apologies if I am overlooking something.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

Tethys wrote:Now, when I click one of the text boxes (green? yellow? sorry i get those 2 mixed up quite frequently) I get no information, and the program seemingly freezes up. Is there something I did wrong or something that was not loaded right? My apologies if I am overlooking something.
You're right. I just checked it. The odd thing is it only happens on the Windows version, not the Linux one. I'll try figure out what the problem is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: WDF files deciphered!

Post by Tethys »

Thank you I hope its nothing too time comsuming, but other than that, I havent tested to see what happens when you select a button object or scrolling object. These may be things to test out as well.
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: WDF files deciphered!

Post by QuasarDonkey »

I have the problem figured out. I'll have a fix very soon.
Post Reply

Return to “WDF files + wdfedit & wdftool & basic wdf file info”