Skip to content

Commit

Permalink
Sync time after pause to avoid replay desync
Browse files Browse the repository at this point in the history
  • Loading branch information
Feodor0090 committed May 15, 2023
1 parent 11ac556 commit 89db69a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/nmania/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 89db69a

Please sign in to comment.