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

How to change the FPS string? #22

Closed kwoxer closed 9 years ago

kwoxer commented 9 years ago

Already asked here: https://easyhook.codeplex.com/workitem/25879

I have this great project running. All is fine. I injected a game client (Hearthstone, DX9). And it shows the ... fps thing.

That is great for testing and works perfect. Now I was thinking about replacing the ... fps with something else, just to test.

But I'm not able to get it working. It does not matter what I change of the String. It always shows up ... fps. Why is it like that?

I changed in DXHookD3D9.cs:

if (this.FPS.GetFPS() >= 1)
                        {
                            font.DrawText(null, String.Format("{0:N0} fps", this.FPS.GetFPS()), 5, 5, SharpDX.Color.Red);
                        }

into...

font.DrawText(null, String.Format("{0:N0} blablabla", this.FPS.GetFPS()), 5, 5, 

I for sure cleaned the project and rebuild it. Nothing helped.

What am I doing wrong? Is there something else I need to rebuild?

Btw changing things of the Forms works. So it seems just not to work on the dll's somehow.

PS: the TakeScreenshot is just working when I chosse "Autodetect". If I take Direct 3D 9 it does not inject into the game. But in the log when I use Autodetect, it tells me Direct 3D 9.

I have no clue =/

justinstenning commented 9 years ago

I get the feeling that it isn't actually using D3D9 and that it is reporting the wrong thing or something...

Try also changing the following locations, each to a different value and see if one of them works for you:

1) DXHookD3D10.cs and DXHookD3D10)1.cs, lines 409 and 411 respectively 2) Common\FramesPerSecond.cs, line 10

kwoxer commented 9 years ago

Well I didn't tell it to you. But I searched for "fps" in the whole project and changed to to blablabla everywhere just to make sure. But I gonna redownload it and try it again and come back with results.

kwoxer commented 9 years ago

This is when I use Autodetect:

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:5128.

This is when I use one of the 4 options:

Information: Remote process is a 32-bit process.
Information: Injected into process Id:5128.
Information: Disconnecting from process 5128

And by the way now it works. I figured out the line 400 in DXHookD3D9.cs:

 font.DrawText(null, String.Format("{0:N0} new", this.FPS.GetFPS()), 5, 5, SharpDX.Color.Red);

So it was actually D9. I don't know. I now use the project vom Github. Last time I used the one from Codeplex. Maybe that version is bugging. But I don't wanna test that.

Thank you very much. Now it works as intended. Great project.

justinstenning commented 9 years ago

Thanks for getting back with results. The really old project used the GAC, this could explain why you didn't see a change as you would've had to also change the version number to ensure the correct version was registered in the GAC.