Jump to content
  • Advertisement
Sign in to follow this  
jagels

OpenGL Overlay text (or more?) onto DX games like Fraps

This topic is 5101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm sure you're all familiar with the program Fraps - http://www.fraps.com/. What I am trying to do is, for now, just write a simple DX program (C++) to overlay some text onto any modern directx game like Fraps overlays the frame counter. I've tried to look around and see if I could find any tutorials, but the best thing I found was this, from the Fraps FAQ:
Quote:
How do I know when a new frame has been drawn? What functions must I hook? Hooking is currently performed on separate functions for DirectDraw, Direct3D8, and OpenGL. These are: Flip (for DirectX 7 and earlier - DDRAW.DLL) Present (for DirectX 8 ・D3D8.DLL) wglSwapBuffers (for OpenGL) Note that DirectX is class based. This means that Flip and Present are not exported from the DLL directly. You must take the parent class and obtain the function pointers directly from an offset within the class (or subclasses). Consult the header files in the DX SDK in order to determine the offsets of the function pointers.
I guess Present is what I want to be looking into, is this used in some sort of hook? I'm almost positive that fraps does not modify game files in any way seeing as it works on basically any game, even if the game was installed or released after Fraps. I'm just starting to get my feet wet with the DX SDK so I don't know if i'm going over my head here, but if someone could point me in the right direction that would be great, thanks :)

Share this post


Link to post
Share on other sites
Advertisement
Basically, you need to inject your own code to the place where the ID3DDevice*::Present() is called, drawing your overlay stuff there and then calling the actual Present() to continue the app's normal operation.

It is likely that Fraps modifies the d3d image in memory after it has been loaded, to plant it's own version of Present there for the applications to use. The memory offsets, though tricky, aren't impossible to obtain. The program could simply replace the pointer to the Present() internal routine with it's own version.

EDIT: By "d3d image", I mean the d3d library, d3d*.dll [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!