From 348b40ca4df8a0c31742316375a5346a17edeb2c Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Mon, 30 Jun 2025 14:31:37 +0300 Subject: [PATCH 1/4] add legacy calculation --- .../Screens/SimulateScreen.cs | 57 +++++++++++++++---- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index 6dbe06f863..873b37c05a 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -63,6 +63,7 @@ public partial class SimulateScreen : PerformanceCalculatorScreen private LabelledNumberBox scoreIdTextBox; private StatefulButton scoreIdPopulateButton; + private LabelledSwitchButton legacyScoreSwitchButton; private GridContainer accuracyContainer; private LimitedLabelledFractionalNumberBox accuracyTextBox; @@ -229,7 +230,7 @@ private void load(OsuColour osuColour) scoreIdTextBox = new LabelledNumberBox { RelativeSizeAxes = Axes.X, - Width = 0.7f, + Width = 0.45f, Label = "Score ID", PlaceholderText = "0", }, @@ -248,6 +249,13 @@ private void load(OsuColour osuColour) notificationDisplay.Display(new Notification("Incorrect score id")); } } + }, + legacyScoreSwitchButton = new LabelledSwitchButton + { + RelativeSizeAxes = Axes.X, + Width = 0.25f, + Anchor = Anchor.TopLeft, + Label = "Is legacy score?", } } }, @@ -356,10 +364,7 @@ private void load(OsuColour osuColour) RelativeSizeAxes = Axes.X, Anchor = Anchor.TopLeft, Label = "Score", - PlaceholderText = "1000000", MinValue = 0, - MaxValue = 1000000, - Value = { Value = 1000000 } }, new OsuSpriteText { @@ -516,6 +521,7 @@ private void load(OsuColour osuColour) sliderTailMissesTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance()); comboTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance()); scoreTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance()); + legacyScoreSwitchButton.Current.BindValueChanged(_ => updateScoreTextBox()); fullScoreDataSwitch.Current.BindValueChanged(val => updateAccuracyParams(val.NewValue)); @@ -734,7 +740,8 @@ private void calculatePerformance() Mods = appliedMods.Value.ToArray(), TotalScore = score, Ruleset = ruleset.Value, - LegacyTotalScore = legacyTotalScore, + IsLegacyScore = legacyScoreSwitchButton.Current.Value, + LegacyTotalScore = scoreTextBox.Value.Value, }, difficultyAttributes); performanceAttributesContainer.Attributes.Value = AttributeConversion.ToDictionary(ppAttributes); @@ -754,6 +761,7 @@ private void populateScoreParams() largeTickMissesTextBox.Hide(); sliderTailMissesTextBox.Hide(); scoreTextBox.Hide(); + legacyScoreSwitchButton.Hide(); if (ruleset.Value.ShortName == "osu" || ruleset.Value.ShortName == "taiko" || ruleset.Value.ShortName == "fruits") { @@ -768,6 +776,10 @@ private void populateScoreParams() { largeTickMissesTextBox.Show(); sliderTailMissesTextBox.Show(); + legacyScoreSwitchButton.Show(); + + scoreTextBox.Value.Value = 0; + scoreTextBox.Text = string.Empty; } } else if (ruleset.Value.ShortName == "mania") @@ -777,8 +789,8 @@ private void populateScoreParams() missesTextBox.Show(); + scoreTextBox.Value.Value = 1000000; scoreTextBox.Text = string.Empty; - scoreTextBox.Show(); } else { @@ -795,6 +807,8 @@ private void populateScoreParams() scoreTextBox.Text = string.Empty; scoreTextBox.Show(); } + + updateScoreTextBox(); } private void updateAccuracyParams(bool useFullScoreData) @@ -869,6 +883,26 @@ private void updateAccuracyParams(bool useFullScoreData) } } + private void updateScoreTextBox() + { + if (ruleset.Value.ShortName == "osu" && legacyScoreSwitchButton.Current.Value) + { + scoreTextBox.PlaceholderText = "0"; + scoreTextBox.MaxValue = int.MaxValue; + scoreTextBox.Show(); + } + else if (ruleset.Value.ShortName == "mania") + { + scoreTextBox.PlaceholderText = "1000000"; + scoreTextBox.MaxValue = 1000000; + scoreTextBox.Show(); + } + else + { + scoreTextBox.Hide(); + } + } + private void fixupTextBox(LabelledTextBox textbox) { // This is a hack around TextBox's way of updating layout and positioning of text @@ -897,7 +931,6 @@ private void resetCalculations() createCalculators(); resetMods(); - legacyTotalScore = null; calculateDifficulty(); calculatePerformance(); @@ -989,8 +1022,6 @@ private void showError(string message, bool log = true) notificationDisplay.Display(new Notification(message)); } - private long? legacyTotalScore; - private void populateSettingsFromScore(long scoreId) { if (scoreIdPopulateButton.State.Value == ButtonState.Loading) @@ -1010,10 +1041,16 @@ private void populateSettingsFromScore(long scoreId) changeBeatmap(scoreInfo.BeatmapID.ToString()); } + legacyScoreSwitchButton.Current.Value = scoreInfo.IsLegacyScore; + ruleset.Value = rulesets.GetRuleset(scoreInfo.RulesetID); appliedMods.Value = scoreInfo.Mods.Select(x => x.ToMod(ruleset.Value.CreateInstance())).ToList(); - legacyTotalScore = scoreInfo.LegacyTotalScore; + if (scoreInfo.LegacyTotalScore != null) + { + scoreTextBox.Value.Value = (int)scoreInfo.LegacyTotalScore; + scoreTextBox.Text = scoreInfo.LegacyTotalScore.ToString(); + } fullScoreDataSwitch.Current.Value = true; From 6687a9af3f0bc05956ad0979179f2d73692897e9 Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Mon, 30 Jun 2025 14:56:29 +0300 Subject: [PATCH 2/4] Use legacy switch for lazer info too --- PerformanceCalculatorGUI/Screens/SimulateScreen.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index 873b37c05a..ef9b2a506c 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -521,7 +521,11 @@ private void load(OsuColour osuColour) sliderTailMissesTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance()); comboTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance()); scoreTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance()); - legacyScoreSwitchButton.Current.BindValueChanged(_ => updateScoreTextBox()); + legacyScoreSwitchButton.Current.BindValueChanged(_ => + { + updateMissesTextboxes(); + updateScoreTextBox(); + }); fullScoreDataSwitch.Current.BindValueChanged(val => updateAccuracyParams(val.NewValue)); @@ -1141,7 +1145,7 @@ private void updateMissesTextboxes() if (ruleset.Value.ShortName == "osu") { // Large tick misses and slider tail misses are only relevant in PP if slider head accuracy exists - if (appliedMods.Value.OfType().Any(m => m.NoSliderHeadAccuracy.Value)) + if (legacyScoreSwitchButton.Current.Value) { missesContainer.Content = new[] { new[] { missesTextBox } }; missesContainer.ColumnDimensions = [new Dimension()]; From 4f2f5ff0a3104a985e79fffb4670dfe8aeb81b4c Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Mon, 30 Jun 2025 15:10:35 +0300 Subject: [PATCH 3/4] Enable legacy score switch only when CL is enabled --- PerformanceCalculatorGUI/Screens/SimulateScreen.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index ef9b2a506c..ea1b8b5fce 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -573,6 +573,7 @@ private void modsChanged(ValueChangedEvent> mods) if (working is null) return; + updateScoreTextBox(); updateMissesTextboxes(); // recreate calculators to update DHOs @@ -765,7 +766,6 @@ private void populateScoreParams() largeTickMissesTextBox.Hide(); sliderTailMissesTextBox.Hide(); scoreTextBox.Hide(); - legacyScoreSwitchButton.Hide(); if (ruleset.Value.ShortName == "osu" || ruleset.Value.ShortName == "taiko" || ruleset.Value.ShortName == "fruits") { @@ -780,7 +780,6 @@ private void populateScoreParams() { largeTickMissesTextBox.Show(); sliderTailMissesTextBox.Show(); - legacyScoreSwitchButton.Show(); scoreTextBox.Value.Value = 0; scoreTextBox.Text = string.Empty; @@ -889,6 +888,16 @@ private void updateAccuracyParams(bool useFullScoreData) private void updateScoreTextBox() { + if (!appliedMods.Value.OfType().Any(m => m.UsesDefaultConfiguration)) + { + legacyScoreSwitchButton.Current.Value = false; + legacyScoreSwitchButton.Hide(); + } + else if (ruleset.Value.ShortName == "osu") + { + legacyScoreSwitchButton.Show(); + } + if (ruleset.Value.ShortName == "osu" && legacyScoreSwitchButton.Current.Value) { scoreTextBox.PlaceholderText = "0"; From d993be4649e45f6645fc9f442a46de758e322d0e Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Mon, 30 Jun 2025 15:22:04 +0300 Subject: [PATCH 4/4] Set legacy switch to true automatically --- PerformanceCalculatorGUI/Screens/SimulateScreen.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs index ea1b8b5fce..6f56fe25da 100644 --- a/PerformanceCalculatorGUI/Screens/SimulateScreen.cs +++ b/PerformanceCalculatorGUI/Screens/SimulateScreen.cs @@ -573,6 +573,10 @@ private void modsChanged(ValueChangedEvent> mods) if (working is null) return; + // We expect that if user have added CL mod - they want to calculate legacy score + if (!mods.OldValue.OfType().Any() && mods.NewValue.OfType().Any(m => m.UsesDefaultConfiguration)) + legacyScoreSwitchButton.Current.Value = true; + updateScoreTextBox(); updateMissesTextboxes();