1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 01:27:20 +08:00

Fix some legacy mania replays crashing on import

This commit is contained in:
Bartłomiej Dach 2020-08-27 17:40:22 +02:00
parent 9d70b4af09
commit fc51e9d81a

View File

@ -241,12 +241,15 @@ namespace osu.Game.Scoring.Legacy
} }
var diff = Parsing.ParseFloat(split[0]); var diff = Parsing.ParseFloat(split[0]);
var mouseX = Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE);
var mouseY = Parsing.ParseFloat(split[2], Parsing.MAX_COORDINATE_VALUE);
lastTime += diff; lastTime += diff;
if (i == 0 && diff == 0) if (i < 2 && mouseX == 256 && mouseY == -500)
// osu-stable adds a zero-time frame before potentially valid negative user frames. // at the start of the replay, stable places two replay frames, at time 0 and SkipBoundary - 1, respectively.
// we need to ignore this. // both frames use a position of (256, -500).
// ignore these frames as they serve no real purpose (and can even mislead ruleset-specific handlers - see mania)
continue; continue;
// Todo: At some point we probably want to rewind and play back the negative-time frames // Todo: At some point we probably want to rewind and play back the negative-time frames
@ -255,8 +258,8 @@ namespace osu.Game.Scoring.Legacy
continue; continue;
currentFrame = convertFrame(new LegacyReplayFrame(lastTime, currentFrame = convertFrame(new LegacyReplayFrame(lastTime,
Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE), mouseX,
Parsing.ParseFloat(split[2], Parsing.MAX_COORDINATE_VALUE), mouseY,
(ReplayButtonState)Parsing.ParseInt(split[3])), currentFrame); (ReplayButtonState)Parsing.ParseInt(split[3])), currentFrame);
replay.Frames.Add(currentFrame); replay.Frames.Add(currentFrame);