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

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

View File

@ -189,7 +189,7 @@ static void CreateSettingsIni()
"; Note: Works only for games that support 'handlemouse=true'\n"
"boxing=false\n"
"\n"
"; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap (OpenGL / Direct3D only)\n"
"; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
"maxfps=125\n"
"\n"
"; Vertical synchronization, enable if you get tearing (OpenGL / Direct3D only)\n"
@ -222,7 +222,7 @@ static void CreateSettingsIni()
"; Preliminary libretro shader support - e.g. cubic.glsl (OpenGL only) https://github.com/libretro/glsl-shaders\n"
"shader=\n"
"\n"
"; Max game ticks per second, possible values: 1-1000 (Can be used to slow down a too fast running game)\n"
"; Max game ticks per second, possible values: 0-1000 (Can be used to slow down a too fast running game)\n"
"maxgameticks=0\n"
"\n"
"; Gives cnc-ddraw full control over the mouse cursor (required for adjmouse/boxing/maintas)\n"