1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

add workaround for westwood nox

This commit is contained in:
FunkyFr3sh 2023-08-20 01:39:02 +02:00
parent b1ac125817
commit b62b435c37
2 changed files with 7 additions and 1 deletions

View File

@ -175,6 +175,7 @@ typedef struct CNCDDRAW
RECT bnet_win_rect;
POINT bnet_pos;
void* last_freed_palette; /* Dungeon Keeper hack */
void* last_freed_surface; /* Nox hack */
BOOL child_window_exists;
BOOL got_child_windows;
DWORD last_set_window_pos_tick; /* WINE hack */

View File

@ -111,8 +111,10 @@ ULONG __stdcall IDirectDrawSurface__Release(IDirectDrawSurfaceImpl* This)
if (This->mapping)
CloseHandle(This->mapping);
if (This->backbuffer)
if (This->backbuffer && (!g_ddraw || (void*)This->backbuffer != g_ddraw->last_freed_surface))
{
IDirectDrawSurface_Release(This->backbuffer);
}
if (This->clipper)
IDirectDrawClipper_Release(This->clipper);
@ -124,6 +126,9 @@ ULONG __stdcall IDirectDrawSurface__Release(IDirectDrawSurfaceImpl* This)
DeleteCriticalSection(&This->cs);
if (g_ddraw)
g_ddraw->last_freed_surface = This;
HeapFree(GetProcessHeap(), 0, This);
}