diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ba9db198a..c64d8abf8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,6 +2,8 @@ ========== + Fixed potential deadlock in RenoDX mods, the ones that do not check for nullptr before dereferencing ptrs will simply have to crash until fixed. + + Disabled floating-point exception handling when ResizeTargets is called, + because it causes all CryTek games to crash. 24.12.26 ======== diff --git a/src/render/dxgi/dxgi.cpp b/src/render/dxgi/dxgi.cpp index c6956a063..859ce6336 100644 --- a/src/render/dxgi/dxgi.cpp +++ b/src/render/dxgi/dxgi.cpp @@ -8451,11 +8451,11 @@ SK_HookDXGI (void) { SK_DXGI_DetermineHighestSupportedFactoryVersion (); - bool bEnable = SK_EnableApplyQueuedHooks (); - { - SK_ApplyQueuedHooks (); - } - if (! bEnable) SK_DisableApplyQueuedHooks (); + //bool bEnable = SK_EnableApplyQueuedHooks (); + //{ + // SK_ApplyQueuedHooks (); + //} + //if (! bEnable) SK_DisableApplyQueuedHooks (); static const IID iids [] = { IID_IDXGIFactory, IID_IDXGIFactory1, IID_IDXGIFactory2, IID_IDXGIFactory3, IID_IDXGIFactory4, IID_IDXGIFactory5, @@ -8480,9 +8480,6 @@ SK_HookDXGI (void) else { - auto suspended = - SK_SuspendAllOtherThreads (); - // Thus we need to use a secondary thread HANDLE hSecondaryThread = SK_Thread_CreateEx ([](LPVOID)->DWORD @@ -8497,11 +8494,9 @@ SK_HookDXGI (void) // because this could deadlock otherwise. if (hSecondaryThread != 0) { - WaitForSingleObject (hSecondaryThread, 100UL); + WaitForSingleObject (hSecondaryThread, 500UL); SK_CloseHandle (hSecondaryThread); } - - SK_ResumeThreads (suspended); } initializing_dxgi = true; diff --git a/src/render/dxgi/dxgi_swapchain.cpp b/src/render/dxgi/dxgi_swapchain.cpp index bd4d5d07b..94ecdb06e 100644 --- a/src/render/dxgi/dxgi_swapchain.cpp +++ b/src/render/dxgi/dxgi_swapchain.cpp @@ -2586,6 +2586,10 @@ SK_DXGI_SwapChain_ResizeTarget_Impl ( _In_ const DXGI_MODE_DESC *pNewTargetParameters, BOOL bWrapped ) { + // Fix for CryTek's stupid engine enabling floating-point exceptions + _control87 (0x0, _MCW_EM); + _controlfp (0x0, _MCW_EM); + const auto _Return = [&](HRESULT hr)