Creating an overlay

Started by
0 comments, last by d07RiV 10 years, 2 months ago

I know there is a way to create an overlay surface with DirectDraw, but that API is outdated and is not even present in the newer SDKs. Does it still work with Win7+?

What is the modern way of doing that? I've seen IDirect3DDevice9Ex support for hardware overlays, but it seems to be indended for video rendering and I'm not sure it would work (I need to render over any window, including fullscreen games). Besides, it wouldn't work with older Windows.

Also, do any of these methods support alpha blending (not color key)?

There's also a possibility to hook Direct3D to add rendering code to EndScene, but that would limit me to rendering inside an application window, and I would also have to hook other APIs such as D3D11 and OpenGL.

Advertisement

Okay, DirectDraw overlays don't work with DWM, which is unacceptable for me.

Tried the Direct3DEx, I'm getting "Overlay is not supported" on my machine when creating the device with D3DSWAPEFFECT_OVERLAY (Win7, 550Ti graphics card; does SDK version matter?).

Any alternatives? Is api hooking really the only way?

Update: figured I'd stick with hooking, its working so far, but I have a couple questions. I'm getting the address of IDirect3DDevice9::EndScene and adding a detour (using a small library) to call my rendering code, that creates a texture from a memory-mapped file and renders it in a certain area (which involves modifying a lot of render states, still not sure if I got them all).

First, how can games react to such intrusion? Since a lot of them have anti-hack measures, what can I expect? How do other programs (including Fraps) deal with this?

Second, I got it to successfully remove the hook when the launcher is closed, without crashing the target app. However, testing it on SDK samples, if I close the target program first, it shows a warning along the lines of "D3D state has non-zero reference count blah blah blah" and the sample process doesn't terminate, even after the launcher is closed, so I have to kill it in task manager. How am I supposed to detect and handle this?

This topic is closed to new replies.

Advertisement