From 982ec5600770ef9c4c65fde83a63875eba534fa3 Mon Sep 17 00:00:00 2001 From: Nemirtingas Date: Fri, 8 Nov 2019 15:46:57 +0100 Subject: [PATCH] Enable DX12 overlay --- overlay_experimental/Renderer_Detector.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/overlay_experimental/Renderer_Detector.cpp b/overlay_experimental/Renderer_Detector.cpp index 72fcdec..0b686be 100644 --- a/overlay_experimental/Renderer_Detector.cpp +++ b/overlay_experimental/Renderer_Detector.cpp @@ -87,7 +87,10 @@ HRESULT STDMETHODCALLTYPE Renderer_Detector::MyIDXGISwapChain_Present(IDXGISwapC if (!inst.stop_retry()) { IUnknown* pDevice = nullptr; - _this->GetDevice(IID_PPV_ARGS(reinterpret_cast(&pDevice))); + if (inst._dx12_hooked) + { + _this->GetDevice(IID_PPV_ARGS(reinterpret_cast(&pDevice))); + } if (pDevice) { DX10_Hook::Inst()->start_hook(); @@ -436,13 +439,13 @@ void Renderer_Detector::hook_dx12() }//if (pDevice != nullptr) }//if (D3D12CreateDevice != nullptr) }//if (library != nullptr) - if (pCommandQueue != nullptr && pCommandList != nullptr && pSwapChain != nullptr) + if (pCommandQueue != nullptr && pSwapChain != nullptr) { PRINT_DEBUG("Hooked IDXGISwapChain::Present to detect DX Version\n"); _dx12_hooked = true; auto h = DX12_Hook::Inst(); - h->loadFunctions(pCommandQueue, pCommandList, pSwapChain); + h->loadFunctions(pCommandQueue, pSwapChain); Hook_Manager::Inst().AddHook(h); HookDXGIPresent(pSwapChain); }