mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
force 5 min. FPS
This commit is contained in:
parent
5f0f8f8737
commit
b2ba8896b2
@ -566,7 +566,7 @@ static void Render()
|
|||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
while (UseOpenGL && ddraw->render.run &&
|
while (UseOpenGL && ddraw->render.run &&
|
||||||
(ddraw->render.forcefps || WaitForSingleObject(ddraw->render.sem, INFINITE) != WAIT_FAILED))
|
(ddraw->render.forcefps || WaitForSingleObject(ddraw->render.sem, 200) != WAIT_FAILED))
|
||||||
{
|
{
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
DrawFrameInfoStart();
|
DrawFrameInfoStart();
|
||||||
|
@ -62,7 +62,7 @@ DWORD WINAPI render_soft_main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (ddraw->render.run &&
|
while (ddraw->render.run &&
|
||||||
(ddraw->render.forcefps || WaitForSingleObject(ddraw->render.sem, INFINITE) != WAIT_FAILED))
|
(ddraw->render.forcefps || WaitForSingleObject(ddraw->render.sem, 200) != WAIT_FAILED))
|
||||||
{
|
{
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
DrawFrameInfoStart();
|
DrawFrameInfoStart();
|
||||||
|
@ -460,18 +460,20 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(This->caps & DDSCAPS_PRIMARYSURFACE &&
|
if((This->caps & DDSCAPS_PRIMARYSURFACE) && ddraw->render.run)
|
||||||
ddraw->render.run &&
|
|
||||||
(!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime()))
|
|
||||||
{
|
{
|
||||||
InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE);
|
InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE);
|
||||||
ReleaseSemaphore(ddraw->render.sem, 1, NULL);
|
|
||||||
SwitchToThread();
|
|
||||||
|
|
||||||
if (ddraw->ticksLimiter.ticklength > 0)
|
if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime())
|
||||||
{
|
{
|
||||||
ddraw->ticksLimiter.useBltOrFlip = TRUE;
|
ReleaseSemaphore(ddraw->render.sem, 1, NULL);
|
||||||
LimitGameTicks();
|
SwitchToThread();
|
||||||
|
|
||||||
|
if (ddraw->ticksLimiter.ticklength > 0)
|
||||||
|
{
|
||||||
|
ddraw->ticksLimiter.useBltOrFlip = TRUE;
|
||||||
|
LimitGameTicks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,12 +600,17 @@ HRESULT __stdcall ddraw_surface_BltFast(IDirectDrawSurfaceImpl *This, DWORD dst_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->caps & DDSCAPS_PRIMARYSURFACE &&
|
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && ddraw->render.run)
|
||||||
ddraw->render.run &&
|
|
||||||
(!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime()))
|
|
||||||
{
|
{
|
||||||
InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE);
|
InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE);
|
||||||
ReleaseSemaphore(ddraw->render.sem, 1, NULL);
|
|
||||||
|
if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime())
|
||||||
|
{
|
||||||
|
ReleaseSemaphore(ddraw->render.sem, 1, NULL);
|
||||||
|
|
||||||
|
if (ddraw->ticksLimiter.ticklength > 0 && !ddraw->ticksLimiter.useBltOrFlip)
|
||||||
|
LimitGameTicks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
@ -1017,15 +1024,17 @@ HRESULT __stdcall ddraw_surface_Unlock(IDirectDrawSurfaceImpl *This, LPVOID lpRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->caps & DDSCAPS_PRIMARYSURFACE &&
|
if ((This->caps & DDSCAPS_PRIMARYSURFACE) && ddraw->render.run)
|
||||||
ddraw->render.run &&
|
|
||||||
(!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime()))
|
|
||||||
{
|
{
|
||||||
InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE);
|
InterlockedExchange(&ddraw->render.surfaceUpdated, TRUE);
|
||||||
ReleaseSemaphore(ddraw->render.sem, 1, NULL);
|
|
||||||
|
|
||||||
if (ddraw->ticksLimiter.ticklength > 0 && !ddraw->ticksLimiter.useBltOrFlip)
|
if (!(This->flags & DDSD_BACKBUFFERCOUNT) || This->lastFlipTick + FLIP_REDRAW_TIMEOUT < timeGetTime())
|
||||||
LimitGameTicks();
|
{
|
||||||
|
ReleaseSemaphore(ddraw->render.sem, 1, NULL);
|
||||||
|
|
||||||
|
if (ddraw->ticksLimiter.ticklength > 0 && !ddraw->ticksLimiter.useBltOrFlip)
|
||||||
|
LimitGameTicks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user