From 3671fa1991e863b3aef67e670326d948ba41e0d2 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 26 Jun 2018 00:24:57 -0300 Subject: [PATCH] A little bit less naive limiter --- Ryujinx/Ui/GLScreen.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 67cea2c6b..cada3c5ac 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -51,19 +51,25 @@ namespace Ryujinx long TicksPerFrame = Stopwatch.Frequency / 60; + long Ticks = 0; + while (Exists && !IsExiting) { ProcessEvents(); if (!IsExiting) { - if (Chrono.ElapsedTicks > TicksPerFrame) - { - UpdateFrame(); + UpdateFrame(); + Ticks += Chrono.ElapsedTicks; + + Chrono.Restart(); + + if (Ticks > TicksPerFrame) + { RenderFrame(); - Chrono.Restart(); + Ticks -= TicksPerFrame; } } }