1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Fix negative replay frames being played back incorrectly

This commit is contained in:
Dean Herbert 2020-01-30 14:54:57 +09:00
parent 2beb10b860
commit 7b4a658264

View File

@ -220,9 +220,11 @@ namespace osu.Game.Scoring.Legacy
float lastTime = 0;
ReplayFrame currentFrame = null;
foreach (var l in reader.ReadToEnd().Split(','))
var frames = reader.ReadToEnd().Split(',');
for (var i = 0; i < frames.Length; i++)
{
var split = l.Split('|');
var split = frames[i].Split('|');
if (split.Length < 4)
continue;
@ -234,8 +236,14 @@ namespace osu.Game.Scoring.Legacy
}
var diff = Parsing.ParseFloat(split[0]);
lastTime += diff;
if (i == 0 && diff == 0)
// osu-stable adds a zero-time frame before potentially valid negative user frames.
// we need to ignroe this.
continue;
// Todo: At some point we probably want to rewind and play back the negative-time frames
// but for now we'll achieve equal playback to stable by skipping negative frames
if (diff < 0)