From affc5ab17ef39443c9726577457330a3be0c9bac Mon Sep 17 00:00:00 2001 From: narzoul Date: Wed, 13 Jan 2021 22:11:50 +0100 Subject: [PATCH] Release DirectDraw critical section between GetDC/ReleaseDC Fixes invisible exit confirmation dialog in Metal Gear Solid (issue #49). --- DDrawCompat/DDraw/Surfaces/SurfaceImpl.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DDrawCompat/DDraw/Surfaces/SurfaceImpl.cpp b/DDrawCompat/DDraw/Surfaces/SurfaceImpl.cpp index 45c9101..5266010 100644 --- a/DDrawCompat/DDraw/Surfaces/SurfaceImpl.cpp +++ b/DDrawCompat/DDraw/Surfaces/SurfaceImpl.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace DDraw { @@ -78,6 +79,7 @@ namespace DDraw if (SUCCEEDED(result)) { RealPrimarySurface::waitForFlip(m_data); + Dll::g_origProcs.ReleaseDDThreadLock(); } return result; } @@ -159,7 +161,12 @@ namespace DDraw template HRESULT SurfaceImpl::ReleaseDC(TSurface* This, HDC hDC) { - return s_origVtable.ReleaseDC(This, hDC); + HRESULT result = s_origVtable.ReleaseDC(This, hDC); + if (SUCCEEDED(result)) + { + Dll::g_origProcs.AcquireDDThreadLock(); + } + return result; } template