mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 16:32:54 +08:00
Fix score encoder being dependent on current culture
As it turns out, on some cultures, the "negative integer" sign is not encoded using the U+002D HYPHEN-MINUS codepoint. For instance, Swedish uses U+2212 MINUS SIGN instead. This was confusing the legacy decoder, since it is correctly depending on the serialisation being culture-independent. To fix, ensure that the special "end replay" frame, as well as the replay MD5 hash, are generated in a culture-invariant manner. Thankfully the replay MD5 hash is currently being discarded in `LegacyScoreDecoder`, so it changing in future scores should not have any negative effect on lazer operation.
This commit is contained in:
parent
ea6766d940
commit
f051720fa1
@ -46,7 +46,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
sw.Write(LATEST_VERSION);
|
||||
sw.Write(score.ScoreInfo.BeatmapInfo.MD5Hash);
|
||||
sw.Write(score.ScoreInfo.UserString);
|
||||
sw.Write($"lazer-{score.ScoreInfo.UserString}-{score.ScoreInfo.Date}".ComputeMD5Hash());
|
||||
sw.Write(FormattableString.Invariant($"lazer-{score.ScoreInfo.UserString}-{score.ScoreInfo.Date}").ComputeMD5Hash());
|
||||
sw.Write((ushort)(score.ScoreInfo.GetCount300() ?? 0));
|
||||
sw.Write((ushort)(score.ScoreInfo.GetCount100() ?? 0));
|
||||
sw.Write((ushort)(score.ScoreInfo.GetCount50() ?? 0));
|
||||
@ -110,7 +110,9 @@ namespace osu.Game.Scoring.Legacy
|
||||
}
|
||||
}
|
||||
|
||||
replayData.AppendFormat(@"{0}|{1}|{2}|{3},", -12345, 0, 0, 0);
|
||||
// Warning: this is purposefully hardcoded as a string rather than interpolating, as in some cultures the minus sign is not encoded as the standard ASCII U+00C2 codepoint,
|
||||
// which then would break decoding.
|
||||
replayData.Append(@"-12345|0|0|0");
|
||||
return replayData.ToString();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user