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
582 stars 176 forks source link

Games that Change Resolution Crash #28

Closed KristjanLaane closed 9 years ago

KristjanLaane commented 9 years ago

For some games, such as Guns of Icarus or Aerena - Clash of Champions, I get the following error: resolutionerror

For Guns of Icarus it happens if I attach and then detach before exiting the game, and then on exit, even though everything should be detached, the error is shown and the game crashes.

I believe the issue is occuring for any game that tries to change resolution for whatever reason after it has be attached and detached. It seems like some disposal is not happening fully or properly, something is lingering? What could it be?

justinstenning commented 9 years ago

Is this with Direct3D 9 or 11?

You may need to attach a debugger to determine if it is something within your hook that is causing the problem.

remcoros commented 9 years ago

This might be due to an incorrect implementation of ResetHook

@spazzarama your current implementation still has this error.

You need to always return the result of the device Reset call, instead of SharpDX.Result.Ok.Code

See: https://github.com/remcoros/Direct3DCapture/blob/master/Hook/DXHookD3D9.cs#L597

Note: I only worked on the DX9 version, other versions might still have this issue.

justinstenning commented 9 years ago

Ah, yep I fixed it on the GPUResize branch only:

https://github.com/spazzarama/Direct3DHook/blob/GPUResize/Capture/Hook/DXHookD3D9.cs#L210

KristjanLaane commented 9 years ago

thanks, i will try to port all of that over at some point!

justinstenning commented 9 years ago

Fixed in ddb309668c7eb545fda9043816f21c79807f8a69