From 89db69a9684e5f82b01f4f800dce150f5e68a738 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Tue, 16 May 2023 02:09:28 +0300 Subject: [PATCH] Sync time after pause to avoid replay desync --- src/nmania/Player.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/nmania/Player.java b/src/nmania/Player.java index 0120307..382c477 100644 --- a/src/nmania/Player.java +++ b/src/nmania/Player.java @@ -701,6 +701,15 @@ public final void Loop() { while (running) { // TODO optimize all this shit framesPassed++; + + // process pause BEFORE time refresh to avoid desync due to shitty MMAPI + // implementations + if (isPaused) { + PauseUpdateLoop(); + GL.Log("(player) Player returned from pause loop."); + time = track.Now(); + } + // sync int prevtime = time; time = track.Now(); @@ -709,11 +718,6 @@ public final void Loop() { time = input.UpdatePlayer(this, time); } - if (isPaused) { - PauseUpdateLoop(); - GL.Log("(player) Player returned from pause loop."); - time = track.Now(); - } // "quit" button in pause if (exitNow) { QuitFromPauseSequence();