Universal graphical hook for Windows apps, although it should work on Linux too if you implement it correctly, that will display an ImGui Demo Window as an example.
Call Utils::SetRenderingBackend(eRenderingBackend)
in DllMain as shown here.
You must do this or the DLL won't know what to hook or how to hook. What is eRenderingBackend?.
The purpose of this library is to show how to hook different backends to display ImGui, the code should be easy to understand as I tried to make everything seem almost the same, see backends folder.
- DirectX9 + DirectX9Ex
- DirectX10
- DirectX11
- DirectX12
- OpenGL
- Vulkan
We create a 'dummy device' and a 'dummy swapchain' (for DirectX10 and higher) with a handle to the console window. See the CreateDeviceD3DX
function in every DirectX backend. See DX12 example 'CreateDeviceD3D12'. The point is to get a pointer to the vTable to get the required functions addresses. We release it right after getting the pointers because we won't use our 'dummy device' and 'dummy swapchain' for drawing. See code used in DX12 backend hook.
We hook wglSwapBuffers which is an exported function in opengl32.dll. See code used in OpenGL backend hook.
We create a 'dummy device' to get the required functions addresses. The point is to hook into vkQueuePresentKHR where we will submit the queue with our data from our command pool and our command buffer. See code used in Vulkan backend hook.
Feel free to open an issue if something isn't working. Resizing works because ResizeBuffers is hooked. Input handling is up to you to decide how to make/use it. The WndProc hook is here. It should support both 64bit and 32bit architectures.
Try pressing HOME to rehook and see if things get better.
Minecraft (tested on 1.19) - menu textures glitched
MinHook - TsudaKageyu - Used for hooking (trampoline method).
ImGui - ocornut - self-explanatory.
Vulkan SDK - for the Vulkan API.