diff --git a/inc/surface.h b/inc/surface.h index c53b30b..45631c1 100644 --- a/inc/surface.h +++ b/inc/surface.h @@ -51,6 +51,7 @@ typedef struct IDirectDrawSurfaceImpl HDC hDC; DDCOLORKEY colorKey; DWORD lastFlipTick; + DWORD lastBltTick; } IDirectDrawSurfaceImpl; diff --git a/src/settings.c b/src/settings.c index fff8624..53a3f92 100644 --- a/src/settings.c +++ b/src/settings.c @@ -462,8 +462,6 @@ static void CreateSettingsIni() "[TWISTED]\n" "renderer=gdi\n" "maxgameticks=25\n" - "maxfps=60\n" - "forcefps=true\n" "\n" "; Twisted Metal 2\n" "[Tm2]\n" diff --git a/src/surface.c b/src/surface.c index e1e2cdd..9825a88 100644 --- a/src/surface.c +++ b/src/surface.c @@ -466,6 +466,8 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime()) { + This->lastBltTick = timeGetTime(); + ReleaseSemaphore(ddraw->render.sem, 1, NULL); SwitchToThread(); @@ -604,7 +606,10 @@ HRESULT __stdcall ddraw_surface_BltFast(IDirectDrawSurfaceImpl *This, DWORD dst_ { InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE); - if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime()) + DWORD time = timeGetTime(); + + if (!(This->flags & DDSD_BACKBUFFERCOUNT) || + (This->lastFlipTick + FLIP_REDRAW_TIMEOUT < time && This->lastBltTick + FLIP_REDRAW_TIMEOUT < time)) { ReleaseSemaphore(ddraw->render.sem, 1, NULL); } @@ -1025,7 +1030,10 @@ HRESULT __stdcall ddraw_surface_Unlock(IDirectDrawSurfaceImpl *This, LPVOID lpRe { InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE); - if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime()) + DWORD time = timeGetTime(); + + if (!(This->flags & DDSD_BACKBUFFERCOUNT) || + (This->lastFlipTick + FLIP_REDRAW_TIMEOUT < time && This->lastBltTick + FLIP_REDRAW_TIMEOUT < time)) { ReleaseSemaphore(ddraw->render.sem, 1, NULL);