Recently, a test team of colleagues said they wanted to write an automated game testing tool. There was a need: How to Get rendering-related information such as FPs of another d3d program in one program? This problem is quite common. For example, the video software fraps has this basic function, while the performance testing tool GPA is more thorough. There is no idea at first glance. It is too complicated to implement it through the driver layer, not what the other party wants. So I searched the internet and found a kind
DLL (proxy DLL) method, I think it is more feasible, and the method is simple and efficient.
In order to tune DirectX functions, applications need to first load the corresponding d3d library, such as the most basic d3d9. dll. The proxy DLL, as its name implies, is a bridge between the application and the real DLL through an intermediate link. As a result, operations such as data transmission between the two become transparent and visible, in this way, you can also add some operations in it (similar to charging this path is my toll ^ 0 ^ ).
Conventional DLL call: application <-> system d3d9. dll
Proxy DLL call: application <-> proxy d3d9. dll <-> system d3d9. dll
Through the above relationship, we can see that the proxy dll can be understood as an empty shell, and the actual operation also requires it to load the DLL implementation of the system.
After the above DLL is generated, how can the corresponding application be called? The simplest way is to directly copy the agent DLL to the corresponding application working directory. This method uses the search sequence when the program loads the DLL: search in the latest folder before finding it in the system. However, the process that needs to be completed manually does not seem very elegant, but there is no other way. If an application is loaded, you can copy it before running and delete it after running.
The proxy dll can be used to call the DLL by a program. However, if the program forcibly loads the DLL from the system directory, this method is powerless, in this case, you need other more in-depth methods, such as implementing code injection.
Note: The FPS display in the upper left corner is implemented through the proxy d3d9. dll. You can also control the rendering mode, such as solid and wireframe.
With the above basic implementation, you can use this method to implement more functions, and try other DLL (such as OGL)
Code download: http://dl.dbank.com/c0ytunrbkf