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

Why when inject a game that use directx 11 i'm getting exception in the Capture project ? #24

Closed Csharper1972 closed 8 years ago

Csharper1972 commented 9 years ago

Any game that auto detect as directx 11 i'm getting this exception:

System.IndexOutOfRangeException was caught HResult=-2146233080 Message=Index was outside the bounds of the array. Source=Capture StackTrace: at Capture.Hook.DX11.DXFont.GetCharRect(Char c) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXFont.cs:line 251 at Capture.Hook.DX11.DXSprite.DrawString(Int32 X, Int32 Y, String text, Int32 R, Int32 G, Int32 B, Int32 A, DXFont F) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXSprite.cs:line 258 at Capture.Hook.DX11.DXOverlayEngine.Draw() in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXOverlayEngine.cs:line 145 at Capture.Hook.DXHookD3D11.PresentHook(IntPtr swapChainPtr, Int32 syncInterval, PresentFlags flags) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DXHookD3D11.cs:line 384 InnerException:

I didn't change anything but still every game that use directx 11 give this exception.

justinstenning commented 9 years ago

Sounds like it is trying to draw a character that it hasn't prepared...

On Wednesday, 6 May 2015, Csharper1972 notifications@github.com wrote:

Any game that auto detect as directx 11 i'm getting this exception:

System.IndexOutOfRangeException was caught HResult=-2146233080 Message=Index was outside the bounds of the array. Source=Capture StackTrace: at Capture.Hook.DX11.DXFont.GetCharRect(Char c) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXFont.cs:line 251 at Capture.Hook.DX11.DXSprite.DrawString(Int32 X, Int32 Y, String text, Int32 R, Int32 G, Int32 B, Int32 A, DXFont F) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXSprite.cs:line 258 at Capture.Hook.DX11.DXOverlayEngine.Draw() in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DX11\DXOverlayEngine.cs:line 145 at Capture.Hook.DXHookD3D11.PresentHook(IntPtr swapChainPtr, Int32 syncInterval, PresentFlags flags) in c:\Temp\hook\Direct3DHook-master\Capture\Hook\DXHookD3D11.cs:line 384 InnerException:

I didn't change anything but still every game that use directx 11 give this exception.

— Reply to this email directly or view it on GitHub https://github.com/spazzarama/Direct3DHook/issues/24#issuecomment-99230718 .

Csharper1972 commented 9 years ago

Strange, not my character since i didn't change anything or added anything. If you a solution for that a code with a solution please inform me. Thank you.

justinstenning commented 9 years ago

I suggest you attach the debugger to the target, and then run your host to inject the assembly.

You should get a break on the exception, or otherwise work on getting a breakpoint in there.

I haven't personally had this exception happen, but it sounds like it is trying to find the character (whatever it is) and isn't finding it. This could be an issue with locale or anything, I don't know, depends what is trying to render text.

Regards, Justin

On Thu, May 7, 2015 at 2:16 AM, Csharper1972 notifications@github.com wrote:

Strange, not my character since i didn't change anything or added anything. If you a solution for that a code with a solution please inform me. Thank you.

— Reply to this email directly or view it on GitHub https://github.com/spazzarama/Direct3DHook/issues/24#issuecomment-99526689 .

justinstenning commented 8 years ago

Duplicate #26