1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Release DirectDraw critical section between GetDC/ReleaseDC

Fixes invisible exit confirmation dialog in Metal Gear Solid (issue #49).
This commit is contained in:
narzoul 2021-01-13 22:11:50 +01:00
parent 240ddbda57
commit affc5ab17e

View File

@ -6,6 +6,7 @@
#include <DDraw/Surfaces/PrimarySurface.h> #include <DDraw/Surfaces/PrimarySurface.h>
#include <DDraw/Surfaces/Surface.h> #include <DDraw/Surfaces/Surface.h>
#include <DDraw/Surfaces/SurfaceImpl.h> #include <DDraw/Surfaces/SurfaceImpl.h>
#include <Dll/Dll.h>
namespace DDraw namespace DDraw
{ {
@ -78,6 +79,7 @@ namespace DDraw
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
RealPrimarySurface::waitForFlip(m_data); RealPrimarySurface::waitForFlip(m_data);
Dll::g_origProcs.ReleaseDDThreadLock();
} }
return result; return result;
} }
@ -159,7 +161,12 @@ namespace DDraw
template <typename TSurface> template <typename TSurface>
HRESULT SurfaceImpl<TSurface>::ReleaseDC(TSurface* This, HDC hDC) HRESULT SurfaceImpl<TSurface>::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 <typename TSurface> template <typename TSurface>