tags:

views:

76

answers:

1

I am writing windows32 hooks around DirectX 6.1 library to DirectX 9.0c; Idea is to replace all calls to DX 6.1 3D device with calls to Direct 9.0c and inject some custom code, so old game which I am patching (99' year) will be able to use shaders, post-effects, etc.

The old DX 6.1 3D device was created by creating DDraw module. Game is then enumerating device caps. In my module the entire DDraw module is skiped and 3D view is initialized. So I have problem as I can't give the game Ddraw4 device caps which it requires as I do not have DDraw device at all!

So my question is how to obtain DDraw4 device caps without initiaizing DDraw4 device. Perhaps it will be sufficient to create fixed list and feed it to the game, but I have no idea what should be on that list (I gave what I thought it should be, and the game exited - logger showed it was just after device caps checked)

+1  A: 

I've never tried this, but you might try the following. Assuming you don't have the 6.1 SDK, you could make the DDCAPS structure (the DirectDraw one) yourself (it's basically just DWORDs), then get the capabilities (D3DCAPS9) using the DX9 GetDeviceCaps function. Next, take the values you need from the acquired caps (using DX9) and set the equivalent values for DirectDraw in your DDCAPS structure. You could then feed this populated caps structure to the game. A few caveats--as you mentioned, you don't know what it needs specifically, so it's kind of hit and miss (unless you have the source code). Also, there may not be a 1:1 mapping for the caps structure values (between DX9 and DDraw). Finally--this ties in with not having the 6.1 SDK--if you don't know the flag values, you might set a flag incorrectly when setting the values according to the acquired caps. As I mentioned, this may be way off (or require a lot of detective work), but I figured it might be something you could try.

Gemini14