Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing Win32 C++ Program which creates child process of a Game Program(i.e "Game.exe"),using CreateProcess(...) function in Windows API.

(This Game was developed by an external party therefore,I don't have the source code of the program and also it uses direct3D for 3D-drawing purpose and nvidia Physx for physics simulations.)

- Responsibility of my program is to start this game program ,collect
the data for game benchmarking and then terminate the game whenever
required.

In order to reprent proper benchmark results, I need to count FPS of that Game program which is handled as child process.That means somehow my program(Parent process) should have a mechanism to capture the FPS count from that Game program.

- My question is,If we write a Visual C++ program to benchmark a game,how can we count the fps of that game?

(Most popular Fraps program does this,by being an external program it can count fps of any game run on OS,I need to know that how they achieve that mechanism? and imprint that mechanism in my program in order to retrieve fps.)

For your convenience please refer :-

1. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
2. http://www.fraps.com/

What I have tried:

I tried to do achieve fps through windows hooks It did not work.
Posted
Updated 6-Jun-17 23:57pm
v3

1 solution

I realise it's not great to just post a link but the content is long.
Instrumenting Direct3D applications

Here is a short excerpt of the initial steps to achieve your goal.

The code we have provided starts the target process in suspended mode, and hooks the Direct3DCreate9 entry point in the d3d9.dll.
Once we catch a Direct3DCreate9 call, we can use the returned IDirect3D9 pointer to index the VTable. Since the call occurred in the target process address space, we cannot use the pointer directly in our host application; however, we can use Deviare’s functions to read the hooked process memory (starting with the IDirect3D9 pointer) to get the method addresses. This is a very interesting and useful technique which avoids sending address data from the intercepted process to the host processes.
 
Share this answer
 
Comments
Buddhi Chaturanga 8-Jun-17 7:24am    
Thank you for the answer I will try this solution and verify it as an answer later.Really appreciate your thoughts.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900