From f3a006ff77466fbc7d4bd4e9e6619d25185d14e4 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Thu, 29 Aug 2019 20:59:11 +0300 Subject: [PATCH] Fix the mistake in FPS limiter --- source-code/source/plugins/Render/dllmain.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source-code/source/plugins/Render/dllmain.cpp b/source-code/source/plugins/Render/dllmain.cpp index 0e670ea..25a5fa0 100644 --- a/source-code/source/plugins/Render/dllmain.cpp +++ b/source-code/source/plugins/Render/dllmain.cpp @@ -100,12 +100,13 @@ microseconds expectedFrameDuration(1000000 / nFpsLimit); __int64 __fastcall hookedEngineUpdate(__int64 a1) { - if (high_resolution_clock::now() < nextUpdate) + const auto beforeUpdate = high_resolution_clock::now(); + if (beforeUpdate < nextUpdate) return 0; const auto result = divaEngineUpdate(a1); - nextUpdate = high_resolution_clock::now() + expectedFrameDuration; + nextUpdate = beforeUpdate + expectedFrameDuration; return result; }