fix gdi renderer so it also works games other than cnc1 and ra1

This commit is contained in:
FunkyFr3sh 2018-11-20 13:52:19 +01:00
parent fb9db0896f
commit 98ec61d79b
2 changed files with 26 additions and 2 deletions

View file

@ -40,8 +40,32 @@ DWORD WINAPI render_soft_main(void)
else
Sleep(500);
int maxFPS = ddraw->render.maxfps;
DWORD frameLength = 0;
DWORD lastTick = 0;
if (maxFPS < 0)
maxFPS = ddraw->mode.dmDisplayFrequency;
if (maxFPS >= 1000)
maxFPS = 0;
if (maxFPS > 0)
frameLength = 1000.0f / maxFPS;
while (ddraw->render.run && WaitForSingleObject(ddraw->render.sem, INFINITE) != WAIT_FAILED)
{
if (maxFPS > 0)
{
DWORD curTick = timeGetTime();
if (lastTick + frameLength > curTick)
{
SetEvent(ddraw->render.ev);
continue;
}
lastTick = curTick;
}
#if _DEBUG
DrawFrameInfoStart();
#endif