Search code examples
directdraw

Getting programmatically Device Caps for DirectX 6.1 (DDraw4)


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 initializing 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)


Solution

  • The solution was a bit crude, but most importantly - is working flawlessly.

    I've written small self-contained utility, which initialize DDraw 6.1, than gets device caps, then dump them to the file on disk (device caps is Plain Old C format structure, so saving it is really simple) and quits. Then I can read the device caps file from disk and return it when application ask me for them.