From f45367583802f595e148947c9335cc8975c09c9a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Apr 2019 10:31:20 +0900 Subject: [PATCH 1/2] Fix replays being parsed with incorrect cultures --- osu.Game/Scoring/Legacy/LegacyScoreParser.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs index 51810945db..969a5bba5a 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Globalization; using System.IO; using System.Linq; using osu.Game.Beatmaps; @@ -232,7 +233,10 @@ namespace osu.Game.Scoring.Legacy if (diff < 0) continue; - replay.Frames.Add(convertFrame(new LegacyReplayFrame(lastTime, float.Parse(split[1]), float.Parse(split[2]), (ReplayButtonState)int.Parse(split[3])))); + replay.Frames.Add(convertFrame(new LegacyReplayFrame(lastTime, + float.Parse(split[1], CultureInfo.InvariantCulture), + float.Parse(split[2], CultureInfo.InvariantCulture), + (ReplayButtonState)int.Parse(split[3])))); } } From fb0bba9b37df499eb03c7953faf47cccd8ab7394 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Apr 2019 11:23:07 +0900 Subject: [PATCH 2/2] Use Parsing helpers --- osu.Game/Scoring/Legacy/LegacyScoreParser.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs index 969a5bba5a..d1649a6098 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs @@ -2,10 +2,10 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Globalization; using System.IO; using System.Linq; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Legacy; using osu.Game.IO.Legacy; using osu.Game.Replays; @@ -225,7 +225,7 @@ namespace osu.Game.Scoring.Legacy continue; } - var diff = float.Parse(split[0]); + var diff = Parsing.ParseFloat(split[0]); lastTime += diff; // Todo: At some point we probably want to rewind and play back the negative-time frames @@ -234,9 +234,9 @@ namespace osu.Game.Scoring.Legacy continue; replay.Frames.Add(convertFrame(new LegacyReplayFrame(lastTime, - float.Parse(split[1], CultureInfo.InvariantCulture), - float.Parse(split[2], CultureInfo.InvariantCulture), - (ReplayButtonState)int.Parse(split[3])))); + Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE), + Parsing.ParseFloat(split[2], Parsing.MAX_COORDINATE_VALUE), + (ReplayButtonState)Parsing.ParseInt(split[3])))); } }