From 5febd40bd9910f73e65d4bf37b08069833828e7d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 22:30:39 +0900 Subject: [PATCH 1/9] Add HP and AR to LegacyBeatmapConversionDifficultyInfo --- .../LegacyBeatmapConversionDifficultyInfo.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/Legacy/LegacyBeatmapConversionDifficultyInfo.cs b/osu.Game/Rulesets/Scoring/Legacy/LegacyBeatmapConversionDifficultyInfo.cs index 7d69069455..f8b8567305 100644 --- a/osu.Game/Rulesets/Scoring/Legacy/LegacyBeatmapConversionDifficultyInfo.cs +++ b/osu.Game/Rulesets/Scoring/Legacy/LegacyBeatmapConversionDifficultyInfo.cs @@ -18,6 +18,16 @@ namespace osu.Game.Rulesets.Scoring.Legacy /// public IRulesetInfo SourceRuleset { get; set; } = new RulesetInfo(); + /// + /// The beatmap drain rate. + /// + public float DrainRate { get; set; } + + /// + /// The beatmap approach rate. + /// + public float ApproachRate { get; set; } + /// /// The beatmap circle size. /// @@ -41,8 +51,6 @@ namespace osu.Game.Rulesets.Scoring.Legacy /// public int TotalObjectCount { get; set; } - float IBeatmapDifficultyInfo.DrainRate => 0; - float IBeatmapDifficultyInfo.ApproachRate => 0; double IBeatmapDifficultyInfo.SliderMultiplier => 0; double IBeatmapDifficultyInfo.SliderTickRate => 0; @@ -51,6 +59,8 @@ namespace osu.Game.Rulesets.Scoring.Legacy public static LegacyBeatmapConversionDifficultyInfo FromBeatmap(IBeatmap beatmap) => new LegacyBeatmapConversionDifficultyInfo { SourceRuleset = beatmap.BeatmapInfo.Ruleset, + DrainRate = beatmap.Difficulty.DrainRate, + ApproachRate = beatmap.Difficulty.ApproachRate, CircleSize = beatmap.Difficulty.CircleSize, OverallDifficulty = beatmap.Difficulty.OverallDifficulty, EndTimeObjectCount = beatmap.HitObjects.Count(h => h is IHasDuration), @@ -60,6 +70,8 @@ namespace osu.Game.Rulesets.Scoring.Legacy public static LegacyBeatmapConversionDifficultyInfo FromBeatmapInfo(IBeatmapInfo beatmapInfo) => new LegacyBeatmapConversionDifficultyInfo { SourceRuleset = beatmapInfo.Ruleset, + DrainRate = beatmapInfo.Difficulty.DrainRate, + ApproachRate = beatmapInfo.Difficulty.ApproachRate, CircleSize = beatmapInfo.Difficulty.CircleSize, OverallDifficulty = beatmapInfo.Difficulty.OverallDifficulty, EndTimeObjectCount = beatmapInfo.EndTimeObjectCount, From 64399e9dd9841b7062e5f218c688424440c00b65 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 22:32:27 +0900 Subject: [PATCH 2/9] Refactor pattern generation to not require ManiaBeatmap --- .../Beatmaps/ManiaBeatmapConverter.cs | 30 ++++++++++++++----- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +-- .../Legacy/HitObjectPatternGenerator.cs | 6 ++-- .../Legacy/PathObjectPatternGenerator.cs | 4 +-- .../Patterns/Legacy/PatternGenerator.cs | 22 +++++--------- .../Beatmaps/Patterns/PatternGenerator.cs | 8 ++--- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index def22608d6..cc975c7def 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -27,8 +27,24 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// private const int max_notes_for_density = 7; + /// + /// The total number of columns. + /// + public int TotalColumns => TargetColumns * (Dual ? 2 : 1); + + /// + /// The number of columns per-stage. + /// public int TargetColumns; + + /// + /// Whether to double the number of stages. + /// public bool Dual; + + /// + /// Whether the beatmap instantiated with is for the mania ruleset. + /// public readonly bool IsForCurrentRuleset; private readonly int originalTargetColumns; @@ -152,7 +168,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// The hit objects generated. private IEnumerable generateSpecific(HitObject original, IBeatmap originalBeatmap) { - var generator = new SpecificBeatmapPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); + var generator = new SpecificBeatmapPatternGenerator(Random, original, originalBeatmap, TotalColumns, lastPattern); foreach (var newPattern in generator.Generate()) { @@ -171,13 +187,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// The hit objects generated. private IEnumerable generateConverted(HitObject original, IBeatmap originalBeatmap) { - Patterns.PatternGenerator conversion = null; + Patterns.PatternGenerator? conversion = null; switch (original) { case IHasPath: { - var generator = new PathObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); + var generator = new PathObjectPatternGenerator(Random, original, originalBeatmap, TotalColumns, lastPattern); conversion = generator; var positionData = original as IHasPosition; @@ -195,7 +211,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps case IHasDuration endTimeData: { - conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); + conversion = new EndTimeObjectPatternGenerator(Random, original, originalBeatmap, TotalColumns, lastPattern); recordNote(endTimeData.EndTime, new Vector2(256, 192)); computeDensity(endTimeData.EndTime); @@ -206,7 +222,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { computeDensity(original.StartTime); - conversion = new HitObjectPatternGenerator(Random, original, beatmap, lastPattern, lastTime, lastPosition, density, lastStair, originalBeatmap); + conversion = new HitObjectPatternGenerator(Random, original, originalBeatmap, TotalColumns, lastPattern, lastTime, lastPosition, density, lastStair); recordNote(original.StartTime, positionData.Position); break; @@ -231,8 +247,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// private class SpecificBeatmapPatternGenerator : Patterns.Legacy.PatternGenerator { - public SpecificBeatmapPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) - : base(random, hitObject, beatmap, previousPattern, originalBeatmap) + public SpecificBeatmapPatternGenerator(LegacyRandom random, HitObject hitObject, IBeatmap beatmap, int totalColumns, Pattern previousPattern) + : base(random, hitObject, beatmap, previousPattern, totalColumns) { } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 2265d3d347..52bb87ae19 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -17,8 +17,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly int endTime; private readonly PatternType convertType; - public EndTimeObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) - : base(random, hitObject, beatmap, previousPattern, originalBeatmap) + public EndTimeObjectPatternGenerator(LegacyRandom random, HitObject hitObject, IBeatmap beatmap, int totalColumns, Pattern previousPattern) + : base(random, hitObject, beatmap, previousPattern, totalColumns) { endTime = (int)((HitObject as IHasDuration)?.EndTime ?? 0); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 27cb681300..ad45a3fb21 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -23,9 +23,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly PatternType convertType; - public HitObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, - PatternType lastStair, IBeatmap originalBeatmap) - : base(random, hitObject, beatmap, previousPattern, originalBeatmap) + public HitObjectPatternGenerator(LegacyRandom random, HitObject hitObject, IBeatmap beatmap, int totalColumns, Pattern previousPattern, double previousTime, Vector2 previousPosition, + double density, PatternType lastStair) + : base(random, hitObject, beatmap, previousPattern, totalColumns) { StairType = lastStair; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PathObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PathObjectPatternGenerator.cs index 4922915c7d..6d593a75e7 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PathObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PathObjectPatternGenerator.cs @@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private PatternType convertType; - public PathObjectPatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) - : base(random, hitObject, beatmap, previousPattern, originalBeatmap) + public PathObjectPatternGenerator(LegacyRandom random, HitObject hitObject, IBeatmap beatmap, int totalColumns, Pattern previousPattern) + : base(random, hitObject, beatmap, previousPattern, totalColumns) { convertType = PatternType.None; if (!Beatmap.ControlPointInfo.EffectPointAt(hitObject.StartTime).KiaiMode) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 77f93b4ef9..48b8778501 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -27,20 +27,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// protected readonly LegacyRandom Random; - /// - /// The beatmap which is being converted from. - /// - protected readonly IBeatmap OriginalBeatmap; - - protected PatternGenerator(LegacyRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, IBeatmap originalBeatmap) - : base(hitObject, beatmap, previousPattern) + protected PatternGenerator(LegacyRandom random, HitObject hitObject, IBeatmap beatmap, Pattern previousPattern, int totalColumns) + : base(hitObject, beatmap, totalColumns, previousPattern) { ArgumentNullException.ThrowIfNull(random); - ArgumentNullException.ThrowIfNull(originalBeatmap); Random = random; - OriginalBeatmap = originalBeatmap; - RandomStart = TotalColumns == 8 ? 1 : 0; } @@ -104,17 +96,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (conversionDifficulty != null) return conversionDifficulty.Value; - HitObject lastObject = OriginalBeatmap.HitObjects.LastOrDefault(); - HitObject firstObject = OriginalBeatmap.HitObjects.FirstOrDefault(); + HitObject lastObject = Beatmap.HitObjects.LastOrDefault(); + HitObject firstObject = Beatmap.HitObjects.FirstOrDefault(); // Drain time in seconds - int drainTime = (int)(((lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0) - OriginalBeatmap.TotalBreakTime) / 1000); + int drainTime = (int)(((lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0) - Beatmap.TotalBreakTime) / 1000); if (drainTime == 0) drainTime = 10000; - IBeatmapDifficultyInfo difficulty = OriginalBeatmap.Difficulty; - conversionDifficulty = ((difficulty.DrainRate + Math.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count / drainTime * 9f) / 38f * 5f / 1.15; + IBeatmapDifficultyInfo difficulty = Beatmap.Difficulty; + conversionDifficulty = ((difficulty.DrainRate + Math.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)Beatmap.HitObjects.Count / drainTime * 9f) / 38f * 5f / 1.15; conversionDifficulty = Math.Min(conversionDifficulty.Value, 12); return conversionDifficulty.Value; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 3d3c35773b..8d98515fa4 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns @@ -25,11 +26,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns /// /// The beatmap which is a part of. /// - protected readonly ManiaBeatmap Beatmap; + protected readonly IBeatmap Beatmap; protected readonly int TotalColumns; - protected PatternGenerator(HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern) + protected PatternGenerator(HitObject hitObject, IBeatmap beatmap, int totalColumns, Pattern previousPattern) { ArgumentNullException.ThrowIfNull(hitObject); ArgumentNullException.ThrowIfNull(beatmap); @@ -38,8 +39,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns HitObject = hitObject; Beatmap = beatmap; PreviousPattern = previousPattern; - - TotalColumns = Beatmap.TotalColumns; + TotalColumns = totalColumns; } /// From 10edb5461490568a06f43c443dc6cc7f19b14c8a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 22:39:15 +0900 Subject: [PATCH 3/9] Add ability to query key count with mods --- .../Beatmaps/ManiaBeatmapConverter.cs | 93 ++++++++++--------- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 4 +- osu.Game/Rulesets/ILegacyRuleset.cs | 5 +- .../Carousel/DrawableCarouselBeatmap.cs | 7 +- .../Screens/Select/Details/AdvancedStats.cs | 2 +- 5 files changed, 61 insertions(+), 50 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index cc975c7def..8b339239a0 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Game.Rulesets.Mania.Objects; using System; using System.Linq; @@ -14,6 +12,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Mania.Beatmaps.Patterns; using osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring.Legacy; using osu.Game.Utils; using osuTK; @@ -50,17 +49,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private readonly int originalTargetColumns; // Internal for testing purposes - internal LegacyRandom Random { get; private set; } + internal readonly LegacyRandom Random; private Pattern lastPattern = new Pattern(); - private ManiaBeatmap beatmap; - public ManiaBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) - : base(beatmap, ruleset) + : this(beatmap, LegacyBeatmapConversionDifficultyInfo.FromBeatmap(beatmap), ruleset) { - IsForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo); - TargetColumns = GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmap(beatmap)); + } + + private ManiaBeatmapConverter(IBeatmap? beatmap, LegacyBeatmapConversionDifficultyInfo difficulty, Ruleset ruleset) + : base(beatmap!, ruleset) + { + IsForCurrentRuleset = difficulty.SourceRuleset.Equals(ruleset.RulesetInfo); + Random = new LegacyRandom((int)MathF.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)MathF.Round(difficulty.ApproachRate)); + TargetColumns = getColumnCount(difficulty); if (IsForCurrentRuleset && TargetColumns > ManiaRuleset.MAX_STAGE_KEYS) { @@ -69,51 +72,57 @@ namespace osu.Game.Rulesets.Mania.Beatmaps } originalTargetColumns = TargetColumns; + + static int getColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty) + { + double roundedCircleSize = Math.Round(difficulty.CircleSize); + + if (difficulty.SourceRuleset.ShortName == ManiaRuleset.SHORT_NAME) + return (int)Math.Max(1, roundedCircleSize); + + double roundedOverallDifficulty = Math.Round(difficulty.OverallDifficulty); + + if (difficulty.TotalObjectCount > 0 && difficulty.EndTimeObjectCount >= 0) + { + int countSliderOrSpinner = difficulty.EndTimeObjectCount; + + // In osu!stable, this division appears as if it happens on floats, but due to release-mode + // optimisations, it actually ends up happening on doubles. + double percentSpecialObjects = (double)countSliderOrSpinner / difficulty.TotalObjectCount; + + if (percentSpecialObjects < 0.2) + return 7; + if (percentSpecialObjects < 0.3 || roundedCircleSize >= 5) + return roundedOverallDifficulty > 5 ? 7 : 6; + if (percentSpecialObjects > 0.6) + return roundedOverallDifficulty > 4 ? 5 : 4; + } + + return Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7)); + } } - public static int GetColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty) + public static int GetColumnCount(IBeatmapInfo beatmapInfo, IReadOnlyList? mods = null) + => GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), mods); + + public static int GetColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty, IReadOnlyList? mods = null) { - double roundedCircleSize = Math.Round(difficulty.CircleSize); + var converter = new ManiaBeatmapConverter(null, difficulty, new ManiaRuleset()); - if (difficulty.SourceRuleset.ShortName == ManiaRuleset.SHORT_NAME) - return (int)Math.Max(1, roundedCircleSize); - - double roundedOverallDifficulty = Math.Round(difficulty.OverallDifficulty); - - if (difficulty.TotalObjectCount > 0 && difficulty.EndTimeObjectCount >= 0) + if (mods != null) { - int countSliderOrSpinner = difficulty.EndTimeObjectCount; - - // In osu!stable, this division appears as if it happens on floats, but due to release-mode - // optimisations, it actually ends up happening on doubles. - double percentSpecialObjects = (double)countSliderOrSpinner / difficulty.TotalObjectCount; - - if (percentSpecialObjects < 0.2) - return 7; - if (percentSpecialObjects < 0.3 || roundedCircleSize >= 5) - return roundedOverallDifficulty > 5 ? 7 : 6; - if (percentSpecialObjects > 0.6) - return roundedOverallDifficulty > 4 ? 5 : 4; + foreach (var m in mods.OfType()) + m.ApplyToBeatmapConverter(converter); } - return Math.Max(4, Math.Min((int)roundedOverallDifficulty + 1, 7)); + return converter.TotalColumns; } public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasXPosition); - protected override Beatmap ConvertBeatmap(IBeatmap original, CancellationToken cancellationToken) - { - IBeatmapDifficultyInfo difficulty = original.Difficulty; - - int seed = (int)MathF.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)MathF.Round(difficulty.ApproachRate); - Random = new LegacyRandom(seed); - - return base.ConvertBeatmap(original, cancellationToken); - } - protected override Beatmap CreateBeatmap() { - beatmap = new ManiaBeatmap(new StageDefinition(TargetColumns), originalTargetColumns); + ManiaBeatmap beatmap = new ManiaBeatmap(new StageDefinition(TargetColumns), originalTargetColumns); if (Dual) beatmap.Stages.Add(new StageDefinition(TargetColumns)); @@ -131,10 +140,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps } var objects = IsForCurrentRuleset ? generateSpecific(original, beatmap) : generateConverted(original, beatmap); - - if (objects == null) - yield break; - foreach (ManiaHitObject obj in objects) yield return obj; } diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 3d4803f1e4..77168dca68 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -423,8 +423,8 @@ namespace osu.Game.Rulesets.Mania public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection(); - public int GetKeyCount(IBeatmapInfo beatmapInfo) - => ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo)); + public int GetKeyCount(IBeatmapInfo beatmapInfo, IReadOnlyList? mods = null) + => ManiaBeatmapConverter.GetColumnCount(beatmapInfo, mods); } public enum PlayfieldType diff --git a/osu.Game/Rulesets/ILegacyRuleset.cs b/osu.Game/Rulesets/ILegacyRuleset.cs index 18d86f477a..e116f7a1a3 100644 --- a/osu.Game/Rulesets/ILegacyRuleset.cs +++ b/osu.Game/Rulesets/ILegacyRuleset.cs @@ -1,7 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring.Legacy; namespace osu.Game.Rulesets @@ -18,8 +20,7 @@ namespace osu.Game.Rulesets /// /// Retrieves the number of mania keys required to play the beatmap. /// - /// - int GetKeyCount(IBeatmapInfo beatmapInfo) => 0; + int GetKeyCount(IBeatmapInfo beatmapInfo, IReadOnlyList? mods = null) => 0; ILegacyScoreSimulator CreateLegacyScoreSimulator(); } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 01e58d4ab2..2752beb645 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -28,6 +28,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osuTK; using osuTK.Graphics; @@ -75,6 +76,9 @@ namespace osu.Game.Screens.Select.Carousel [Resolved] private IBindable ruleset { get; set; } = null!; + [Resolved] + private IBindable>? mods { get; set; } = null!; + private IBindable starDifficultyBindable = null!; private CancellationTokenSource? starDifficultyCancellationSource; @@ -185,6 +189,7 @@ namespace osu.Game.Screens.Select.Carousel base.LoadComplete(); ruleset.BindValueChanged(_ => updateKeyCount()); + mods?.BindValueChanged(_ => updateKeyCount()); } protected override void Selected() @@ -255,7 +260,7 @@ namespace osu.Game.Screens.Select.Carousel ILegacyRuleset legacyRuleset = (ILegacyRuleset)ruleset.Value.CreateInstance(); keyCountText.Alpha = 1; - keyCountText.Text = $"[{legacyRuleset.GetKeyCount(beatmapInfo)}K]"; + keyCountText.Text = $"[{legacyRuleset.GetKeyCount(beatmapInfo, mods?.Value)}K]"; } else keyCountText.Alpha = 0; diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 1aba977f44..cb820f4da9 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -199,7 +199,7 @@ namespace osu.Game.Screens.Select.Details // For the time being, the key count is static no matter what, because: // a) The method doesn't have knowledge of the active keymods. Doing so may require considerations for filtering. // b) Using the difficulty adjustment mod to adjust OD doesn't have an effect on conversion. - int keyCount = baseDifficulty == null ? 0 : legacyRuleset.GetKeyCount(BeatmapInfo); + int keyCount = baseDifficulty == null ? 0 : legacyRuleset.GetKeyCount(BeatmapInfo, mods.Value); FirstValue.Title = BeatmapsetsStrings.ShowStatsCsMania; FirstValue.Value = (keyCount, keyCount); From ce21235db495bb10e0f49763b7351f4f70fa51b3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 22:47:43 +0900 Subject: [PATCH 4/9] Remove unused OriginalTargetColumns --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs | 6 ------ osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 6 +----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs index 28cdf8907e..8222e5477d 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmap.cs @@ -22,11 +22,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// public int TotalColumns => Stages.Sum(g => g.Columns); - /// - /// The total number of columns that were present in this before any user adjustments. - /// - public readonly int OriginalTotalColumns; - /// /// Creates a new . /// @@ -35,7 +30,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps public ManiaBeatmap(StageDefinition defaultStage, int? originalTotalColumns = null) { Stages.Add(defaultStage); - OriginalTotalColumns = originalTotalColumns ?? defaultStage.Columns; } public override IEnumerable GetStatistics() diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 8b339239a0..bed04a882f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -46,8 +46,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// public readonly bool IsForCurrentRuleset; - private readonly int originalTargetColumns; - // Internal for testing purposes internal readonly LegacyRandom Random; @@ -71,8 +69,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps Dual = true; } - originalTargetColumns = TargetColumns; - static int getColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty) { double roundedCircleSize = Math.Round(difficulty.CircleSize); @@ -122,7 +118,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps protected override Beatmap CreateBeatmap() { - ManiaBeatmap beatmap = new ManiaBeatmap(new StageDefinition(TargetColumns), originalTargetColumns); + ManiaBeatmap beatmap = new ManiaBeatmap(new StageDefinition(TargetColumns)); if (Dual) beatmap.Stages.Add(new StageDefinition(TargetColumns)); From c08a4898b27347201d63200d162718ddaf874068 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 22:58:39 +0900 Subject: [PATCH 5/9] Refactor score simulator to use GetColumnCount() --- .../Difficulty/ManiaLegacyScoreSimulator.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyScoreSimulator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyScoreSimulator.cs index d9fd96ac6a..8a1b127265 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyScoreSimulator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyScoreSimulator.cs @@ -51,13 +51,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty return multiplier; // Apply key mod multipliers. - int originalColumns = ManiaBeatmapConverter.GetColumnCount(difficulty); - int actualColumns = originalColumns; - - actualColumns = mods.OfType().SingleOrDefault()?.KeyCount ?? actualColumns; - if (mods.Any(m => m is ManiaModDualStages)) - actualColumns *= 2; + int actualColumns = ManiaBeatmapConverter.GetColumnCount(difficulty, mods); if (actualColumns > originalColumns) multiplier *= 0.9; From 9fd6449fd8b7c8b7a9019d1d3a25cb46a5b5562c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 23:02:25 +0900 Subject: [PATCH 6/9] Add mods to FilterCriteria, pass to ruleset method --- osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs | 5 ++--- .../NonVisual/Filtering/FilterMatchingTest.cs | 2 +- .../NonVisual/Filtering/FilterQueryParserTest.cs | 2 +- osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs | 3 ++- osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs | 2 +- .../Select/Carousel/DrawableCarouselBeatmap.cs | 6 +++--- osu.Game/Screens/Select/FilterControl.cs | 13 ++++++++++--- osu.Game/Screens/Select/FilterCriteria.cs | 2 ++ 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs index 930ca217cd..07ed3ebd63 100644 --- a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs +++ b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs @@ -4,7 +4,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Mania.Beatmaps; -using osu.Game.Rulesets.Scoring.Legacy; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -14,9 +13,9 @@ namespace osu.Game.Rulesets.Mania { private FilterCriteria.OptionalRange keys; - public bool Matches(BeatmapInfo beatmapInfo) + public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria) { - return !keys.HasFilter || keys.IsInRange(ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo))); + return !keys.HasFilter || keys.IsInRange(ManiaBeatmapConverter.GetColumnCount(beatmapInfo, criteria.Mods)); } public bool TryParseCustomKeywordCriteria(string key, Operator op, string value) diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs index c7a32ebbc4..78d8eabba7 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs @@ -309,7 +309,7 @@ namespace osu.Game.Tests.NonVisual.Filtering match = shouldMatch; } - public bool Matches(BeatmapInfo beatmapInfo) => match; + public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria) => match; public bool TryParseCustomKeywordCriteria(string key, Operator op, string value) => false; } } diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs index ea14412f55..b0ceed45b9 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterQueryParserTest.cs @@ -502,7 +502,7 @@ namespace osu.Game.Tests.NonVisual.Filtering { public string? CustomValue { get; set; } - public bool Matches(BeatmapInfo beatmapInfo) => true; + public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria) => true; public bool TryParseCustomKeywordCriteria(string key, Operator op, string value) { diff --git a/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs b/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs index dd2ad2cbfa..f926b04db4 100644 --- a/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs +++ b/osu.Game/Rulesets/Filter/IRulesetFilterCriteria.cs @@ -18,11 +18,12 @@ namespace osu.Game.Rulesets.Filter /// in addition to the ones mandated by song select. /// /// The beatmap to test the criteria against. + /// The filter criteria. /// /// true if the beatmap matches the ruleset-specific custom filtering criteria, /// false otherwise. /// - bool Matches(BeatmapInfo beatmapInfo); + bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria); /// /// Attempts to parse a single custom keyword criterion, given by the user via the song select search box. diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index 43461a48bb..8f38ae710c 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Select.Carousel match &= criteria.CollectionBeatmapMD5Hashes?.Contains(BeatmapInfo.MD5Hash) ?? true; if (match && criteria.RulesetCriteria != null) - match &= criteria.RulesetCriteria.Matches(BeatmapInfo); + match &= criteria.RulesetCriteria.Matches(BeatmapInfo, criteria); return match; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 2752beb645..f725d98342 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select.Carousel private IBindable ruleset { get; set; } = null!; [Resolved] - private IBindable>? mods { get; set; } = null!; + private IBindable> mods { get; set; } = null!; private IBindable starDifficultyBindable = null!; private CancellationTokenSource? starDifficultyCancellationSource; @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select.Carousel base.LoadComplete(); ruleset.BindValueChanged(_ => updateKeyCount()); - mods?.BindValueChanged(_ => updateKeyCount()); + mods.BindValueChanged(_ => updateKeyCount()); } protected override void Selected() @@ -260,7 +260,7 @@ namespace osu.Game.Screens.Select.Carousel ILegacyRuleset legacyRuleset = (ILegacyRuleset)ruleset.Value.CreateInstance(); keyCountText.Alpha = 1; - keyCountText.Text = $"[{legacyRuleset.GetKeyCount(beatmapInfo, mods?.Value)}K]"; + keyCountText.Text = $"[{legacyRuleset.GetKeyCount(beatmapInfo, mods.Value)}K]"; } else keyCountText.Alpha = 0; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 17297c9ebf..b19a7699c5 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -4,6 +4,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Collections.Immutable; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -22,6 +23,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Localisation; using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Select.Filter; using osuTK; using osuTK.Graphics; @@ -65,6 +67,7 @@ namespace osu.Game.Screens.Select Sort = sortMode.Value, AllowConvertedBeatmaps = showConverted.Value, Ruleset = ruleset.Value, + Mods = mods.Value, CollectionBeatmapMD5Hashes = collectionDropdown.Current.Value?.Collection?.PerformRead(c => c.BeatmapMD5Hashes).ToImmutableHashSet() }; @@ -84,7 +87,7 @@ namespace osu.Game.Screens.Select base.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos); [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, IBindable parentRuleset, OsuConfigManager config) + private void load(OsuColour colours, OsuConfigManager config) { sortMode = config.GetBindable(OsuSetting.SongSelectSortingMode); groupMode = config.GetBindable(OsuSetting.SongSelectGroupingMode); @@ -214,8 +217,8 @@ namespace osu.Game.Screens.Select config.BindWith(OsuSetting.DisplayStarsMaximum, maximumStars); maximumStars.ValueChanged += _ => updateCriteria(); - ruleset.BindTo(parentRuleset); ruleset.BindValueChanged(_ => updateCriteria()); + mods.BindValueChanged(_ => updateCriteria()); groupMode.BindValueChanged(_ => updateCriteria()); sortMode.BindValueChanged(_ => updateCriteria()); @@ -239,7 +242,11 @@ namespace osu.Game.Screens.Select searchTextBox.HoldFocus = true; } - private readonly IBindable ruleset = new Bindable(); + [Resolved] + private IBindable ruleset { get; set; } = null!; + + [Resolved] + private IBindable> mods { get; set; } = null!; private readonly Bindable showConverted = new Bindable(); private readonly Bindable minimumStars = new BindableDouble(); diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 01b0e9b7d9..190efd0fb0 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -10,6 +10,7 @@ using osu.Game.Beatmaps; using osu.Game.Collections; using osu.Game.Rulesets; using osu.Game.Rulesets.Filter; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Select.Filter; namespace osu.Game.Screens.Select @@ -50,6 +51,7 @@ namespace osu.Game.Screens.Select public OptionalTextFilter[] SearchTerms = Array.Empty(); public RulesetInfo? Ruleset; + public IReadOnlyList? Mods; public bool AllowConvertedBeatmaps; private string searchText = string.Empty; From 6e746a0fa053eb5c5c0d1b8cde1d0a1e1ba2c737 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 28 Mar 2024 23:56:46 +0900 Subject: [PATCH 7/9] Fix carousel reoder on initial enter --- osu.Game/Screens/Select/FilterControl.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index b19a7699c5..7b8b5393bd 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -218,7 +218,13 @@ namespace osu.Game.Screens.Select maximumStars.ValueChanged += _ => updateCriteria(); ruleset.BindValueChanged(_ => updateCriteria()); - mods.BindValueChanged(_ => updateCriteria()); + mods.BindValueChanged(_ => + { + // Mods are updated once by the mod select overlay when song select is entered, regardless of if there are any mods. + // Updating the criteria here so early triggers a re-ordering of panels on song select, via... some mechanism. + // Todo: Investigate/fix the above and remove this schedule. + Scheduler.AddOnce(updateCriteria); + }); groupMode.BindValueChanged(_ => updateCriteria()); sortMode.BindValueChanged(_ => updateCriteria()); From d12a2e7df7131fea37974bbb0707705cc2f0e977 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 1 Apr 2024 17:02:02 +0900 Subject: [PATCH 8/9] Replace schedule with SequenceEqual() --- osu.Game/Screens/Select/FilterControl.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7b8b5393bd..0bfd927234 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -218,12 +219,16 @@ namespace osu.Game.Screens.Select maximumStars.ValueChanged += _ => updateCriteria(); ruleset.BindValueChanged(_ => updateCriteria()); - mods.BindValueChanged(_ => + mods.BindValueChanged(m => { - // Mods are updated once by the mod select overlay when song select is entered, regardless of if there are any mods. + // Mods are updated once by the mod select overlay when song select is entered, + // regardless of if there are any mods or any changes have taken place. // Updating the criteria here so early triggers a re-ordering of panels on song select, via... some mechanism. - // Todo: Investigate/fix the above and remove this schedule. - Scheduler.AddOnce(updateCriteria); + // Todo: Investigate/fix and potentially remove this. + if (m.NewValue.SequenceEqual(m.OldValue)) + return; + + updateCriteria(); }); groupMode.BindValueChanged(_ => updateCriteria()); From 8e0ca11d1cca1571b0d0efd61e0322b618333e5d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 1 Apr 2024 17:02:32 +0900 Subject: [PATCH 9/9] Fully qualify LegacyBeatmapConversionDifficultyInfo --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 3 --- osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs | 3 ++- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index bed04a882f..39ee3d209b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -98,9 +98,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps } } - public static int GetColumnCount(IBeatmapInfo beatmapInfo, IReadOnlyList? mods = null) - => GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), mods); - public static int GetColumnCount(LegacyBeatmapConversionDifficultyInfo difficulty, IReadOnlyList? mods = null) { var converter = new ManiaBeatmapConverter(null, difficulty, new ManiaRuleset()); diff --git a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs index 07ed3ebd63..ea7eb5b8f0 100644 --- a/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs +++ b/osu.Game.Rulesets.Mania/ManiaFilterCriteria.cs @@ -4,6 +4,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Scoring.Legacy; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -15,7 +16,7 @@ namespace osu.Game.Rulesets.Mania public bool Matches(BeatmapInfo beatmapInfo, FilterCriteria criteria) { - return !keys.HasFilter || keys.IsInRange(ManiaBeatmapConverter.GetColumnCount(beatmapInfo, criteria.Mods)); + return !keys.HasFilter || keys.IsInRange(ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), criteria.Mods)); } public bool TryParseCustomKeywordCriteria(string key, Operator op, string value) diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 77168dca68..b5614e2b56 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -424,7 +424,7 @@ namespace osu.Game.Rulesets.Mania public override DifficultySection CreateEditorDifficultySection() => new ManiaDifficultySection(); public int GetKeyCount(IBeatmapInfo beatmapInfo, IReadOnlyList? mods = null) - => ManiaBeatmapConverter.GetColumnCount(beatmapInfo, mods); + => ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), mods); } public enum PlayfieldType