From 4b70c903e201b90522da9df07ca296894143f0ca Mon Sep 17 00:00:00 2001 From: Vudjun Date: Tue, 19 Nov 2024 18:28:08 +0000 Subject: [PATCH] Attempt to fix networked games becoming out of sync by increasing tick remainder to 30 frames. Also adds a warning if this is exceeded. --- .../HOS/Services/SurfaceFlinger/SurfaceFlinger.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs index 4c17e7aed..1441e35c2 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs @@ -329,8 +329,13 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger _device.System?.SignalVsync(); - // Apply a maximum bound of 3 frames to the tick remainder, in case some event causes Ryujinx to pause for a long time or messes with the timer. - _ticks = Math.Min(_ticks - _ticksPerFrame, _ticksPerFrame * 3); + // Apply a maximum bound of 30 frames to the tick remainder, in case some event causes Ryujinx to pause for a long time or messes with the timer. + _ticks -= _ticksPerFrame; + if (_ticks > _ticksPerFrame * 30) + { + _ticks = _ticksPerFrame * 30; + Logger.Warning?.Print(LogClass.SurfaceFlinger, "Frame tick remainder exceeded maximum bound, resetting."); + } } // Sleep if possible. If the time til the next frame is too low, spin wait instead. -- 2.47.1