How to: Use D3D7

Discussions about using Windows guests in VirtualBox.

How to: Use D3D7

Postby di64 » 18. Dec 2009, 03:07

This was tested on Windows 2000, and should work on XP and pretty much everything ever too. The important part is that you have Guest Additions installed and 3D acceleration already working.

This is a long post. It's not worth it. Do it anyway, live on the edge.

Screenies at the end!

TOC
  • How we shall D3D7 the hell up
  • Grabbing the experimental ddraw.dll from the WineD3D on Windows project
  • Restoring original ddraw, renaming ddraw to fdraw
  • Modifying the DX7 game to look for fdraw not ddraw

How we shall D3D7 the hell up
The VBox D3D emulation stuff is based off (well, is almost entirely) WineD3D running on Windows itself. (This translates the DX calls to OpenGL calls, and then VBox does the rest from there.)

WineD3D is more or less focussed entirely on D3D8 and D3D9, unfortunately for those of us (like me) who want to play Typing Of The Dead, for instance. Tis a D3D7-based game.

Fortunately they have some unstable D3D7 bindings hanging about, that aren't shipped with the Guest Additions normally. We can install these separately.


Grabbing the experimental ddraw.dll from the WineD3D on Windows project

http://www.nongnu.org/wined3d/

^^^^^^^^ grab the wined3d installer, and shove it on your desktop for later.

If you run the installer, you will find that it tells you to reboot into safe mode. In my honest opinion this is unnecessary on windows 2000 (if you haven't got the win2k cd in then it can't copy the files back over and replace your system32 shenanigans), but whatever. Reboot into safe mode and run the installer again.

Tick ONLY the box that mentions DX7 (i.e. untick the others), and follow the setup through.

Whether you want to reboot into normal mode or not now is up to you.

In any case, go into C:\WINNT\System32. Make sure nothing is selected, then quickly type 'ddraw' to take you the right place. Note that wined3d has left a backup of the old ddraw next to the new one -- called something like ddraw.dll.wine_d3d_installer_backup.


Restoring original ddraw, renaming ddraw to fdraw

Unfortunately, the 'new' WineD3D-version ddraw can't be left as it is. opengl32.dll (which all wined3d components, including the new ddraw, rely on) relies on ddraw, now potentially causing an infinite loop of failure. The solution is obvious.

Rename the 'new' wined3d ddraw.dll to fdraw.dll, and rename the ddraw.dll.blahblahblah to just ddraw.dll.

Now, find your chosen DX7 game (I shall be using Typing Of The Dead) and make a copy of the EXE file to work on.

Grab a hex editor. I highly recommend http://frhed.sourceforge.net, as it is lightweight and simple.

Install frhed (or your hex editor) and use it to open your copied EXE. Punch Ctrl-F into your computer to summon the find dialog, and type just the five characters 'ddraw' and click OK.


Modifying the DX7 game to look for fdraw not ddraw

This next part is as much an art as a science. F4 is the 'find next' key.
Simply, the raw bytes are shown in the hex part of the display, and the right panel shows what letters these bytes represent.

Our goal is to make your EXE rely on fdraw, not ddraw. The rules are simple.

You cannot insert or delete characters, only overwrite them. (That's why we're called fdraw, not ddraw_rainbows_and_unicorns. We do not want to upset the offsets.)
If it looks like a C++ class name (e.g. CDisplayDriver::DDrawBlahBlah) then do not change the ddraw.
If it looks like a call into a function to do with ddraw (e.g. ddrawSomethingOrOther) then do not change the ddraw.
If it looks like an error message (e.g. Could not initialise DDraw due to ...) then it doesn't really matter what you do.

If it's buried towards the end of the file (>50% of the way down normally) and is around lots of function calls (e.g. .DSOUND.dll..WINMM.dll...DirectDrawCreateEx....DirectDrawEnumerateExA..DDRAW.dll.1.CreateEventA....GlobalFree..J.C...), you've found it. Change the D in DDRAW to an F and be on your way.

(Normally there are multiple references to a 'ddraw.dll', not just one 'DDRAW.dll' like there is in Typing of the Dead. What can I say , it was practically designed for this kind of thing.)

Now save the EXE and run it. If you messed up, copy back over from your back up. You'll know if you got it right, because you will be offered a mystifying choice between Hardware acceleration and Hardware acceleration with T&L. They both lag, so whatever.

Lags terribly? Sorry, I think it's supposed to do that. :P

Have fun!
Attachments
two.jpg
Shot from cutscene at start of game. Note Dreamcast & keyboard.
two.jpg (61.16 KiB) Viewed 9794 times
onepointfive.jpg
Shot from opening game cutscene
onepointfive.jpg (59.14 KiB) Viewed 9785 times
one.png
Showing the hex editing
one.png (102.77 KiB) Viewed 9781 times
di64
 
Posts: 3
Joined: 18. Dec 2009, 02:11
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: Windows *, Linux

Re: How to: Use D3D7

Postby highfly22 » 8. Feb 2010, 16:09

awesome!
highfly22
 
Posts: 2
Joined: 8. Feb 2010, 16:04
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: windows xp

Re: How to: Use D3D7

Postby highfly22 » 9. Feb 2010, 16:47

I used this method to run DK4 on the guest Windows XP.
One experiment is that when you edit the right place, the dll depends will be the fdraw.dll instead of ddraw.dll.

It seems you should edit the import section of dll.
highfly22
 
Posts: 2
Joined: 8. Feb 2010, 16:04
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: windows xp


Return to Windows Guests

Who is online

Users browsing this forum: No registered users and 14 guests