1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

allow to disable all game speed limiters

This commit is contained in:
FunkyFr3sh 2020-10-06 04:28:18 +02:00
parent 2c629cbe55
commit 475955d8ef
2 changed files with 15 additions and 12 deletions

View File

@ -1752,13 +1752,14 @@ HRESULT __stdcall ddraw_WaitForVerticalBlank(IDirectDrawImpl *This, DWORD dwFlag
#if _DEBUG_X #if _DEBUG_X
printf("DirectDraw::WaitForVerticalBlank(This=%p, flags=%08X, handle=%p)\n", This, dwFlags, h); printf("DirectDraw::WaitForVerticalBlank(This=%p, flags=%08X, handle=%p)\n", This, dwFlags, h);
#endif #endif
if (!ddraw->flipLimiter.ticklength)
FILETIME lastFlipFT = { 0 }; return DD_OK;
if (ddraw->flipLimiter.hTimer)
GetSystemTimeAsFileTime(&lastFlipFT);
if (ddraw->flipLimiter.hTimer) if (ddraw->flipLimiter.hTimer)
{ {
FILETIME lastFlipFT = { 0 };
GetSystemTimeAsFileTime(&lastFlipFT);
if (!ddraw->flipLimiter.dueTime.QuadPart) if (!ddraw->flipLimiter.dueTime.QuadPart)
{ {
memcpy(&ddraw->flipLimiter.dueTime, &lastFlipFT, sizeof(LARGE_INTEGER)); memcpy(&ddraw->flipLimiter.dueTime, &lastFlipFT, sizeof(LARGE_INTEGER));

View File

@ -78,14 +78,16 @@ void Settings_Load()
ddraw->ticksLimiter.ticklength = len + 0.5f; ddraw->ticksLimiter.ticklength = len + 0.5f;
} }
//always using 60 fps for flip... if (maxTicks >= 0)
if (ddraw->accurateTimers) {
ddraw->flipLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL); //always using 60 fps for flip...
if (ddraw->accurateTimers)
float flipLen = 1000.0f / 60; ddraw->flipLimiter.hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
ddraw->flipLimiter.tickLengthNs = flipLen * 10000;
ddraw->flipLimiter.ticklength = flipLen + 0.5f;
float flipLen = 1000.0f / 60;
ddraw->flipLimiter.tickLengthNs = flipLen * 10000;
ddraw->flipLimiter.ticklength = flipLen + 0.5f;
}
if ((ddraw->fullscreen = GetBool("fullscreen", FALSE))) if ((ddraw->fullscreen = GetBool("fullscreen", FALSE)))
WindowRect.left = WindowRect.top = -32000; WindowRect.left = WindowRect.top = -32000;
@ -277,7 +279,7 @@ static void CreateSettingsIni()
"; Hide WM_ACTIVATEAPP messages to prevent problems on alt+tab\n" "; Hide WM_ACTIVATEAPP messages to prevent problems on alt+tab\n"
"noactivateapp=false\n" "noactivateapp=false\n"
"\n" "\n"
"; Max game ticks per second, possible values: 0-1000\n" "; Max game ticks per second, possible values: -1 = disabled, 0 = emulate 60hz vblank, 1-1000 = custom game speed\n"
"; Note: Can be used to slow down a too fast running game, fix flickering or too fast animations\n" "; Note: Can be used to slow down a too fast running game, fix flickering or too fast animations\n"
"maxgameticks=0\n" "maxgameticks=0\n"
"\n" "\n"