justinstenning / Direct3DHook

DirectX Capture and Overlays by using Direct3D API hooks
http://spazzarama.com/2011/03/14/c-screen-capture-and-overlays-for-direct3d-9-10-and-11-using-api-hooks
MIT License
580 stars 178 forks source link

After Injection Game FPS becomes 15 #32

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hello Justin,

After the last commit I think something in Direct3DHook got broken. After injecting into any game the game FPS becomes too low to play and the TestScreenshot software gives an error:

Debug: DXHookD3D9: System.NullReferenceException: Object reference not set to an instance of an object. at Capture.Hook.DXHookD3D9.DoCaptureRenderTarget(Device device, String hook) in C:\Users\User\Desktop\New\Direct3DHook-master\Capture\Hook\DXHookD3D9.cs:line 381 Debug: DXHookD3D9: System.NullReferenceException: Object reference not set to an instance of an object. ... at System.Drawing.Bitmap..ctor(String filename) at Capture.Hook.Common.ImageElement..ctor(String filename) in C:\Users\User\Desktop\New\Direct3DHook-master\Capture\Hook\Common\ImageElement.cs:line 34 at Capture.Hook.DXHookD3D9.DoCaptureRenderTarget(Device device, String hook) in C:\Users\User\Desktop\New\Direct3DHook-master\Capture\Hook\DXHookD3D9.cs:line 389 Debug: DXHookD3D9: Hook: End Debug: DXHookD3D9: Hook: DeviceEx created - PresentEx supported Debug: DXHookD3D9: Hook: Direct3DEx... Debug: DXHookD3D9: Hook: Device created Debug: DXHookD3D9: Hook: Before device creation Debug: DXHookD3D9: Hook: Begin Debug: Autodetect found Direct3D 9 Information: Remote process is a 32-bit process. Information: Injected into process Id:27676.

No FPS overlay is also coming. Just the huge FPS lag and this nullreference error continuously.

Hope you will solve it soon.

Thanks in advance....

justinstenning commented 8 years ago

The problem was that the example image line was left uncommented line 396, resulting in an exception while creating the image element.

This has now been fixed.