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

Prevent creating multiple primary surfaces

Fixes borderless fullscreen mode in Conquest: Frontier Wars
This commit is contained in:
narzoul 2022-07-24 12:11:00 +02:00
parent 6327bc506f
commit 6fdc7ad21a
2 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,12 @@ namespace DDraw
{
LOG_FUNC("PrimarySurface::create", &dd, desc, surface);
DDraw::RealPrimarySurface::destroyDefaultPrimary();
if (g_primarySurface)
{
LOG_ONCE("Warning: suppressed an attempt to create multiple primary surfaces");
return LOG_RESULT(DDERR_UNSUPPORTED);
}
const auto& dm = DDraw::DirectDraw::getDisplayMode(*CompatPtr<IDirectDraw7>::from(&dd));
g_monitorRect = D3dDdi::KernelModeThunks::getAdapterInfo(*CompatPtr<IDirectDraw7>::from(&dd)).monitorInfo.rcMonitor;
g_monitorRect.right = g_monitorRect.left + dm.dwWidth;

View File

@ -18,6 +18,7 @@ namespace DDraw
, m_fullscreenWindowStyle(0)
, m_fullscreenWindowExStyle(0)
{
LOG_FUNC("TagSurface::TagSurface", Compat::hex(origCaps), ddLcl);
m_ddInt.lpVtbl = &CompatVtable<IDirectDraw>::s_origVtable;
m_ddInt.lpLcl = ddLcl;
m_ddInt.dwIntRefCnt = 1;
@ -25,6 +26,7 @@ namespace DDraw
TagSurface::~TagSurface()
{
LOG_FUNC("TagSurface::~TagSurface", m_ddInt.lpLcl);
setFullscreenWindow(nullptr);
g_ddObjects.erase(m_ddInt.lpLcl);
}