WDF files deciphered!
Moderator: thunderchero
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
Oh boy I cant wait, ive already started hacking my wdfs if you havent noticed in my wdf thread lol
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
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.
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
Cool, I hope you get it sorted soon because it would really speed things up with viewing widget placement after editing. Fingers crossed.
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
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:
To convert a WDF to a BMP:
To dump a lot of info on a WDF to the console, reading from stbof.res:
Or to save it to a text file, just use redirection:
Here is some example output using the dump option:
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
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
Code: Select all
wdftool -o opening.bmp C:\stbof_files\opening.wdf
Code: Select all
wdftool -dump stbof/opening.wdf
Code: Select all
wdftool -dump stbof/opening.wdf > opening.txt
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
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
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
I can not get it to run at all. It may be because I am on Windows 7 64 bit?
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
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.
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.
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
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.
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
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.
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
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.
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
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.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.
P.S. I made a mistake in the original post for the ScrollBar object: thumbOnImage should come before thumbOff. I've changed it.
-
- Code Master
- Posts: 683
- Joined: Sat Apr 26, 2008 2:00 am
Re: WDF files deciphered!
Had a look a your tool and it works great. Had no problems with it.
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
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.
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.
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
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.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.
-
- Past Administrator
- Posts: 2404
- Joined: Fri Jul 18, 2008 2:00 am
- Location: Your mom's bed ;)
Re: WDF files deciphered!
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.
-
- Code Analyst
- Posts: 433
- Joined: Tue Jul 26, 2011 8:29 pm
- Location: Ireland
Re: WDF files deciphered!
I have the problem figured out. I'll have a fix very soon.