mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
add option to lock surfaces
This commit is contained in:
parent
484022b97d
commit
8d6b2f3bfe
@ -25,6 +25,7 @@ typedef struct IDirectDrawSurfaceImpl
|
||||
DWORD flags;
|
||||
DWORD caps;
|
||||
DWORD backbuffer_count;
|
||||
CRITICAL_SECTION cs;
|
||||
|
||||
IDirectDrawPaletteImpl* palette;
|
||||
|
||||
|
1
inc/dd.h
1
inc/dd.h
@ -147,6 +147,7 @@ typedef struct CNCDDRAW
|
||||
BOOL fixnotresponding;
|
||||
BOOL flipclear;
|
||||
BOOL locktopleft;
|
||||
BOOL lock_surfaces;
|
||||
BOOL d3d9linear;
|
||||
BOOL gdilinear;
|
||||
int resolutions;
|
||||
|
@ -110,6 +110,8 @@ ULONG __stdcall IDirectDrawSurface__Release(IDirectDrawSurfaceImpl* This)
|
||||
IDirectDrawPalette_Release(This->palette);
|
||||
}
|
||||
|
||||
DeleteCriticalSection(&This->cs);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ void cfg_load()
|
||||
g_ddraw->novidmem = cfg_get_bool("novidmem", FALSE);
|
||||
g_ddraw->fixnotresponding = cfg_get_bool("fixnotresponding", FALSE);
|
||||
g_ddraw->locktopleft = cfg_get_bool("locktopleft", FALSE);
|
||||
g_ddraw->lock_surfaces = cfg_get_bool("lock_surfaces", FALSE);
|
||||
g_ddraw->releasealt = cfg_get_bool("releasealt", FALSE);
|
||||
g_ddraw->d3d9linear = cfg_get_bool("d3d9linear", TRUE);
|
||||
g_ddraw->gdilinear = cfg_get_bool("gdilinear", FALSE);
|
||||
@ -353,6 +354,7 @@ static void cfg_create_ini()
|
||||
"novidmem=false\n"
|
||||
"fixnotresponding=false\n"
|
||||
"locktopleft=false\n"
|
||||
"lock_surfaces=false\n"
|
||||
"releasealt=false\n"
|
||||
"gdilinear=false\n"
|
||||
"allow_wmactivate=false\n"
|
||||
@ -954,6 +956,7 @@ static void cfg_create_ini()
|
||||
"\n"
|
||||
"; Total Annihilation (Unofficial Beta Patch v3.9.02)\n"
|
||||
"[TotalA]\n"
|
||||
"lock_surfaces=true\n"
|
||||
"singlecpu=false\n"
|
||||
"fixwndprochook=true\n"
|
||||
"\n"
|
||||
|
@ -728,6 +728,9 @@ HRESULT dds_Lock(
|
||||
DWORD dwFlags,
|
||||
HANDLE hEvent)
|
||||
{
|
||||
if (g_ddraw->lock_surfaces)
|
||||
EnterCriticalSection(&This->cs);
|
||||
|
||||
dbg_dump_dds_lock_flags(dwFlags);
|
||||
|
||||
if (g_ddraw && g_ddraw->fixnotresponding)
|
||||
@ -942,6 +945,9 @@ HRESULT dds_Unlock(IDirectDrawSurfaceImpl* This, LPRECT lpRect)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ddraw->lock_surfaces)
|
||||
LeaveCriticalSection(&This->cs);
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
@ -995,6 +1001,8 @@ HRESULT dd_CreateSurface(
|
||||
|
||||
lpDDSurfaceDesc->dwFlags |= DDSD_CAPS;
|
||||
|
||||
InitializeCriticalSection(&dst_surface->cs);
|
||||
|
||||
dst_surface->bpp = g_ddraw->bpp == 0 ? 16 : g_ddraw->bpp;
|
||||
dst_surface->flags = lpDDSurfaceDesc->dwFlags;
|
||||
dst_surface->caps = lpDDSurfaceDesc->ddsCaps.dwCaps;
|
||||
|
@ -374,6 +374,9 @@ DWORD WINAPI d3d9_render_main(void)
|
||||
g_ddraw->primary->height == g_ddraw->height &&
|
||||
(g_ddraw->bpp == 16 || g_ddraw->bpp == 32 || g_ddraw->primary->palette))
|
||||
{
|
||||
if (g_ddraw->lock_surfaces)
|
||||
EnterCriticalSection(&g_ddraw->primary->cs);
|
||||
|
||||
if (g_ddraw->vhack)
|
||||
{
|
||||
if (util_detect_low_res_screen())
|
||||
@ -455,6 +458,9 @@ DWORD WINAPI d3d9_render_main(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ddraw->lock_surfaces)
|
||||
LeaveCriticalSection(&g_ddraw->primary->cs);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&g_ddraw->cs);
|
||||
|
@ -53,6 +53,9 @@ DWORD WINAPI gdi_render_main(void)
|
||||
g_ddraw->primary->height == g_ddraw->height &&
|
||||
(g_ddraw->bpp == 16 || g_ddraw->bpp == 32 || g_ddraw->primary->palette))
|
||||
{
|
||||
if (g_ddraw->lock_surfaces)
|
||||
EnterCriticalSection(&g_ddraw->primary->cs);
|
||||
|
||||
if (warning_end_tick)
|
||||
{
|
||||
if (timeGetTime() < warning_end_tick)
|
||||
@ -153,6 +156,9 @@ DWORD WINAPI gdi_render_main(void)
|
||||
g_ddraw->primary->bmi,
|
||||
DIB_RGB_COLORS);
|
||||
}
|
||||
|
||||
if (g_ddraw->lock_surfaces)
|
||||
LeaveCriticalSection(&g_ddraw->primary->cs);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&g_ddraw->cs);
|
||||
|
@ -600,6 +600,9 @@ static void ogl_render()
|
||||
g_ddraw->primary->height == g_ddraw->height &&
|
||||
(g_ddraw->bpp == 16 || g_ddraw->bpp == 32 || g_ddraw->primary->palette))
|
||||
{
|
||||
if (g_ddraw->lock_surfaces)
|
||||
EnterCriticalSection(&g_ddraw->primary->cs);
|
||||
|
||||
if (g_ddraw->vhack)
|
||||
{
|
||||
if (util_detect_low_res_screen())
|
||||
@ -703,6 +706,9 @@ static void ogl_render()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ddraw->lock_surfaces)
|
||||
LeaveCriticalSection(&g_ddraw->primary->cs);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&g_ddraw->cs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user