From 92a43ebf656bd00c5ce41de6f4bcf9aacda2da19 Mon Sep 17 00:00:00 2001 From: Katharine Chui Date: Mon, 22 Apr 2024 14:35:37 +0800 Subject: [PATCH] [dxgi] unchain DxgiSwapChain::Present1 and Present dxgi hooking tools might hook both, eg. https://github.com/SpecialKO/SpecialK/issues/167 --- src/dxgi/dxgi_swapchain.cpp | 13 ++++++++++--- src/dxgi/dxgi_swapchain.h | 4 ++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index 88ee3c6d..9b1283a1 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -303,15 +303,22 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE DxgiSwapChain::Present(UINT SyncInterval, UINT Flags) { - return Present1(SyncInterval, Flags, nullptr); + return PresentBase(SyncInterval, Flags, nullptr); } - - + HRESULT STDMETHODCALLTYPE DxgiSwapChain::Present1( UINT SyncInterval, UINT PresentFlags, const DXGI_PRESENT_PARAMETERS* pPresentParameters) { + return PresentBase(SyncInterval, PresentFlags, pPresentParameters); + } + + HRESULT STDMETHODCALLTYPE DxgiSwapChain::PresentBase( + UINT SyncInterval, + UINT PresentFlags, + const DXGI_PRESENT_PARAMETERS* pPresentParameters) { + if (SyncInterval > 4) return DXGI_ERROR_INVALID_CALL; diff --git a/src/dxgi/dxgi_swapchain.h b/src/dxgi/dxgi_swapchain.h index a01cdf2e..8ec7d501 100644 --- a/src/dxgi/dxgi_swapchain.h +++ b/src/dxgi/dxgi_swapchain.h @@ -233,6 +233,10 @@ namespace dxvk { DXGI_FORMAT Format, DXGI_COLOR_SPACE_TYPE ColorSpace); + HRESULT STDMETHODCALLTYPE PresentBase( + UINT SyncInterval, + UINT PresentFlags, + const DXGI_PRESENT_PARAMETERS* pPresentParameters); }; }