From b477790d3eeb697cd62f99f9da13af746c7f11bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 9 Oct 2025 09:49:48 +0200 Subject: [PATCH] Fix wrong beatmap shown when presenting a beatmap from results screen - Closes https://github.com/ppy/osu/issues/35023. - Supersedes / closes https://github.com/ppy/osu/pull/35107. --- osu.Game/Screens/SelectV2/SongSelect.cs | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index d8fa5fa0a1..e8843876d3 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -43,6 +43,7 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Overlays.Volume; +using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Footer; @@ -63,7 +64,7 @@ namespace osu.Game.Screens.SelectV2 /// This will be gradually built upon and ultimately replace once everything is in place. /// [Cached(typeof(ISongSelect))] - public abstract partial class SongSelect : ScreenWithBeatmapBackground, IKeyBindingHandler, ISongSelect + public abstract partial class SongSelect : ScreenWithBeatmapBackground, IKeyBindingHandler, ISongSelect, IHandlePresentBeatmap { /// /// A debounce that governs how long after a panel is selected before the rest of song select (and the game at large) @@ -1123,6 +1124,36 @@ namespace osu.Game.Screens.SelectV2 #endregion + #region IHandlePresentBeatmap + + void IHandlePresentBeatmap.PresentBeatmap(WorkingBeatmap workingBeatmap, RulesetInfo ruleset) + { + cancelDebounceSelection(); + + var beatmapInfo = workingBeatmap.BeatmapInfo; + + // Don't change the local ruleset if the user is on another ruleset and is showing converted beatmaps. + // Eventually we probably want to check whether conversion is actually possible for the current ruleset. + bool requiresRulesetSwitch = !beatmapInfo.Ruleset.Equals(Ruleset.Value) + && (beatmapInfo.Ruleset.OnlineID > 0 || !showConvertedBeatmaps.Value); + + if (requiresRulesetSwitch) + { + Ruleset.Value = beatmapInfo.Ruleset; + Beatmap.Value = workingBeatmap; + + Logger.Log($"Completing {nameof(IHandlePresentBeatmap.PresentBeatmap)} with beatmap {workingBeatmap} ruleset {beatmapInfo.Ruleset}"); + } + else + { + Beatmap.Value = workingBeatmap; + + Logger.Log($"Completing {nameof(IHandlePresentBeatmap.PresentBeatmap)} with beatmap {workingBeatmap} (maintaining ruleset)"); + } + } + + #endregion + #region Beatmap management [Resolved]