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?. To enable or disable a specific backend comment backends in backend.hpp
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. Input handling is left for the user because there is no general solution.
Tip: Try pressing the "Home" key, that will rehook graphics, and see if anything changed.
- [!] Conflicts with other overlays such as MSI Afterburner and will probably crash.
- [Vulkan] Games or apps that present from a queue that doesn't support GRAPHICS_BIT may have issues such as artifacts and menu jittering. (Example: DOOM Eternal)
[Vulkan] Portal 2 will crash if injected while Valve intro is playing.- [OpenGL] Minecraft (tested on 1.19) - ui textures glitched sometimes.
MinHook - TsudaKageyu - Used for hooking (trampoline method).
ImGui - ocornut - self-explanatory.
Vulkan SDK - for the Vulkan API.