From 043c25c8404cc6459475d5f6c3347d3c2e60c532 Mon Sep 17 00:00:00 2001
From: minisbett <39670899+minisbett@users.noreply.github.com>
Date: Thu, 26 Sep 2024 00:02:39 +0200
Subject: [PATCH 1/7] remove relevant legacy mods masking
---
PerformanceCalculator/LegacyHelper.cs | 28 +--------------------------
1 file changed, 1 insertion(+), 27 deletions(-)
diff --git a/PerformanceCalculator/LegacyHelper.cs b/PerformanceCalculator/LegacyHelper.cs
index 7d2595b61..6f6cfbfa7 100644
--- a/PerformanceCalculator/LegacyHelper.cs
+++ b/PerformanceCalculator/LegacyHelper.cs
@@ -63,32 +63,6 @@ public static string GetRulesetShortNameFromId(int id)
}
}
- public const LegacyMods KEY_MODS = LegacyMods.Key1 | LegacyMods.Key2 | LegacyMods.Key3 | LegacyMods.Key4 | LegacyMods.Key5 | LegacyMods.Key6 | LegacyMods.Key7 | LegacyMods.Key8
- | LegacyMods.Key9 | LegacyMods.KeyCoop;
-
- // See: https://github.com/ppy/osu-queue-score-statistics/blob/2264bfa68e14bb16ec71a7cac2072bdcfaf565b6/osu.Server.Queues.ScoreStatisticsProcessor/Helpers/LegacyModsHelper.cs
- public static LegacyMods MaskRelevantMods(LegacyMods mods, bool isConvertedBeatmap, int rulesetId)
- {
- LegacyMods relevantMods = LegacyMods.DoubleTime | LegacyMods.HalfTime | LegacyMods.HardRock | LegacyMods.Easy;
-
- switch (rulesetId)
- {
- case 0:
- if ((mods & LegacyMods.Flashlight) > 0)
- relevantMods |= LegacyMods.Flashlight | LegacyMods.Hidden | LegacyMods.TouchDevice;
- else
- relevantMods |= LegacyMods.Flashlight | LegacyMods.TouchDevice;
- break;
-
- case 3:
- if (isConvertedBeatmap)
- relevantMods |= KEY_MODS;
- break;
- }
-
- return mods & relevantMods;
- }
-
///
/// Transforms a given combination into one which is applicable to legacy scores.
/// This is used to match osu!stable/osu!web calculations for the time being, until such a point that these mods do get considered.
@@ -101,7 +75,7 @@ public static LegacyMods ConvertToLegacyDifficultyAdjustmentMods(BeatmapInfo bea
if (mods.Any(mod => mod is ModDaycore))
legacyMods |= LegacyMods.HalfTime;
- return MaskRelevantMods(legacyMods, ruleset.RulesetInfo.OnlineID != beatmapInfo.Ruleset.OnlineID, ruleset.RulesetInfo.OnlineID);
+ return legacyMods;
}
///
From 103449e8a8fcc730c6e9fe6f47588895e0b8c740 Mon Sep 17 00:00:00 2001
From: minisbett <39670899+minisbett@users.noreply.github.com>
Date: Thu, 10 Oct 2024 00:27:08 +0200
Subject: [PATCH 2/7] Update ppy.Osu.Game dependencies to 2024.1009.1
---
PerformanceCalculator/PerformanceCalculator.csproj | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/PerformanceCalculator/PerformanceCalculator.csproj b/PerformanceCalculator/PerformanceCalculator.csproj
index 26ce15f1c..0886656a8 100644
--- a/PerformanceCalculator/PerformanceCalculator.csproj
+++ b/PerformanceCalculator/PerformanceCalculator.csproj
@@ -7,10 +7,10 @@
-
-
-
-
-
+
+
+
+
+
From 13a27735a2eb3dfea8229d46cb8dbecc2a39057a Mon Sep 17 00:00:00 2001
From: minisbett <39670899+minisbett@users.noreply.github.com>
Date: Thu, 10 Oct 2024 00:54:17 +0200
Subject: [PATCH 3/7] Update to C# 12
---
PerformanceCalculator/PerformanceCalculator.csproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/PerformanceCalculator/PerformanceCalculator.csproj b/PerformanceCalculator/PerformanceCalculator.csproj
index 0886656a8..b8484382c 100644
--- a/PerformanceCalculator/PerformanceCalculator.csproj
+++ b/PerformanceCalculator/PerformanceCalculator.csproj
@@ -3,6 +3,7 @@
Exe
net8.0
+ 12.0
From 7134a63c45462742d22a6ef2df12ec5326c5bf04 Mon Sep 17 00:00:00 2001
From: minisbett <39670899+minisbett@users.noreply.github.com>
Date: Thu, 10 Oct 2024 01:11:33 +0200
Subject: [PATCH 4/7] Implement reconsiderations for mods filtering
---
PerformanceCalculator/Difficulty/DifficultyCommand.cs | 6 +-----
.../Difficulty/LegacyScoreAttributesCommand.cs | 4 +---
.../Difficulty/LegacyScoreConversionCommand.cs | 6 ++----
.../Leaderboard/LeaderboardCommand.cs | 2 +-
PerformanceCalculator/LegacyHelper.cs | 6 +++---
.../Performance/ReplayPerformanceCommand.cs | 2 +-
.../Performance/ScorePerformanceCommand.cs | 4 ++--
PerformanceCalculator/Profile/ProfileCommand.cs | 11 ++++++++++-
PerformanceCalculator/Simulate/SimulateCommand.cs | 6 +-----
9 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/PerformanceCalculator/Difficulty/DifficultyCommand.cs b/PerformanceCalculator/Difficulty/DifficultyCommand.cs
index 47b3158f8..5fa1ac98a 100644
--- a/PerformanceCalculator/Difficulty/DifficultyCommand.cs
+++ b/PerformanceCalculator/Difficulty/DifficultyCommand.cs
@@ -36,10 +36,6 @@ public class DifficultyCommand : ProcessorCommand
+ "Values: hr, dt, hd, fl, ez, 4k, 5k, etc...")]
public string[] Mods { get; }
- [UsedImplicitly]
- [Option(Template = "-nc|--no-classic", Description = "Excludes the classic mod.")]
- public bool NoClassicMod { get; }
-
public override void Execute()
{
var resultSet = new ResultSet();
@@ -124,7 +120,7 @@ private Result processBeatmap(WorkingBeatmap beatmap)
{
// Get the ruleset
var ruleset = LegacyHelper.GetRulesetFromLegacyID(Ruleset ?? beatmap.BeatmapInfo.Ruleset.OnlineID);
- var mods = NoClassicMod ? getMods(ruleset) : LegacyHelper.FilterDifficultyAdjustmentMods(beatmap.BeatmapInfo, ruleset, getMods(ruleset));
+ var mods = getMods(ruleset);
var attributes = ruleset.CreateDifficultyCalculator(beatmap).Calculate(mods);
return new Result
diff --git a/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs b/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs
index 79a7573b5..8f1971351 100644
--- a/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs
+++ b/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs
@@ -115,11 +115,9 @@ public override void Execute()
private Result processBeatmap(WorkingBeatmap beatmap)
{
- // Get the ruleset
var ruleset = LegacyHelper.GetRulesetFromLegacyID(Ruleset ?? beatmap.BeatmapInfo.Ruleset.OnlineID);
- // bit of a hack to discard non-legacy mods.
- var mods = ruleset.ConvertFromLegacyMods(ruleset.ConvertToLegacyMods(getMods(ruleset))).ToList();
+ var mods = LegacyHelper.FilterLegacyMods(beatmap.BeatmapInfo, ruleset, getMods(ruleset));
var legacyRuleset = (ILegacyRuleset)ruleset;
var simulator = legacyRuleset.CreateLegacyScoreSimulator();
diff --git a/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs b/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs
index 396d81f15..583d37d10 100644
--- a/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs
+++ b/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs
@@ -66,10 +66,8 @@ public virtual void OnExecute(CommandLineApplication app, IConsole console)
var ruleset = LegacyHelper.GetRulesetFromLegacyID(Ruleset);
var workingBeatmap = ProcessorWorkingBeatmap.FromFileOrId(Beatmap);
- // bit of a hack to discard non-legacy mods.
- var mods = ruleset.ConvertFromLegacyMods(ruleset.ConvertToLegacyMods(getMods(ruleset)))
- .Append(ruleset.CreateMod())
- .ToArray();
+ Mod[] mods = [ruleset.CreateMod(), .. LegacyHelper.FilterLegacyMods(workingBeatmap.BeatmapInfo, ruleset, getMods(ruleset))];
+
var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
var scoreInfo = new ScoreInfo(beatmap.BeatmapInfo, ruleset.RulesetInfo)
diff --git a/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs b/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs
index 5a22c4924..52bd5fe44 100644
--- a/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs
+++ b/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs
@@ -62,7 +62,7 @@ public override void Execute()
var score = new ProcessorScoreDecoder(working).Parse(scoreInfo);
var difficultyCalculator = ruleset.CreateDifficultyCalculator(working);
- var difficultyAttributes = difficultyCalculator.Calculate(LegacyHelper.FilterDifficultyAdjustmentMods(working.BeatmapInfo, ruleset, scoreInfo.Mods).ToArray());
+ var difficultyAttributes = difficultyCalculator.Calculate(scoreInfo.Mods);
var performanceCalculator = ruleset.CreatePerformanceCalculator();
plays.Add((performanceCalculator?.Calculate(score.ScoreInfo, difficultyAttributes).Total ?? 0, play.PP ?? 0.0));
diff --git a/PerformanceCalculator/LegacyHelper.cs b/PerformanceCalculator/LegacyHelper.cs
index 6f6cfbfa7..5ac06bb0f 100644
--- a/PerformanceCalculator/LegacyHelper.cs
+++ b/PerformanceCalculator/LegacyHelper.cs
@@ -67,7 +67,7 @@ public static string GetRulesetShortNameFromId(int id)
/// Transforms a given combination into one which is applicable to legacy scores.
/// This is used to match osu!stable/osu!web calculations for the time being, until such a point that these mods do get considered.
///
- public static LegacyMods ConvertToLegacyDifficultyAdjustmentMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
+ public static LegacyMods ConvertToLegacyMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
{
var legacyMods = ruleset.ConvertToLegacyMods(mods);
@@ -82,8 +82,8 @@ public static LegacyMods ConvertToLegacyDifficultyAdjustmentMods(BeatmapInfo bea
/// Transforms a given combination into one which is applicable to legacy scores.
/// This is used to match osu!stable/osu!web calculations for the time being, until such a point that these mods do get considered.
///
- public static Mod[] FilterDifficultyAdjustmentMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
- => ruleset.ConvertFromLegacyMods(ConvertToLegacyDifficultyAdjustmentMods(beatmapInfo, ruleset, mods)).ToArray();
+ public static Mod[] FilterLegacyMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
+ => ruleset.ConvertFromLegacyMods(ConvertToLegacyMods(beatmapInfo, ruleset, mods)).ToArray();
public static DifficultyAttributes CreateDifficultyAttributes(int legacyId)
{
diff --git a/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs b/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
index 116052602..51c381a22 100644
--- a/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
+++ b/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
@@ -42,7 +42,7 @@ public override void Execute()
if (score.ScoreInfo.IsLegacyScore)
{
- difficultyMods = LegacyHelper.FilterDifficultyAdjustmentMods(workingBeatmap.BeatmapInfo, ruleset, difficultyMods);
+ difficultyMods = LegacyHelper.FilterLegacyMods(workingBeatmap.BeatmapInfo, ruleset, difficultyMods);
score.ScoreInfo.LegacyTotalScore = (int)score.ScoreInfo.TotalScore;
LegacyScoreDecoder.PopulateMaximumStatistics(score.ScoreInfo, workingBeatmap);
StandardisedScoreMigrationTools.UpdateFromLegacy(
diff --git a/PerformanceCalculator/Performance/ScorePerformanceCommand.cs b/PerformanceCalculator/Performance/ScorePerformanceCommand.cs
index c8c6dbe7f..76d2c3579 100644
--- a/PerformanceCalculator/Performance/ScorePerformanceCommand.cs
+++ b/PerformanceCalculator/Performance/ScorePerformanceCommand.cs
@@ -46,13 +46,13 @@ public override void Execute()
if (OnlineAttributes)
{
- LegacyMods legacyMods = LegacyHelper.ConvertToLegacyDifficultyAdjustmentMods(workingBeatmap.BeatmapInfo, ruleset, score.Mods);
+ LegacyMods legacyMods = LegacyHelper.ConvertToLegacyMods(workingBeatmap.BeatmapInfo, ruleset, score.Mods);
attributes = queryApiAttributes(apiScore.BeatmapID, apiScore.RulesetID, legacyMods);
}
else
{
var difficultyCalculator = ruleset.CreateDifficultyCalculator(workingBeatmap);
- attributes = difficultyCalculator.Calculate(LegacyHelper.FilterDifficultyAdjustmentMods(workingBeatmap.BeatmapInfo, ruleset, score.Mods));
+ attributes = difficultyCalculator.Calculate(score.Mods);
}
var performanceCalculator = ruleset.CreatePerformanceCalculator();
diff --git a/PerformanceCalculator/Profile/ProfileCommand.cs b/PerformanceCalculator/Profile/ProfileCommand.cs
index 050ae51a3..c77136a9f 100644
--- a/PerformanceCalculator/Profile/ProfileCommand.cs
+++ b/PerformanceCalculator/Profile/ProfileCommand.cs
@@ -28,6 +28,10 @@ public class ProfileCommand : ApiCommand
[AllowedValues("0", "1", "2", "3")]
public int? Ruleset { get; }
+ [UsedImplicitly]
+ [Option(Template = "-or|--only-ranked-mods", Description = "Excludes mods currently considered unranked.")]
+ public bool OnlyRankedMods { get; set; }
+
public override void Execute()
{
var displayPlays = new List();
@@ -46,13 +50,18 @@ public override void Execute()
Mod[] mods = play.Mods.Select(x => x.ToMod(ruleset)).ToArray();
+ if (OnlyRankedMods)
+ {
+ mods = LegacyHelper.FilterLegacyMods(working.BeatmapInfo, ruleset, mods);
+ }
+
var scoreInfo = play.ToScoreInfo(mods);
scoreInfo.Ruleset = ruleset.RulesetInfo;
var score = new ProcessorScoreDecoder(working).Parse(scoreInfo);
var difficultyCalculator = ruleset.CreateDifficultyCalculator(working);
- var difficultyAttributes = difficultyCalculator.Calculate(LegacyHelper.FilterDifficultyAdjustmentMods(working.BeatmapInfo, ruleset, scoreInfo.Mods).ToArray());
+ var difficultyAttributes = difficultyCalculator.Calculate(scoreInfo.Mods);
var performanceCalculator = ruleset.CreatePerformanceCalculator();
var ppAttributes = performanceCalculator?.Calculate(score.ScoreInfo, difficultyAttributes);
diff --git a/PerformanceCalculator/Simulate/SimulateCommand.cs b/PerformanceCalculator/Simulate/SimulateCommand.cs
index b7351ff50..1c79f93d0 100644
--- a/PerformanceCalculator/Simulate/SimulateCommand.cs
+++ b/PerformanceCalculator/Simulate/SimulateCommand.cs
@@ -48,16 +48,12 @@ public abstract class SimulateCommand : ProcessorCommand
[UsedImplicitly]
public virtual int? Goods { get; }
- [UsedImplicitly]
- [Option(Template = "-nc|--no-classic", Description = "Excludes the classic mod.")]
- public bool NoClassicMod { get; }
-
public override void Execute()
{
var ruleset = Ruleset;
var workingBeatmap = ProcessorWorkingBeatmap.FromFileOrId(Beatmap);
- var mods = NoClassicMod ? GetMods(ruleset) : LegacyHelper.FilterDifficultyAdjustmentMods(workingBeatmap.BeatmapInfo, ruleset, GetMods(ruleset));
+ var mods = GetMods(ruleset);
var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
var beatmapMaxCombo = GetMaxCombo(beatmap);
From 98d967553d0c78f45ab74e2506e89348921d3610 Mon Sep 17 00:00:00 2001
From: minisbett <39670899+minisbett@users.noreply.github.com>
Date: Fri, 11 Oct 2024 20:32:19 +0200
Subject: [PATCH 5/7] Revert adding --only-ranked-mods parameter
---
PerformanceCalculator/Profile/ProfileCommand.cs | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/PerformanceCalculator/Profile/ProfileCommand.cs b/PerformanceCalculator/Profile/ProfileCommand.cs
index c77136a9f..79a037546 100644
--- a/PerformanceCalculator/Profile/ProfileCommand.cs
+++ b/PerformanceCalculator/Profile/ProfileCommand.cs
@@ -28,10 +28,6 @@ public class ProfileCommand : ApiCommand
[AllowedValues("0", "1", "2", "3")]
public int? Ruleset { get; }
- [UsedImplicitly]
- [Option(Template = "-or|--only-ranked-mods", Description = "Excludes mods currently considered unranked.")]
- public bool OnlyRankedMods { get; set; }
-
public override void Execute()
{
var displayPlays = new List();
@@ -50,11 +46,6 @@ public override void Execute()
Mod[] mods = play.Mods.Select(x => x.ToMod(ruleset)).ToArray();
- if (OnlyRankedMods)
- {
- mods = LegacyHelper.FilterLegacyMods(working.BeatmapInfo, ruleset, mods);
- }
-
var scoreInfo = play.ToScoreInfo(mods);
scoreInfo.Ruleset = ruleset.RulesetInfo;
From 8ebeeaf26fac0b0c834f3c09c704040791b1b53e Mon Sep 17 00:00:00 2001
From: Dan Balasescu
Date: Sun, 13 Oct 2024 15:36:37 +0900
Subject: [PATCH 6/7] Remove filtering in all unnecessary cases
---
.../LegacyScoreAttributesCommand.cs | 3 +-
.../LegacyScoreConversionCommand.cs | 2 +-
PerformanceCalculator/LegacyHelper.cs | 26 -----------
.../Performance/ReplayPerformanceCommand.cs | 1 -
.../Performance/ScorePerformanceCommand.cs | 44 ++++++++++++++++++-
5 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs b/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs
index 8f1971351..31ce58a30 100644
--- a/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs
+++ b/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs
@@ -116,8 +116,7 @@ public override void Execute()
private Result processBeatmap(WorkingBeatmap beatmap)
{
var ruleset = LegacyHelper.GetRulesetFromLegacyID(Ruleset ?? beatmap.BeatmapInfo.Ruleset.OnlineID);
-
- var mods = LegacyHelper.FilterLegacyMods(beatmap.BeatmapInfo, ruleset, getMods(ruleset));
+ var mods = getMods(ruleset);
var legacyRuleset = (ILegacyRuleset)ruleset;
var simulator = legacyRuleset.CreateLegacyScoreSimulator();
diff --git a/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs b/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs
index 583d37d10..190baa3ef 100644
--- a/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs
+++ b/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs
@@ -66,7 +66,7 @@ public virtual void OnExecute(CommandLineApplication app, IConsole console)
var ruleset = LegacyHelper.GetRulesetFromLegacyID(Ruleset);
var workingBeatmap = ProcessorWorkingBeatmap.FromFileOrId(Beatmap);
- Mod[] mods = [ruleset.CreateMod(), .. LegacyHelper.FilterLegacyMods(workingBeatmap.BeatmapInfo, ruleset, getMods(ruleset))];
+ Mod[] mods = [ruleset.CreateMod(), .. getMods(ruleset)];
var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
diff --git a/PerformanceCalculator/LegacyHelper.cs b/PerformanceCalculator/LegacyHelper.cs
index 5ac06bb0f..0449f0d93 100644
--- a/PerformanceCalculator/LegacyHelper.cs
+++ b/PerformanceCalculator/LegacyHelper.cs
@@ -2,16 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using System.Linq;
-using osu.Game.Beatmaps;
-using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Catch.Difficulty;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mania.Difficulty;
-using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Difficulty;
using osu.Game.Rulesets.Taiko;
@@ -63,28 +59,6 @@ public static string GetRulesetShortNameFromId(int id)
}
}
- ///
- /// Transforms a given combination into one which is applicable to legacy scores.
- /// This is used to match osu!stable/osu!web calculations for the time being, until such a point that these mods do get considered.
- ///
- public static LegacyMods ConvertToLegacyMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
- {
- var legacyMods = ruleset.ConvertToLegacyMods(mods);
-
- // mods that are not represented in `LegacyMods` (but we can approximate them well enough with others)
- if (mods.Any(mod => mod is ModDaycore))
- legacyMods |= LegacyMods.HalfTime;
-
- return legacyMods;
- }
-
- ///
- /// Transforms a given combination into one which is applicable to legacy scores.
- /// This is used to match osu!stable/osu!web calculations for the time being, until such a point that these mods do get considered.
- ///
- public static Mod[] FilterLegacyMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
- => ruleset.ConvertFromLegacyMods(ConvertToLegacyMods(beatmapInfo, ruleset, mods)).ToArray();
-
public static DifficultyAttributes CreateDifficultyAttributes(int legacyId)
{
switch (legacyId)
diff --git a/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs b/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
index 51c381a22..082062ea1 100644
--- a/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
+++ b/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
@@ -42,7 +42,6 @@ public override void Execute()
if (score.ScoreInfo.IsLegacyScore)
{
- difficultyMods = LegacyHelper.FilterLegacyMods(workingBeatmap.BeatmapInfo, ruleset, difficultyMods);
score.ScoreInfo.LegacyTotalScore = (int)score.ScoreInfo.TotalScore;
LegacyScoreDecoder.PopulateMaximumStatistics(score.ScoreInfo, workingBeatmap);
StandardisedScoreMigrationTools.UpdateFromLegacy(
diff --git a/PerformanceCalculator/Performance/ScorePerformanceCommand.cs b/PerformanceCalculator/Performance/ScorePerformanceCommand.cs
index 76d2c3579..0bc18179b 100644
--- a/PerformanceCalculator/Performance/ScorePerformanceCommand.cs
+++ b/PerformanceCalculator/Performance/ScorePerformanceCommand.cs
@@ -16,6 +16,7 @@
using osu.Game.Rulesets.Catch.Difficulty;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mania.Difficulty;
+using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty;
using osu.Game.Rulesets.Taiko.Difficulty;
using osu.Game.Scoring;
@@ -46,7 +47,7 @@ public override void Execute()
if (OnlineAttributes)
{
- LegacyMods legacyMods = LegacyHelper.ConvertToLegacyMods(workingBeatmap.BeatmapInfo, ruleset, score.Mods);
+ LegacyMods legacyMods = convertToLegacyMods(workingBeatmap.BeatmapInfo, ruleset, score.Mods);
attributes = queryApiAttributes(apiScore.BeatmapID, apiScore.RulesetID, legacyMods);
}
else
@@ -121,6 +122,47 @@ DifficultyAttributes getMergedAttributes(APIBeatmap apiBeatmap)
}
}
+ ///
+ /// Transforms a given combination into one which is applicable to legacy scores.
+ /// This should only be used to match performance calculations using databased attributes.
+ ///
+ private static LegacyMods convertToLegacyMods(BeatmapInfo beatmapInfo, Ruleset ruleset, Mod[] mods)
+ {
+ var legacyMods = ruleset.ConvertToLegacyMods(mods);
+
+ // mods that are not represented in `LegacyMods` (but we can approximate them well enough with others)
+ if (mods.Any(mod => mod is ModDaycore))
+ legacyMods |= LegacyMods.HalfTime;
+
+ // See: https://github.com/ppy/osu-queue-score-statistics/blob/2264bfa68e14bb16ec71a7cac2072bdcfaf565b6/osu.Server.Queues.ScoreStatisticsProcessor/Helpers/LegacyModsHelper.cs
+ static LegacyMods maskRelevantMods(LegacyMods mods, bool isConvertedBeatmap, int rulesetId)
+ {
+ const LegacyMods key_mods = LegacyMods.Key1 | LegacyMods.Key2 | LegacyMods.Key3 | LegacyMods.Key4 | LegacyMods.Key5 | LegacyMods.Key6 | LegacyMods.Key7 | LegacyMods.Key8
+ | LegacyMods.Key9 | LegacyMods.KeyCoop;
+
+ LegacyMods relevantMods = LegacyMods.DoubleTime | LegacyMods.HalfTime | LegacyMods.HardRock | LegacyMods.Easy;
+
+ switch (rulesetId)
+ {
+ case 0:
+ if ((mods & LegacyMods.Flashlight) > 0)
+ relevantMods |= LegacyMods.Flashlight | LegacyMods.Hidden | LegacyMods.TouchDevice;
+ else
+ relevantMods |= LegacyMods.Flashlight | LegacyMods.TouchDevice;
+ break;
+
+ case 3:
+ if (isConvertedBeatmap)
+ relevantMods |= key_mods;
+ break;
+ }
+
+ return mods & relevantMods;
+ }
+
+ return maskRelevantMods(legacyMods, ruleset.RulesetInfo.OnlineID != beatmapInfo.Ruleset.OnlineID, ruleset.RulesetInfo.OnlineID);
+ }
+
[JsonObject(MemberSerialization.OptIn)]
private class AttributesResponse
where T : DifficultyAttributes
From 8c55f803d3862c2ca651f79adf062d96e60961b9 Mon Sep 17 00:00:00 2001
From: Dan Balasescu
Date: Sun, 13 Oct 2024 15:43:54 +0900
Subject: [PATCH 7/7] Remove unnecessary local
---
.../Performance/ReplayPerformanceCommand.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs b/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
index 082062ea1..8e118e671 100644
--- a/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
+++ b/PerformanceCalculator/Performance/ReplayPerformanceCommand.cs
@@ -9,7 +9,6 @@
using osu.Game.Database;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
-using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring.Legacy;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
@@ -38,8 +37,6 @@ public override void Execute()
var workingBeatmap = ProcessorWorkingBeatmap.FromFileOrId(score.ScoreInfo.BeatmapInfo!.OnlineID.ToString());
var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, score.ScoreInfo.Mods);
- Mod[] difficultyMods = score.ScoreInfo.Mods;
-
if (score.ScoreInfo.IsLegacyScore)
{
score.ScoreInfo.LegacyTotalScore = (int)score.ScoreInfo.TotalScore;
@@ -51,7 +48,7 @@ public override void Execute()
((ILegacyRuleset)ruleset).CreateLegacyScoreSimulator().Simulate(workingBeatmap, playableBeatmap));
}
- var difficultyAttributes = ruleset.CreateDifficultyCalculator(workingBeatmap).Calculate(difficultyMods);
+ var difficultyAttributes = ruleset.CreateDifficultyCalculator(workingBeatmap).Calculate(score.ScoreInfo.Mods);
var performanceCalculator = score.ScoreInfo.Ruleset.CreateInstance().CreatePerformanceCalculator();
var performanceAttributes = performanceCalculator?.Calculate(score.ScoreInfo, difficultyAttributes);