Skip to content

Commit 4b66584

Browse files
authored
Merge pull request #33612 from bdach/stable-scores-with-zero-legacy-id
Fix stable scores importing with a `LegacyOnlineID` of 0
2 parents f1e2359 + d4fc669 commit 4b66584

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

osu.Game/Database/RealmAccess.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ public class RealmAccess : IDisposable
9898
/// 46 2024-12-26 Change beat snap divisor bindings to match stable directionality ¯\_(ツ)_/¯.
9999
/// 47 2025-01-21 Remove right mouse button binding for absolute scroll. Never use mouse buttons (or scroll) for global actions.
100100
/// 48 2025-03-19 Clear online status for all qualified beatmaps (some were stuck in a qualified state due to local caching issues).
101+
/// 49 2025-06-10 Reset the LegacyOnlineID to -1 for all scores that have it set to 0 (which is semantically the same) for consistency of handling with OnlineID.
101102
/// </summary>
102-
private const int schema_version = 48;
103+
private const int schema_version = 49;
103104

104105
/// <summary>
105106
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
@@ -1255,6 +1256,12 @@ void remapKeyBinding(int oldAction, int newAction)
12551256
foreach (var beatmap in beatmaps)
12561257
beatmap.ResetOnlineInfo(resetOnlineId: false);
12571258
break;
1259+
1260+
case 49:
1261+
foreach (var score in migration.NewRealm.All<ScoreInfo>().Where(s => s.LegacyOnlineID == 0))
1262+
score.LegacyOnlineID = -1;
1263+
1264+
break;
12581265
}
12591266

12601267
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");

osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public Score Parse(Stream stream)
110110
else if (version >= 20121008)
111111
scoreInfo.LegacyOnlineID = sr.ReadInt32();
112112

113+
if (scoreInfo.LegacyOnlineID == 0)
114+
scoreInfo.LegacyOnlineID = -1;
115+
113116
byte[] compressedScoreInfo = null;
114117

115118
if (version >= 30000001)

0 commit comments

Comments
 (0)