From 63aa3ddcba2ba2d1681c67e1d510ce245a079ef8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Sep 2021 17:45:23 +0900 Subject: [PATCH 01/18] Add animation support for mania notes --- .../Legacy/LegacyHoldNoteHeadPiece.cs | 8 +++--- .../Legacy/LegacyHoldNoteTailPiece.cs | 10 +++---- .../Skinning/Legacy/LegacyNotePiece.cs | 26 +++++++++++++------ osu.Game/Skinning/LegacySkinExtensions.cs | 3 +++ 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs index 21e5bdd5d6..1e75533442 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteHeadPiece.cs @@ -1,18 +1,18 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics; using osu.Game.Skinning; namespace osu.Game.Rulesets.Mania.Skinning.Legacy { public class LegacyHoldNoteHeadPiece : LegacyNotePiece { - protected override Texture GetTexture(ISkinSource skin) + protected override Drawable GetAnimation(ISkinSource skin) { // TODO: Should fallback to the head from default legacy skin instead of note. - return GetTextureFromLookup(skin, LegacyManiaSkinConfigurationLookups.HoldNoteHeadImage) - ?? GetTextureFromLookup(skin, LegacyManiaSkinConfigurationLookups.NoteImage); + return GetAnimationFromLookup(skin, LegacyManiaSkinConfigurationLookups.HoldNoteHeadImage) + ?? GetAnimationFromLookup(skin, LegacyManiaSkinConfigurationLookups.NoteImage); } } } diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs index 232b47ae27..e6d4291d79 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyHoldNoteTailPiece.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; -using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Skinning; @@ -18,12 +18,12 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy : new ValueChangedEvent(ScrollingDirection.Up, ScrollingDirection.Up)); } - protected override Texture GetTexture(ISkinSource skin) + protected override Drawable GetAnimation(ISkinSource skin) { // TODO: Should fallback to the head from default legacy skin instead of note. - return GetTextureFromLookup(skin, LegacyManiaSkinConfigurationLookups.HoldNoteTailImage) - ?? GetTextureFromLookup(skin, LegacyManiaSkinConfigurationLookups.HoldNoteHeadImage) - ?? GetTextureFromLookup(skin, LegacyManiaSkinConfigurationLookups.NoteImage); + return GetAnimationFromLookup(skin, LegacyManiaSkinConfigurationLookups.HoldNoteTailImage) + ?? GetAnimationFromLookup(skin, LegacyManiaSkinConfigurationLookups.HoldNoteHeadImage) + ?? GetAnimationFromLookup(skin, LegacyManiaSkinConfigurationLookups.NoteImage); } } } diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs index 31279796ce..e8ff1c23f3 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs @@ -1,9 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.Sprites; @@ -19,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy private readonly IBindable direction = new Bindable(); private Container directionContainer; - private Sprite noteSprite; + private Drawable noteAnimation; private float? minimumColumnWidth; @@ -39,7 +41,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Child = noteSprite = new Sprite { Texture = GetTexture(skin) } + Child = noteAnimation = GetAnimation(skin) }; direction.BindTo(scrollingInfo.Direction); @@ -50,12 +52,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy { base.Update(); - if (noteSprite.Texture != null) + Texture texture = null; + + if (noteAnimation is Sprite sprite) + texture = sprite.Texture; + else if (noteAnimation is TextureAnimation textureAnimation) + texture = textureAnimation.CurrentFrame; + + if (texture != null) { // The height is scaled to the minimum column width, if provided. float minimumWidth = minimumColumnWidth ?? DrawWidth; - - noteSprite.Scale = Vector2.Divide(new Vector2(DrawWidth, minimumWidth), noteSprite.Texture.DisplayWidth); + noteAnimation.Scale = Vector2.Divide(new Vector2(DrawWidth, minimumWidth), texture.DisplayWidth); } } @@ -73,9 +81,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy } } - protected virtual Texture GetTexture(ISkinSource skin) => GetTextureFromLookup(skin, LegacyManiaSkinConfigurationLookups.NoteImage); + [CanBeNull] + protected virtual Drawable GetAnimation(ISkinSource skin) => GetAnimationFromLookup(skin, LegacyManiaSkinConfigurationLookups.NoteImage); - protected Texture GetTextureFromLookup(ISkin skin, LegacyManiaSkinConfigurationLookups lookup) + [CanBeNull] + protected Drawable GetAnimationFromLookup(ISkin skin, LegacyManiaSkinConfigurationLookups lookup) { string suffix = string.Empty; @@ -93,7 +103,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy string noteImage = GetColumnSkinConfig(skin, lookup)?.Value ?? $"mania-note{FallbackColumnIndex}{suffix}"; - return skin.GetTexture(noteImage, WrapMode.ClampToEdge, WrapMode.ClampToEdge); + return skin.GetAnimation(noteImage, WrapMode.ClampToEdge, WrapMode.ClampToEdge, true, true); } } } diff --git a/osu.Game/Skinning/LegacySkinExtensions.cs b/osu.Game/Skinning/LegacySkinExtensions.cs index ec25268be4..fd1f905868 100644 --- a/osu.Game/Skinning/LegacySkinExtensions.cs +++ b/osu.Game/Skinning/LegacySkinExtensions.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -17,10 +18,12 @@ namespace osu.Game.Skinning { public static class LegacySkinExtensions { + [CanBeNull] public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-", bool startAtCurrentTime = true, double? frameLength = null) => source.GetAnimation(componentName, default, default, animatable, looping, applyConfigFrameRate, animationSeparator, startAtCurrentTime, frameLength); + [CanBeNull] public static Drawable GetAnimation(this ISkin source, string componentName, WrapMode wrapModeS, WrapMode wrapModeT, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-", bool startAtCurrentTime = true, double? frameLength = null) From c009e1473ddf319d2229a03bcab7e80e55356ad3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Sep 2021 17:47:12 +0900 Subject: [PATCH 02/18] Add extra safety check --- osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs index e8ff1c23f3..bbc7520bac 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy if (noteAnimation is Sprite sprite) texture = sprite.Texture; - else if (noteAnimation is TextureAnimation textureAnimation) + else if (noteAnimation is TextureAnimation textureAnimation && textureAnimation.FrameCount > 0) texture = textureAnimation.CurrentFrame; if (texture != null) From 34bde293abebbe144c6e7ab425aa874af8289da2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Sep 2021 13:26:39 +0900 Subject: [PATCH 03/18] Fix tests --- osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs index bbc7520bac..321a87f8b1 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyNotePiece.cs @@ -21,6 +21,8 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy private readonly IBindable direction = new Bindable(); private Container directionContainer; + + [CanBeNull] private Drawable noteAnimation; private float? minimumColumnWidth; @@ -41,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Child = noteAnimation = GetAnimation(skin) + Child = noteAnimation = GetAnimation(skin) ?? Empty() }; direction.BindTo(scrollingInfo.Direction); From 187c557ea8105dc1db329cdf6828bc2a79fc41dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Aug 2021 02:21:45 +0900 Subject: [PATCH 04/18] Begin migrating settings implementation across to realm --- osu.Game/Configuration/RealmSetting.cs | 33 +++++++++++++++++++++++++ osu.Game/Configuration/SettingsStore.cs | 25 ++++++++++--------- osu.Game/OsuGameBase.cs | 4 +-- osu.Game/Rulesets/RulesetConfigCache.cs | 4 +-- 4 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 osu.Game/Configuration/RealmSetting.cs diff --git a/osu.Game/Configuration/RealmSetting.cs b/osu.Game/Configuration/RealmSetting.cs new file mode 100644 index 0000000000..b773796067 --- /dev/null +++ b/osu.Game/Configuration/RealmSetting.cs @@ -0,0 +1,33 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Database; +using Realms; + +namespace osu.Game.Configuration +{ + [MapTo(@"Setting")] + public class RealmSetting : RealmObject, IHasGuidPrimaryKey + { + [PrimaryKey] + public Guid ID { get; set; } = Guid.NewGuid(); + + public int? RulesetID { get; set; } + + public int? Variant { get; set; } + + public string Key { get; set; } + + [MapTo(nameof(Value))] + public string ValueString { get; set; } + + public object Value + { + get => ValueString; + set => ValueString = value.ToString(); + } + + public override string ToString() => $"{Key}=>{Value}"; + } +} diff --git a/osu.Game/Configuration/SettingsStore.cs b/osu.Game/Configuration/SettingsStore.cs index 86e84b0732..864fa3cf53 100644 --- a/osu.Game/Configuration/SettingsStore.cs +++ b/osu.Game/Configuration/SettingsStore.cs @@ -1,31 +1,34 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Game.Database; +using Realms; namespace osu.Game.Configuration { - public class SettingsStore : DatabaseBackedStore + public class RealmSettingsStore { - public event Action SettingChanged; + private readonly RealmContextFactory realmFactory; - public SettingsStore(DatabaseContextFactory contextFactory) - : base(contextFactory) + public RealmSettingsStore(RealmContextFactory realmFactory) { + this.realmFactory = realmFactory; } /// - /// Retrieve s for a specified ruleset/variant content. + /// Retrieve s for a specified ruleset/variant content. /// /// The ruleset's internal ID. /// An optional variant. - public List Query(int? rulesetId = null, int? variant = null) => - ContextFactory.Get().DatabasedSetting.Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList(); + public List Query(int? rulesetId = null, int? variant = null) + { + using (var context = realmFactory.GetForRead()) + return context.Realm.All().Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList(); + } - public void Update(DatabasedSetting setting) + public void Update(RealmSetting setting) { using (ContextFactory.GetForWrite()) { @@ -33,11 +36,9 @@ namespace osu.Game.Configuration Refresh(ref setting); setting.Value = newValue; } - - SettingChanged?.Invoke(); } - public void Delete(DatabasedSetting setting) + public void Delete(RealmSetting setting) { using (var usage = ContextFactory.GetForWrite()) usage.Context.Remove(setting); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index f4db0f2603..12f53df6e8 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -140,7 +140,7 @@ namespace osu.Game private FileStore fileStore; - private SettingsStore settingsStore; + private RealmSettingsStore settingsStore; private RulesetConfigCache rulesetConfigCache; @@ -279,7 +279,7 @@ namespace osu.Game migrateDataToRealm(); - dependencies.Cache(settingsStore = new SettingsStore(contextFactory)); + dependencies.Cache(settingsStore = new RealmSettingsStore(realmFactory)); dependencies.Cache(rulesetConfigCache = new RulesetConfigCache(settingsStore)); var powerStatus = CreateBatteryInfo(); diff --git a/osu.Game/Rulesets/RulesetConfigCache.cs b/osu.Game/Rulesets/RulesetConfigCache.cs index d42428638c..885fa249df 100644 --- a/osu.Game/Rulesets/RulesetConfigCache.cs +++ b/osu.Game/Rulesets/RulesetConfigCache.cs @@ -16,9 +16,9 @@ namespace osu.Game.Rulesets public class RulesetConfigCache : Component { private readonly ConcurrentDictionary configCache = new ConcurrentDictionary(); - private readonly SettingsStore settingsStore; + private readonly RealmSettingsStore settingsStore; - public RulesetConfigCache(SettingsStore settingsStore) + public RulesetConfigCache(RealmSettingsStore settingsStore) { this.settingsStore = settingsStore; } From 14314476f07ab0271ac49fbfa8a557d838676b04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Sep 2021 20:57:19 +0900 Subject: [PATCH 05/18] Update realm to latest version --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 941656bb70..5a302c5349 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,7 +35,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From a2f1752344061e1f9ae4f7a4679f872de90feeaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 14:39:47 +0900 Subject: [PATCH 06/18] Make settings works with current caching structure Will likely pull out that `RulesetConfigCache` next, but this is an "everything works" state. --- .../ManiaRulesetConfigManager.cs | 6 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 4 +- .../Configuration/OsuRulesetConfigManager.cs | 6 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 40 ++++++------- .../Testing/TestSceneRulesetDependencies.cs | 4 +- .../Configuration/DatabasedConfigManager.cs | 59 ++++++------------- osu.Game/Configuration/SettingsStore.cs | 21 +------ osu.Game/OsuGameBase.cs | 5 +- .../Settings/RulesetSettingsSubsection.cs | 4 +- .../Configuration/RulesetConfigManager.cs | 5 +- osu.Game/Rulesets/Ruleset.cs | 34 +++++------ osu.Game/Rulesets/RulesetConfigCache.cs | 34 ++++++++--- 12 files changed, 101 insertions(+), 121 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs index ac8168dfc9..d9bd0ab609 100644 --- a/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Configuration.Tracking; -using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Mania.UI; @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Mania.Configuration { public class ManiaRulesetConfigManager : RulesetConfigManager { - public ManiaRulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) - : base(settings, ruleset, variant) + public ManiaRulesetConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset, int? variant = null) + : base(realmFactory, ruleset, variant) { } diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 1f79dae280..7ad27b94eb 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -17,7 +17,7 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Replays.Types; using osu.Game.Beatmaps.Legacy; -using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; @@ -278,7 +278,7 @@ namespace osu.Game.Rulesets.Mania public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new ManiaReplayFrame(); - public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new ManiaRulesetConfigManager(settings, RulesetInfo); + public override IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => new ManiaRulesetConfigManager(realmFactory, RulesetInfo); public override RulesetSettingsSubsection CreateSettings() => new ManiaSettingsSubsection(this); diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 9589fd576f..23c25c6558 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.UI; @@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Osu.Configuration { public class OsuRulesetConfigManager : RulesetConfigManager { - public OsuRulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) - : base(settings, ruleset, variant) + public OsuRulesetConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset, int? variant = null) + : base(realmFactory, ruleset, variant) { } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index f4a93a571d..b7cb0c5313 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -1,41 +1,41 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Beatmaps; -using osu.Game.Graphics; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; +using System; using System.Collections.Generic; +using System.Linq; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Overlays.Settings; using osu.Framework.Input.Bindings; -using osu.Game.Rulesets.Osu.Edit; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Osu.Replays; -using osu.Game.Rulesets.Replays.Types; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.Legacy; -using osu.Game.Configuration; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Difficulty; -using osu.Game.Rulesets.Osu.Scoring; -using osu.Game.Rulesets.Scoring; -using osu.Game.Scoring; -using osu.Game.Skinning; -using System; -using System.Linq; -using osu.Framework.Extensions.EnumExtensions; +using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit.Setup; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Replays; +using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Osu.Skinning.Legacy; using osu.Game.Rulesets.Osu.Statistics; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.Replays.Types; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Scoring; using osu.Game.Screens.Edit.Setup; using osu.Game.Screens.Ranking.Statistics; +using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu { @@ -229,7 +229,7 @@ namespace osu.Game.Rulesets.Osu public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame(); - public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo); + public override IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => new OsuRulesetConfigManager(realmFactory, RulesetInfo); protected override IEnumerable GetValidHitResults() { diff --git a/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs index 8c6932e792..12960fd4d0 100644 --- a/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs +++ b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; @@ -74,7 +74,7 @@ namespace osu.Game.Tests.Testing } public override IResourceStore CreateResourceStore() => new NamespacedResourceStore(TestResources.GetStore(), @"Resources"); - public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new TestRulesetConfigManager(); + public override IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => new TestRulesetConfigManager(); public override IEnumerable GetModsFor(ModType type) => Array.Empty(); public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => null; diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs index b3783b45a8..0514d11e24 100644 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ b/osu.Game/Configuration/DatabasedConfigManager.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Bindables; using osu.Framework.Configuration; +using osu.Game.Database; using osu.Game.Rulesets; namespace osu.Game.Configuration @@ -13,19 +14,17 @@ namespace osu.Game.Configuration public abstract class DatabasedConfigManager : ConfigManager where TLookup : struct, Enum { - private readonly SettingsStore settings; + private readonly RealmContextFactory realmFactory; private readonly int? variant; - private List databasedSettings; + private List databasedSettings; private readonly RulesetInfo ruleset; - private bool legacySettingsExist; - - protected DatabasedConfigManager(SettingsStore settings, RulesetInfo ruleset = null, int? variant = null) + protected DatabasedConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset = null, int? variant = null) { - this.settings = settings; + this.realmFactory = realmFactory; this.ruleset = ruleset; this.variant = variant; @@ -36,39 +35,22 @@ namespace osu.Game.Configuration protected override void PerformLoad() { - databasedSettings = settings.Query(ruleset?.ID, variant); - legacySettingsExist = databasedSettings.Any(s => int.TryParse(s.Key, out _)); + var rulesetID = ruleset?.ID; + + // As long as RulesetConfigCache exists, there is no need to subscribe to realm events. + databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetID && b.Variant == variant).ToList(); } protected override bool PerformSave() { - lock (dirtySettings) - { - foreach (var setting in dirtySettings) - settings.Update(setting); - dirtySettings.Clear(); - } - + // do nothing, realm saves immediately return true; } - private readonly List dirtySettings = new List(); - protected override void AddBindable(TLookup lookup, Bindable bindable) { base.AddBindable(lookup, bindable); - if (legacySettingsExist) - { - var legacySetting = databasedSettings.Find(s => s.Key == ((int)(object)lookup).ToString()); - - if (legacySetting != null) - { - bindable.Parse(legacySetting.Value); - settings.Delete(legacySetting); - } - } - var setting = databasedSettings.Find(s => s.Key == lookup.ToString()); if (setting != null) @@ -77,12 +59,15 @@ namespace osu.Game.Configuration } else { - settings.Update(setting = new DatabasedSetting + realmFactory.Context.Write(() => { - Key = lookup.ToString(), - Value = bindable.Value, - RulesetID = ruleset?.ID, - Variant = variant, + realmFactory.Context.Add(setting = new RealmSetting + { + Key = lookup.ToString(), + Value = bindable.Value, + RulesetID = ruleset?.ID, + Variant = variant, + }); }); databasedSettings.Add(setting); @@ -90,13 +75,7 @@ namespace osu.Game.Configuration bindable.ValueChanged += b => { - setting.Value = b.NewValue; - - lock (dirtySettings) - { - if (!dirtySettings.Contains(setting)) - dirtySettings.Add(setting); - } + realmFactory.Context.Write(() => setting.Value = b.NewValue); }; } } diff --git a/osu.Game/Configuration/SettingsStore.cs b/osu.Game/Configuration/SettingsStore.cs index 864fa3cf53..49775927b1 100644 --- a/osu.Game/Configuration/SettingsStore.cs +++ b/osu.Game/Configuration/SettingsStore.cs @@ -4,15 +4,14 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Database; -using Realms; namespace osu.Game.Configuration { - public class RealmSettingsStore + public class SettingsStore { private readonly RealmContextFactory realmFactory; - public RealmSettingsStore(RealmContextFactory realmFactory) + public SettingsStore(RealmContextFactory realmFactory) { this.realmFactory = realmFactory; } @@ -27,21 +26,5 @@ namespace osu.Game.Configuration using (var context = realmFactory.GetForRead()) return context.Realm.All().Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList(); } - - public void Update(RealmSetting setting) - { - using (ContextFactory.GetForWrite()) - { - var newValue = setting.Value; - Refresh(ref setting); - setting.Value = newValue; - } - } - - public void Delete(RealmSetting setting) - { - using (var usage = ContextFactory.GetForWrite()) - usage.Context.Remove(setting); - } } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 12f53df6e8..600465b823 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -140,8 +140,6 @@ namespace osu.Game private FileStore fileStore; - private RealmSettingsStore settingsStore; - private RulesetConfigCache rulesetConfigCache; private SpectatorClient spectatorClient; @@ -279,8 +277,7 @@ namespace osu.Game migrateDataToRealm(); - dependencies.Cache(settingsStore = new RealmSettingsStore(realmFactory)); - dependencies.Cache(rulesetConfigCache = new RulesetConfigCache(settingsStore)); + dependencies.Cache(rulesetConfigCache = new RulesetConfigCache(realmFactory, RulesetStore)); var powerStatus = CreateBatteryInfo(); if (powerStatus != null) diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 93b07fbac7..9ff5b8935a 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.Configuration; @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings { /// /// A which provides subclasses with the - /// from the 's . + /// from the 's . /// public abstract class RulesetSettingsSubsection : SettingsSubsection { diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index 0ff3455f00..17dbd30103 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -3,14 +3,15 @@ using System; using osu.Game.Configuration; +using osu.Game.Database; namespace osu.Game.Rulesets.Configuration { public abstract class RulesetConfigManager : DatabasedConfigManager, IRulesetConfigManager where TLookup : struct, Enum { - protected RulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) - : base(settings, ruleset, variant) + protected RulesetConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset, int? variant = null) + : base(realmFactory, ruleset, variant) { } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index b0c3836774..cf4ea4f01d 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -5,32 +5,32 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; +using osu.Framework.Extensions; +using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; using osu.Framework.IO.Stores; +using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Overlays.Settings; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Replays.Types; -using osu.Game.Rulesets.UI; using osu.Game.Beatmaps.Legacy; -using osu.Game.Configuration; +using osu.Game.Database; +using osu.Game.Extensions; +using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Scoring; -using osu.Game.Scoring; -using osu.Game.Skinning; -using osu.Game.Users; -using JetBrains.Annotations; -using osu.Framework.Extensions; -using osu.Framework.Extensions.EnumExtensions; -using osu.Framework.Testing; -using osu.Game.Extensions; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Filter; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Replays.Types; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Scoring; using osu.Game.Screens.Edit.Setup; using osu.Game.Screens.Ranking.Statistics; +using osu.Game.Skinning; +using osu.Game.Users; namespace osu.Game.Rulesets { @@ -262,8 +262,8 @@ namespace osu.Game.Rulesets /// /// Creates the for this . /// - /// The to store the settings. - public virtual IRulesetConfigManager CreateConfig(SettingsStore settings) => null; + /// The to store the settings. + public virtual IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => null; /// /// A unique short name to reference this ruleset in online requests. diff --git a/osu.Game/Rulesets/RulesetConfigCache.cs b/osu.Game/Rulesets/RulesetConfigCache.cs index 885fa249df..afdf3219df 100644 --- a/osu.Game/Rulesets/RulesetConfigCache.cs +++ b/osu.Game/Rulesets/RulesetConfigCache.cs @@ -2,9 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Concurrent; +using System.Collections.Generic; using osu.Framework.Graphics; -using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Rulesets.Configuration; namespace osu.Game.Rulesets @@ -15,12 +15,29 @@ namespace osu.Game.Rulesets /// public class RulesetConfigCache : Component { - private readonly ConcurrentDictionary configCache = new ConcurrentDictionary(); - private readonly RealmSettingsStore settingsStore; + private readonly RealmContextFactory realmFactory; + private readonly RulesetStore rulesets; - public RulesetConfigCache(RealmSettingsStore settingsStore) + private readonly Dictionary configCache = new Dictionary(); + + public RulesetConfigCache(RealmContextFactory realmFactory, RulesetStore rulesets) { - this.settingsStore = settingsStore; + this.realmFactory = realmFactory; + this.rulesets = rulesets; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + // let's keep things simple for now and just retrieve all the required configs at startup.. + foreach (var ruleset in rulesets.AvailableRulesets) + { + if (ruleset.ID == null) + continue; + + configCache[ruleset.ID.Value] = ruleset.CreateInstance().CreateConfig(realmFactory); + } } /// @@ -34,7 +51,10 @@ namespace osu.Game.Rulesets if (ruleset.RulesetInfo.ID == null) return null; - return configCache.GetOrAdd(ruleset.RulesetInfo.ID.Value, _ => ruleset.CreateConfig(settingsStore)); + if (!configCache.TryGetValue(ruleset.RulesetInfo.ID.Value, out var config)) + return null; + + return config; } protected override void Dispose(bool isDisposing) From ac377a2e3c39235fa18b4be85b90b744b174a2cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 14:56:40 +0900 Subject: [PATCH 07/18] Remove unused `SettingsStore` --- .../Visual/Navigation/TestSceneOsuGame.cs | 1 - osu.Game/Configuration/SettingsStore.cs | 30 ------------------- 2 files changed, 31 deletions(-) delete mode 100644 osu.Game/Configuration/SettingsStore.cs diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs index b8232837b5..43459408d5 100644 --- a/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs +++ b/osu.Game.Tests/Visual/Navigation/TestSceneOsuGame.cs @@ -75,7 +75,6 @@ namespace osu.Game.Tests.Visual.Navigation typeof(FileStore), typeof(ScoreManager), typeof(BeatmapManager), - typeof(SettingsStore), typeof(RulesetConfigCache), typeof(OsuColour), typeof(IBindable), diff --git a/osu.Game/Configuration/SettingsStore.cs b/osu.Game/Configuration/SettingsStore.cs deleted file mode 100644 index 49775927b1..0000000000 --- a/osu.Game/Configuration/SettingsStore.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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 System.Linq; -using osu.Game.Database; - -namespace osu.Game.Configuration -{ - public class SettingsStore - { - private readonly RealmContextFactory realmFactory; - - public SettingsStore(RealmContextFactory realmFactory) - { - this.realmFactory = realmFactory; - } - - /// - /// Retrieve s for a specified ruleset/variant content. - /// - /// The ruleset's internal ID. - /// An optional variant. - public List Query(int? rulesetId = null, int? variant = null) - { - using (var context = realmFactory.GetForRead()) - return context.Realm.All().Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList(); - } - } -} From 2bcb3fd304ad8ca70bc1b998239ee10f70b94b1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 15:22:16 +0900 Subject: [PATCH 08/18] Add migration of existing settings --- osu.Game/OsuGameBase.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 600465b823..489d5b5e51 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -469,6 +469,25 @@ namespace osu.Game db.Context.RemoveRange(existingBindings); + var existingSettings = db.Context.DatabasedSetting; + + // only migrate data if the realm database is empty. + if (!usage.Realm.All().Any()) + { + foreach (var dkb in existingSettings) + { + usage.Realm.Add(new RealmSetting + { + ValueString = dkb.StringValue, + Key = dkb.Key, + RulesetID = dkb.RulesetID, + Variant = dkb.Variant + }); + } + } + + db.Context.RemoveRange(existingSettings); + usage.Commit(); } } From 5bb741b4e8126327e9fd4ccd76c76142f8fab39a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 15:22:43 +0900 Subject: [PATCH 09/18] Remove migration of key bindings --- osu.Game/Database/OsuDbContext.cs | 9 +---- .../Input/Bindings/DatabasedKeyBinding.cs | 39 ------------------- osu.Game/OsuGameBase.cs | 20 +--------- 3 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 osu.Game/Input/Bindings/DatabasedKeyBinding.cs diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index 68d186c65d..1d8322aadd 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -12,7 +12,6 @@ using osu.Game.Configuration; using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Scoring; -using DatabasedKeyBinding = osu.Game.Input.Bindings.DatabasedKeyBinding; using LogLevel = Microsoft.Extensions.Logging.LogLevel; using osu.Game.Skinning; @@ -24,14 +23,13 @@ namespace osu.Game.Database public DbSet BeatmapDifficulty { get; set; } public DbSet BeatmapMetadata { get; set; } public DbSet BeatmapSetInfo { get; set; } - public DbSet DatabasedSetting { get; set; } public DbSet FileInfo { get; set; } public DbSet RulesetInfo { get; set; } public DbSet SkinInfo { get; set; } public DbSet ScoreInfo { get; set; } // migrated to realm - public DbSet DatabasedKeyBinding { get; set; } + public DbSet DatabasedSetting { get; set; } private readonly string connectionString; @@ -138,11 +136,6 @@ namespace osu.Game.Database modelBuilder.Entity().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity().HasIndex(b => b.DeletePending); - modelBuilder.Entity().HasIndex(b => new { b.RulesetID, b.Variant }); - modelBuilder.Entity().HasIndex(b => b.IntAction); - modelBuilder.Entity().Ignore(b => b.KeyCombination); - modelBuilder.Entity().Ignore(b => b.Action); - modelBuilder.Entity().HasIndex(b => new { b.RulesetID, b.Variant }); modelBuilder.Entity().HasIndex(b => b.Hash).IsUnique(); diff --git a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs deleted file mode 100644 index ad3493d0fc..0000000000 --- a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.ComponentModel.DataAnnotations.Schema; -using osu.Framework.Input.Bindings; -using osu.Game.Database; - -namespace osu.Game.Input.Bindings -{ - [Table("KeyBinding")] - public class DatabasedKeyBinding : IKeyBinding, IHasPrimaryKey - { - public int ID { get; set; } - - public int? RulesetID { get; set; } - - public int? Variant { get; set; } - - [Column("Keys")] - public string KeysString { get; set; } - - [Column("Action")] - public int IntAction { get; set; } - - [NotMapped] - public KeyCombination KeyCombination - { - get => KeysString; - set => KeysString = value.ToString(); - } - - [NotMapped] - public object Action - { - get => IntAction; - set => IntAction = (int)value; - } - } -} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 489d5b5e51..ee97b27265 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -450,25 +450,7 @@ namespace osu.Game using (var db = contextFactory.GetForWrite()) using (var usage = realmFactory.GetForWrite()) { - var existingBindings = db.Context.DatabasedKeyBinding; - - // only migrate data if the realm database is empty. - if (!usage.Realm.All().Any()) - { - foreach (var dkb in existingBindings) - { - usage.Realm.Add(new RealmKeyBinding - { - KeyCombinationString = dkb.KeyCombination.ToString(), - ActionInt = (int)dkb.Action, - RulesetID = dkb.RulesetID, - Variant = dkb.Variant - }); - } - } - - db.Context.RemoveRange(existingBindings); - + // migrate ruleset settings. can be removed 20220315. var existingSettings = db.Context.DatabasedSetting; // only migrate data if the realm database is empty. From c36a67d06e718d7e5d05730c7110cb141d2e8ecb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 15:01:48 +0900 Subject: [PATCH 10/18] Fix some tests failing due to using a locally constructed ruleset --- osu.Game/Rulesets/RulesetConfigCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/RulesetConfigCache.cs b/osu.Game/Rulesets/RulesetConfigCache.cs index afdf3219df..f2c3121320 100644 --- a/osu.Game/Rulesets/RulesetConfigCache.cs +++ b/osu.Game/Rulesets/RulesetConfigCache.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets return null; if (!configCache.TryGetValue(ruleset.RulesetInfo.ID.Value, out var config)) - return null; + return ruleset.CreateConfig(realmFactory); return config; } From 520e5507645fe640073c25c9fc9e62e768a8ea80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 16:08:31 +0900 Subject: [PATCH 11/18] Bring back `SettingsStore` to avoid changing ruleset API for now Also fixes some remaining test failures due to locally constructed rulesets that are not being tracked by the game. --- .../ManiaRulesetConfigManager.cs | 6 +-- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 4 +- .../Configuration/OsuRulesetConfigManager.cs | 6 +-- osu.Game.Rulesets.Osu/OsuRuleset.cs | 44 +++++++++---------- .../Testing/TestSceneRulesetDependencies.cs | 4 +- .../Configuration/DatabasedConfigManager.cs | 32 +++++++------- osu.Game/Configuration/SettingsStore.cs | 20 +++++++++ .../Settings/RulesetSettingsSubsection.cs | 4 +- .../Configuration/RulesetConfigManager.cs | 5 +-- osu.Game/Rulesets/Ruleset.cs | 30 ++++++------- osu.Game/Rulesets/RulesetConfigCache.cs | 9 +++- 11 files changed, 95 insertions(+), 69 deletions(-) create mode 100644 osu.Game/Configuration/SettingsStore.cs diff --git a/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs index d9bd0ab609..ac8168dfc9 100644 --- a/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Configuration.Tracking; -using osu.Game.Database; +using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Mania.UI; @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Mania.Configuration { public class ManiaRulesetConfigManager : RulesetConfigManager { - public ManiaRulesetConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset, int? variant = null) - : base(realmFactory, ruleset, variant) + public ManiaRulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) + : base(settings, ruleset, variant) { } diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 7ad27b94eb..1f79dae280 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -17,7 +17,7 @@ using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Replays.Types; using osu.Game.Beatmaps.Legacy; -using osu.Game.Database; +using osu.Game.Configuration; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; @@ -278,7 +278,7 @@ namespace osu.Game.Rulesets.Mania public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new ManiaReplayFrame(); - public override IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => new ManiaRulesetConfigManager(realmFactory, RulesetInfo); + public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new ManiaRulesetConfigManager(settings, RulesetInfo); public override RulesetSettingsSubsection CreateSettings() => new ManiaSettingsSubsection(this); diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 23c25c6558..9589fd576f 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Database; +using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.UI; @@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Osu.Configuration { public class OsuRulesetConfigManager : RulesetConfigManager { - public OsuRulesetConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset, int? variant = null) - : base(realmFactory, ruleset, variant) + public OsuRulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) + : base(settings, ruleset, variant) { } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index b7cb0c5313..f4a93a571d 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -1,41 +1,41 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; using System.Collections.Generic; -using System.Linq; -using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Bindings; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Legacy; -using osu.Game.Database; -using osu.Game.Graphics; using osu.Game.Overlays.Settings; +using osu.Framework.Input.Bindings; +using osu.Game.Rulesets.Osu.Edit; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Osu.Replays; +using osu.Game.Rulesets.Replays.Types; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Configuration; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Difficulty; -using osu.Game.Rulesets.Osu.Edit; -using osu.Game.Rulesets.Osu.Edit.Setup; -using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Osu.Scoring; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Skinning; +using System; +using System.Linq; +using osu.Framework.Extensions.EnumExtensions; +using osu.Game.Rulesets.Osu.Edit.Setup; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Skinning.Legacy; using osu.Game.Rulesets.Osu.Statistics; -using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.Replays.Types; -using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; -using osu.Game.Scoring; using osu.Game.Screens.Edit.Setup; using osu.Game.Screens.Ranking.Statistics; -using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu { @@ -229,7 +229,7 @@ namespace osu.Game.Rulesets.Osu public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame(); - public override IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => new OsuRulesetConfigManager(realmFactory, RulesetInfo); + public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo); protected override IEnumerable GetValidHitResults() { diff --git a/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs index 12960fd4d0..8c6932e792 100644 --- a/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs +++ b/osu.Game.Tests/Testing/TestSceneRulesetDependencies.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Database; +using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; @@ -74,7 +74,7 @@ namespace osu.Game.Tests.Testing } public override IResourceStore CreateResourceStore() => new NamespacedResourceStore(TestResources.GetStore(), @"Resources"); - public override IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => new TestRulesetConfigManager(); + public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new TestRulesetConfigManager(); public override IEnumerable GetModsFor(ModType type) => Array.Empty(); public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList mods = null) => null; diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs index 0514d11e24..d6988e31b5 100644 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ b/osu.Game/Configuration/DatabasedConfigManager.cs @@ -18,13 +18,13 @@ namespace osu.Game.Configuration private readonly int? variant; - private List databasedSettings; + private List databasedSettings = new List(); private readonly RulesetInfo ruleset; - protected DatabasedConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset = null, int? variant = null) + protected DatabasedConfigManager(SettingsStore store = null, RulesetInfo ruleset = null, int? variant = null) { - this.realmFactory = realmFactory; + realmFactory = store?.Realm; this.ruleset = ruleset; this.variant = variant; @@ -37,8 +37,11 @@ namespace osu.Game.Configuration { var rulesetID = ruleset?.ID; - // As long as RulesetConfigCache exists, there is no need to subscribe to realm events. - databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetID && b.Variant == variant).ToList(); + if (realmFactory != null) + { + // As long as RulesetConfigCache exists, there is no need to subscribe to realm events. + databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetID && b.Variant == variant).ToList(); + } } protected override bool PerformSave() @@ -59,23 +62,22 @@ namespace osu.Game.Configuration } else { - realmFactory.Context.Write(() => + setting = new RealmSetting { - realmFactory.Context.Add(setting = new RealmSetting - { - Key = lookup.ToString(), - Value = bindable.Value, - RulesetID = ruleset?.ID, - Variant = variant, - }); - }); + Key = lookup.ToString(), + Value = bindable.Value, + RulesetID = ruleset?.ID, + Variant = variant, + }; + + realmFactory?.Context.Write(() => realmFactory.Context.Add(setting)); databasedSettings.Add(setting); } bindable.ValueChanged += b => { - realmFactory.Context.Write(() => setting.Value = b.NewValue); + realmFactory?.Context.Write(() => setting.Value = b.NewValue); }; } } diff --git a/osu.Game/Configuration/SettingsStore.cs b/osu.Game/Configuration/SettingsStore.cs new file mode 100644 index 0000000000..2bba20fb09 --- /dev/null +++ b/osu.Game/Configuration/SettingsStore.cs @@ -0,0 +1,20 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Database; + +namespace osu.Game.Configuration +{ + public class SettingsStore + { + // this class mostly exists as a wrapper to avoid breaking the ruleset API (see usage in RulesetConfigManager). + // it may cease to exist going forward, depending on how the structure of the config data layer changes. + + public readonly RealmContextFactory Realm; + + public SettingsStore(RealmContextFactory realmFactory) + { + Realm = realmFactory; + } + } +} diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 9ff5b8935a..93b07fbac7 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Game.Database; +using osu.Game.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Configuration; @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings { /// /// A which provides subclasses with the - /// from the 's . + /// from the 's . /// public abstract class RulesetSettingsSubsection : SettingsSubsection { diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index 17dbd30103..0ff3455f00 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -3,15 +3,14 @@ using System; using osu.Game.Configuration; -using osu.Game.Database; namespace osu.Game.Rulesets.Configuration { public abstract class RulesetConfigManager : DatabasedConfigManager, IRulesetConfigManager where TLookup : struct, Enum { - protected RulesetConfigManager(RealmContextFactory realmFactory, RulesetInfo ruleset, int? variant = null) - : base(realmFactory, ruleset, variant) + protected RulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) + : base(settings, ruleset, variant) { } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index cf4ea4f01d..b0c3836774 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -5,32 +5,32 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; -using osu.Framework.Extensions; -using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; using osu.Framework.IO.Stores; -using osu.Framework.Testing; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Legacy; -using osu.Game.Database; -using osu.Game.Extensions; using osu.Game.Overlays.Settings; -using osu.Game.Rulesets.Configuration; -using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Filter; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Replays.Types; -using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Configuration; +using osu.Game.Rulesets.Configuration; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; -using osu.Game.Screens.Edit.Setup; -using osu.Game.Screens.Ranking.Statistics; using osu.Game.Skinning; using osu.Game.Users; +using JetBrains.Annotations; +using osu.Framework.Extensions; +using osu.Framework.Extensions.EnumExtensions; +using osu.Framework.Testing; +using osu.Game.Extensions; +using osu.Game.Rulesets.Filter; +using osu.Game.Screens.Edit.Setup; +using osu.Game.Screens.Ranking.Statistics; namespace osu.Game.Rulesets { @@ -262,8 +262,8 @@ namespace osu.Game.Rulesets /// /// Creates the for this . /// - /// The to store the settings. - public virtual IRulesetConfigManager CreateConfig(RealmContextFactory realmFactory) => null; + /// The to store the settings. + public virtual IRulesetConfigManager CreateConfig(SettingsStore settings) => null; /// /// A unique short name to reference this ruleset in online requests. diff --git a/osu.Game/Rulesets/RulesetConfigCache.cs b/osu.Game/Rulesets/RulesetConfigCache.cs index f2c3121320..aeac052673 100644 --- a/osu.Game/Rulesets/RulesetConfigCache.cs +++ b/osu.Game/Rulesets/RulesetConfigCache.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Rulesets.Configuration; @@ -30,13 +31,15 @@ namespace osu.Game.Rulesets { base.LoadComplete(); + var settingsStore = new SettingsStore(realmFactory); + // let's keep things simple for now and just retrieve all the required configs at startup.. foreach (var ruleset in rulesets.AvailableRulesets) { if (ruleset.ID == null) continue; - configCache[ruleset.ID.Value] = ruleset.CreateInstance().CreateConfig(realmFactory); + configCache[ruleset.ID.Value] = ruleset.CreateInstance().CreateConfig(settingsStore); } } @@ -52,7 +55,9 @@ namespace osu.Game.Rulesets return null; if (!configCache.TryGetValue(ruleset.RulesetInfo.ID.Value, out var config)) - return ruleset.CreateConfig(realmFactory); + // any ruleset request which wasn't initialised on startup should not be stored to realm. + // this should only be used by tests. + return ruleset.CreateConfig(null); return config; } From 80ecf81be34ce87b350612b3932913e2556cbce8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 16:55:42 +0900 Subject: [PATCH 12/18] Rename all databased setting classes to be specific to rulesets for now --- .../Configuration/DatabasedConfigManager.cs | 84 ------------------- ...RealmSetting.cs => RealmRulesetSetting.cs} | 4 +- osu.Game/OsuGameBase.cs | 4 +- .../Configuration/RulesetConfigManager.cs | 73 +++++++++++++++- 4 files changed, 74 insertions(+), 91 deletions(-) delete mode 100644 osu.Game/Configuration/DatabasedConfigManager.cs rename osu.Game/Configuration/{RealmSetting.cs => RealmRulesetSetting.cs} (87%) diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs deleted file mode 100644 index d6988e31b5..0000000000 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Bindables; -using osu.Framework.Configuration; -using osu.Game.Database; -using osu.Game.Rulesets; - -namespace osu.Game.Configuration -{ - public abstract class DatabasedConfigManager : ConfigManager - where TLookup : struct, Enum - { - private readonly RealmContextFactory realmFactory; - - private readonly int? variant; - - private List databasedSettings = new List(); - - private readonly RulesetInfo ruleset; - - protected DatabasedConfigManager(SettingsStore store = null, RulesetInfo ruleset = null, int? variant = null) - { - realmFactory = store?.Realm; - this.ruleset = ruleset; - this.variant = variant; - - Load(); - - InitialiseDefaults(); - } - - protected override void PerformLoad() - { - var rulesetID = ruleset?.ID; - - if (realmFactory != null) - { - // As long as RulesetConfigCache exists, there is no need to subscribe to realm events. - databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetID && b.Variant == variant).ToList(); - } - } - - protected override bool PerformSave() - { - // do nothing, realm saves immediately - return true; - } - - protected override void AddBindable(TLookup lookup, Bindable bindable) - { - base.AddBindable(lookup, bindable); - - var setting = databasedSettings.Find(s => s.Key == lookup.ToString()); - - if (setting != null) - { - bindable.Parse(setting.Value); - } - else - { - setting = new RealmSetting - { - Key = lookup.ToString(), - Value = bindable.Value, - RulesetID = ruleset?.ID, - Variant = variant, - }; - - realmFactory?.Context.Write(() => realmFactory.Context.Add(setting)); - - databasedSettings.Add(setting); - } - - bindable.ValueChanged += b => - { - realmFactory?.Context.Write(() => setting.Value = b.NewValue); - }; - } - } -} diff --git a/osu.Game/Configuration/RealmSetting.cs b/osu.Game/Configuration/RealmRulesetSetting.cs similarity index 87% rename from osu.Game/Configuration/RealmSetting.cs rename to osu.Game/Configuration/RealmRulesetSetting.cs index b773796067..7623d1f948 100644 --- a/osu.Game/Configuration/RealmSetting.cs +++ b/osu.Game/Configuration/RealmRulesetSetting.cs @@ -7,8 +7,8 @@ using Realms; namespace osu.Game.Configuration { - [MapTo(@"Setting")] - public class RealmSetting : RealmObject, IHasGuidPrimaryKey + [MapTo(@"RulesetSetting")] + public class RealmRulesetSetting : RealmObject, IHasGuidPrimaryKey { [PrimaryKey] public Guid ID { get; set; } = Guid.NewGuid(); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index ee97b27265..4e4061db9d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -454,11 +454,11 @@ namespace osu.Game var existingSettings = db.Context.DatabasedSetting; // only migrate data if the realm database is empty. - if (!usage.Realm.All().Any()) + if (!usage.Realm.All().Any()) { foreach (var dkb in existingSettings) { - usage.Realm.Add(new RealmSetting + usage.Realm.Add(new RealmRulesetSetting { ValueString = dkb.StringValue, Key = dkb.Key, diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index 0ff3455f00..3f5472e52c 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -2,16 +2,83 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Bindables; +using osu.Framework.Configuration; using osu.Game.Configuration; +using osu.Game.Database; namespace osu.Game.Rulesets.Configuration { - public abstract class RulesetConfigManager : DatabasedConfigManager, IRulesetConfigManager + public abstract class RulesetConfigManager : ConfigManager, IRulesetConfigManager where TLookup : struct, Enum { - protected RulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) - : base(settings, ruleset, variant) + private readonly RealmContextFactory realmFactory; + + private readonly int? variant; + + private List databasedSettings = new List(); + + private readonly RulesetInfo ruleset; + + protected RulesetConfigManager(SettingsStore store, RulesetInfo ruleset, int? variant = null) { + realmFactory = store?.Realm; + this.ruleset = ruleset; + this.variant = variant; + + Load(); + + InitialiseDefaults(); + } + + protected override void PerformLoad() + { + var rulesetID = ruleset?.ID; + + if (realmFactory != null) + { + // As long as RulesetConfigCache exists, there is no need to subscribe to realm events. + databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetID && b.Variant == variant).ToList(); + } + } + + protected override bool PerformSave() + { + // do nothing, realm saves immediately + return true; + } + + protected override void AddBindable(TLookup lookup, Bindable bindable) + { + base.AddBindable(lookup, bindable); + + var setting = databasedSettings.Find(s => s.Key == lookup.ToString()); + + if (setting != null) + { + bindable.Parse(setting.Value); + } + else + { + setting = new RealmRulesetSetting + { + Key = lookup.ToString(), + Value = bindable.Value, + RulesetID = ruleset?.ID, + Variant = variant, + }; + + realmFactory?.Context.Write(() => realmFactory.Context.Add(setting)); + + databasedSettings.Add(setting); + } + + bindable.ValueChanged += b => + { + realmFactory?.Context.Write(() => setting.Value = b.NewValue); + }; } } } From dcfe9c67e3019f91e5b92f1e433dae48d4c79843 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 17:01:31 +0900 Subject: [PATCH 13/18] Make ruleset id non-nullable --- osu.Game/Configuration/RealmRulesetSetting.cs | 3 ++- osu.Game/OsuGameBase.cs | 4 +++- .../Configuration/RulesetConfigManager.cs | 15 +++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/RealmRulesetSetting.cs b/osu.Game/Configuration/RealmRulesetSetting.cs index 7623d1f948..c88a261ad2 100644 --- a/osu.Game/Configuration/RealmRulesetSetting.cs +++ b/osu.Game/Configuration/RealmRulesetSetting.cs @@ -13,7 +13,8 @@ namespace osu.Game.Configuration [PrimaryKey] public Guid ID { get; set; } = Guid.NewGuid(); - public int? RulesetID { get; set; } + [Indexed] + public int RulesetID { get; set; } public int? Variant { get; set; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 4e4061db9d..36406ded08 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -458,11 +458,13 @@ namespace osu.Game { foreach (var dkb in existingSettings) { + if (dkb.RulesetID == null) continue; + usage.Realm.Add(new RealmRulesetSetting { ValueString = dkb.StringValue, Key = dkb.Key, - RulesetID = dkb.RulesetID, + RulesetID = dkb.RulesetID.Value, Variant = dkb.Variant }); } diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index 3f5472e52c..a97976392a 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -20,12 +20,17 @@ namespace osu.Game.Rulesets.Configuration private List databasedSettings = new List(); - private readonly RulesetInfo ruleset; + private readonly int rulesetId; protected RulesetConfigManager(SettingsStore store, RulesetInfo ruleset, int? variant = null) { realmFactory = store?.Realm; - this.ruleset = ruleset; + + if (realmFactory != null && !ruleset.ID.HasValue) + throw new InvalidOperationException("Attempted to add databased settings for a non-databased ruleset"); + + rulesetId = ruleset.ID ?? -1; + this.variant = variant; Load(); @@ -35,12 +40,10 @@ namespace osu.Game.Rulesets.Configuration protected override void PerformLoad() { - var rulesetID = ruleset?.ID; - if (realmFactory != null) { // As long as RulesetConfigCache exists, there is no need to subscribe to realm events. - databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetID && b.Variant == variant).ToList(); + databasedSettings = realmFactory.Context.All().Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList(); } } @@ -66,7 +69,7 @@ namespace osu.Game.Rulesets.Configuration { Key = lookup.ToString(), Value = bindable.Value, - RulesetID = ruleset?.ID, + RulesetID = rulesetId, Variant = variant, }; From 15e3f95c87dfef94deccc3f0d349c1b8c32bfb3b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 17:02:39 +0900 Subject: [PATCH 14/18] Remove remnants of `DatabasedSetting` from `SkinInfo` This was never used --- osu.Game/Skinning/SkinInfo.cs | 3 --- osu.Game/Skinning/SkinStore.cs | 6 ------ 2 files changed, 9 deletions(-) diff --git a/osu.Game/Skinning/SkinInfo.cs b/osu.Game/Skinning/SkinInfo.cs index 851d71f914..2bf8668ec6 100644 --- a/osu.Game/Skinning/SkinInfo.cs +++ b/osu.Game/Skinning/SkinInfo.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using osu.Framework.Extensions.ObjectExtensions; -using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Extensions; using osu.Game.IO; @@ -39,8 +38,6 @@ namespace osu.Game.Skinning public List Files { get; set; } = new List(); - public List Settings { get; set; } - public bool DeletePending { get; set; } public static SkinInfo Default { get; } = new SkinInfo diff --git a/osu.Game/Skinning/SkinStore.cs b/osu.Game/Skinning/SkinStore.cs index 153eeda130..31cadb0a24 100644 --- a/osu.Game/Skinning/SkinStore.cs +++ b/osu.Game/Skinning/SkinStore.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. -using System.Linq; -using Microsoft.EntityFrameworkCore; using osu.Framework.Platform; using osu.Game.Database; @@ -14,9 +12,5 @@ namespace osu.Game.Skinning : base(contextFactory, storage) { } - - protected override IQueryable AddIncludesForDeletion(IQueryable query) => - base.AddIncludesForDeletion(query) - .Include(s => s.Settings); // don't include FileInfo. these are handled by the FileStore itself. } } From a150fb29960bde3dcd9150dc4143eaea4cbead5d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 17:09:02 +0900 Subject: [PATCH 15/18] Add nullability directive and make variant non-nullable --- osu.Game/Configuration/RealmRulesetSetting.cs | 9 ++++++--- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Rulesets/Configuration/RulesetConfigManager.cs | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Configuration/RealmRulesetSetting.cs b/osu.Game/Configuration/RealmRulesetSetting.cs index c88a261ad2..d1e1bb9ea2 100644 --- a/osu.Game/Configuration/RealmRulesetSetting.cs +++ b/osu.Game/Configuration/RealmRulesetSetting.cs @@ -5,6 +5,8 @@ using System; using osu.Game.Database; using Realms; +#nullable enable + namespace osu.Game.Configuration { [MapTo(@"RulesetSetting")] @@ -16,12 +18,13 @@ namespace osu.Game.Configuration [Indexed] public int RulesetID { get; set; } - public int? Variant { get; set; } + [Indexed] + public int Variant { get; set; } - public string Key { get; set; } + public string Key { get; set; } = string.Empty; [MapTo(nameof(Value))] - public string ValueString { get; set; } + public string ValueString { get; set; } = string.Empty; public object Value { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 36406ded08..46614ca0ad 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -465,7 +465,7 @@ namespace osu.Game ValueString = dkb.StringValue, Key = dkb.Key, RulesetID = dkb.RulesetID.Value, - Variant = dkb.Variant + Variant = dkb.Variant ?? 0, }); } } diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index a97976392a..f4b4e2978c 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Configuration { private readonly RealmContextFactory realmFactory; - private readonly int? variant; + private readonly int variant; private List databasedSettings = new List(); @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Configuration rulesetId = ruleset.ID ?? -1; - this.variant = variant; + this.variant = variant ?? 0; Load(); From a1d325cb22fb066f82f8561d46c2757214b38573 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 17:12:00 +0900 Subject: [PATCH 16/18] Mark key and value non-nullable (at realm end) and simplify `Value` logic --- osu.Game/Configuration/RealmRulesetSetting.cs | 13 ++++--------- osu.Game/OsuGameBase.cs | 2 +- .../Rulesets/Configuration/RulesetConfigManager.cs | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game/Configuration/RealmRulesetSetting.cs b/osu.Game/Configuration/RealmRulesetSetting.cs index d1e1bb9ea2..07e56ad8dd 100644 --- a/osu.Game/Configuration/RealmRulesetSetting.cs +++ b/osu.Game/Configuration/RealmRulesetSetting.cs @@ -21,17 +21,12 @@ namespace osu.Game.Configuration [Indexed] public int Variant { get; set; } + [Required] public string Key { get; set; } = string.Empty; - [MapTo(nameof(Value))] - public string ValueString { get; set; } = string.Empty; + [Required] + public string Value { get; set; } = string.Empty; - public object Value - { - get => ValueString; - set => ValueString = value.ToString(); - } - - public override string ToString() => $"{Key}=>{Value}"; + public override string ToString() => $"{Key} => {Value}"; } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 46614ca0ad..59a05aec4f 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -462,8 +462,8 @@ namespace osu.Game usage.Realm.Add(new RealmRulesetSetting { - ValueString = dkb.StringValue, Key = dkb.Key, + Value = dkb.StringValue, RulesetID = dkb.RulesetID.Value, Variant = dkb.Variant ?? 0, }); diff --git a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs index f4b4e2978c..a0ec8e3e0e 100644 --- a/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs +++ b/osu.Game/Rulesets/Configuration/RulesetConfigManager.cs @@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Configuration setting = new RealmRulesetSetting { Key = lookup.ToString(), - Value = bindable.Value, + Value = bindable.Value.ToString(), RulesetID = rulesetId, Variant = variant, }; @@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Configuration bindable.ValueChanged += b => { - realmFactory?.Context.Write(() => setting.Value = b.NewValue); + realmFactory?.Context.Write(() => setting.Value = b.NewValue.ToString()); }; } } From 4f1db5af40c79e038737eef75ab6859641b12fa4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Sep 2021 17:25:07 +0900 Subject: [PATCH 17/18] Attach migration memo to `DatabasedSetting` class for visibility --- osu.Game/Configuration/DatabasedSetting.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Configuration/DatabasedSetting.cs b/osu.Game/Configuration/DatabasedSetting.cs index f5c92b3029..fe1d51d57f 100644 --- a/osu.Game/Configuration/DatabasedSetting.cs +++ b/osu.Game/Configuration/DatabasedSetting.cs @@ -7,7 +7,7 @@ using osu.Game.Database; namespace osu.Game.Configuration { [Table("Settings")] - public class DatabasedSetting : IHasPrimaryKey + public class DatabasedSetting : IHasPrimaryKey // can be removed 20220315. { public int ID { get; set; } From 45b07aa362b7048ee9ceb3f31e34ad68b4399943 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Sep 2021 15:33:55 +0900 Subject: [PATCH 18/18] Add some basic animated textures to mania metric skin --- .../Resources/metrics-skin/mania-note1-0@2x.png | Bin 0 -> 1874 bytes .../Resources/metrics-skin/mania-note1-1@2x.png | Bin 0 -> 2828 bytes .../Resources/metrics-skin/mania-note1H-0@2x.png | Bin 0 -> 5154 bytes .../Resources/metrics-skin/mania-note1H-1@2x.png | Bin 0 -> 6025 bytes .../Resources/metrics-skin/mania-note2-0@2x.png | Bin 0 -> 1865 bytes .../Resources/metrics-skin/mania-note2-1@2x.png | Bin 0 -> 2847 bytes .../Resources/metrics-skin/mania-note2H@2x.png | Bin 0 -> 5294 bytes .../Resources/metrics-skin/mania-noteS@2x.png | Bin 0 -> 3963 bytes .../Resources/metrics-skin/mania-noteSH@2x.png | Bin 0 -> 3963 bytes 9 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1-0@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1-1@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1H-0@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1H-1@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2-0@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2-1@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2H@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-noteS@2x.png create mode 100644 osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-noteSH@2x.png diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1-0@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1-0@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..2db5d76e7828a025037cbe434f15eb5737ab749f GIT binary patch literal 1874 zcmbVNeM}Q)7=K|Ub}TA!n*`?ca%75Q+_j}p?w~+zVKiH@gJw1oKd#qDXX3h3;tje?9c zQB37iguV2wQ&c(tPt9~%tb*0_I!>}QLP#};mv%{9AU)ITBFGX-fNWH;lhMMxEr(&q zY1hK@l1&PeOHVnRxn&$xP?l#Q%SuSh4rgXS>0VqUpeccXy!29r$GuuO$cu}VrGbt}$AMAAKkB#ZWKdLY0U@x>KmoWcu$?njWj>g?#Ga zy#GqfTS{FNnosepn13qL z>>$Ks!i@|s5DZBf4O&&A5D{So`?1q>hV4#bHos zw~y>PloACbxnt55gE8?_jHq}{ly;^2Y@hhWd~Y=9EZ)G)%X1x@BES#*SJI+~E8)a9 zu1D=_Jy!IQ`h}`BYgCh~qvJ-*+kamf^KD~a)6qOWg(CIn^J%g|t1R;Bkq?mR$NK8z zWm8s8v8Bq-|Fkw4M=mbZt?GU^qxM4EwqpO){r%-vGRf-t&A>dzJrhI$AOj!_WPvAg zpAc@%`tIrY-7oemi>v7^bu3Q_ObGME?n78lS9{<~O++}L8r5x?ZLLFh4|K2@a_~og z-uz4Fzj@ieC0yof@*)jF{b7s^2A}O@=6-l9_eN7XGcgLBw&^qe%w_ezei|%1zuJA_#|#`j%ZyzmY@qf`!86;i>d$AW%2l;<{TVWuZ+l_Y39&;oKWxRB z&WhuUC)I|TE%z}Y?b*SteeW>t?!|>E%|q`2bHVUQc2V~o?PODTLqSZ(CU+)v(hPy0 z>v}KnFMZNg-p?(&SmhaN8e(ReWZ_w7ufNuP`)1Pc$mMg#Hk3D_4GaAKO<`emCl<8b z=~;KL>af4Fg?8RkE(*x@bT;_n4<4C@*KBCRN+SCreOz;m(X;%Y%Y0%@grpR*|En(F z>befubAdevZ!gSfzS28?T5+00KZR{h&nGEL7LW!~t)F6g-lDOgG5&n3&)Qtt0mnT0v*p($g)g-rNDiW6aJo J?47f?;%`E8Pn`e& literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1-1@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1-1@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7aded39f315120b9eb7c9fbac3c543faf90c22 GIT binary patch literal 2828 zcmbVOeK?bQAOCGR<@6%;R7%MXPoda5v*k4-)Nn}%#ca1(Z1>v6#u3huUa3o^S`KsS zlvJpslt|}1qG+>99^yEak-VKyt~Knr*V{RN)VZ#w{qy_%zSrmT`F_6N-}k=n?G5l- zH)p2lOaQ@J^-dN-8+>8Ap$%|%*04}@q7_Y>TK~&mxk>1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l+vPC|51Vr zxQUKmBrAS8aJJVb1F0`4n5}iIiI}(|e=Fd>uEn7N^e{JW#^|8$jr~Sv)%-FI0*a@N zUcK$qoYSIrQM0#$sdwRPA2Pe=_O|K!j2va=+3JncGlARPp=ZbD#z;6=Yg&};_kQdu zcckr?wc{)L%df3AS!jkYh|KDl_8!?$w!BFhHau04sZ5VQz7V;MCzIykISkJk8+uwR z;>(eyH78c-ysu(!4wx8#cFwrG;dxP_Zgcs``w6BfUWHa$?OKU0G?VBq4P4b`faYCQ zI)AUx)GAj)u%gO5vc^RlHZWy1Qmu-B12EtSJl^#rH)P=jN?cnKQBJlt2EM0HP_9Z# zVAAWH4r)R8oS9o2%F{!Ks?wfnC&(nyq3|=pGWQ>l3Odso-wv#5pIjXfAXE z)@^2z{**@$$yhj2|ECU$eEs!2972-Ks_MLHolV z*;zmJr`?G+(kwtBueQdNW7SvchUA(4sa<2l36d$b@B7=rUT&daWsmT`#>OC42__of zuTCsOLvV!yj25HOfLB!TG-g*53YG5QG?}I_wnmjr1A=e9;&b!2uN3-g>9yR+kaQF% YQlD)6McVfS`Fjd{JpJgUYomVrA1bYTegFUf literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1H-0@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1H-0@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..f11fb4f853f011a3e76be6851249fab8cfb31ace GIT binary patch literal 5154 zcmb_fcT`hZx4%J90Yygz6bFe|0FmB92`wOCC=!Y|fFT43m_iaD(os=FKvC&U0YitO zg&K+|=paZ72$5z(K&1EfF3vdbTW`(x{`lUzYh|5t&)xgCe|zuW$-U>UxvAlP9w8n8 z0QMVQ(7yx#9N-kl+`BUn_Cox@;TRQROSL4rP<_y3ETH2|bizW7@Mu@;B`n(cy60=G z1_10ji$mE`ZIKsY7$RO8y<;Oy!;^Nf01Y^egvNMasZb}ZD~_NkI$cvQ3dK2VirOe4 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E_o^>Iu#1vspAP}?QYOI!Z%i=Qg zesU?sd^=9jJ64^SHk+-xFu}Kq9%PxlA5+@JmP693&+a?P&G@cbEE4Avh`H@ zPHbvMop?)0qJ9pyF0>vK>sk0EY6}XCw0+p0%d&fvC3&jJH7y|_=dJ4`!_R)JW301Q zF?DcUAu%SCK832!pufe`8%Tc;Ft2;)>tMeJr<;Cze~-Oa>GG}D!~%!Bz9F8ls@(^K zUw_^|!#OpyIZ%dhJnNzRP`;}_P6vP*3gma*xRYti?|9r%)hJObwU$x-_D!ihhrC<{w`MhpK+yK~IRSR18T`zVFgSB6zxBqAM%Z<` z`sA*VQ?*yX*DC;Q95;hN{$EbqJ81uM>i$0;;??HOAiIIF&?C4D1oL(f956zd>KE!> Gz42f2c@AFy literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1H-1@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note1H-1@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4eac5f6f2a62e9ad22096d02b1ba310e69c00a82 GIT binary patch literal 6025 zcmb_g2UJr_w>}h61Vt%|NN9=*ND&A~=uMiT_bNi9gd|83dH_X5MZf|mz4sfR?J-uU8<-&X02rX{iMkFGF+#X|!7O3!o*_3oU}^xs za?Z!v9%B!^3h_W8WZZx2$OI$&e{%t9n!*0=9&i{&@$pm_vjaor zp#HirZy&?Z0GL&%skKKa+(X4vOjAQdEf~TeK)^8WBEbkhBpMQ|F7^j6gwg*!EGs7R zhYAL+F7^+n?4jl&x~Kq{h_Z~Fw1=FWoQSfDjHml`caQ7WFN(;^$zPI{QDvJF1h%w9sc;0|m>RtKM7~@M_%o~I8hseqX1qI0jDafD#yksw_sHn)w$;-;i zOEWa2(IH5Td$2STedaF)Js8>}z{elsgF=e@W^})f!eZ3L7_R;!2891VX_4qZ=ZP_6 zvcc~DvX^A!e#i8eA{6@Ht0EBp)J9`0VgK^?za&Omhxo%}En#RBHo$|iay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xDp!+x2?e6`s9K*aV6s?dy?>)j>Ag3bS(qdl~h>y$P(#`ty=|_Yq2JB zu6ylF(ycd4nOwJ2qod7y`npRu1Caaz(aHNB&zsh2s!h)m_NaKi@?PN$ei}{LW90N5 z($h0hrnw7z(iaBrkl#dMyoxyw^5QxY?m$qlP7mqq<-F)u{P7a*wx7m{bOcTqdaEQpyi{?L-0b3qmJ!Re( z@kV<`*7q~6bKiHbQf|lT?lS(H*R9~;sqgQLLYqk|<;xDQpa&ucznu)ROd<^>mR8>Z zqBP0py6}E=XpWK58t{~*cz!Kqe7P)Rlc<_yvv@n(x?J)$Q?Gs5JszSi$hQmo>#-z< zHNom5$9P~K+lxzj*4ABU7fR4W+X*cX_yXl+-SC`xTUwO~{POfFcq_+^KsmCcti7n4 z9vk^o-cj>naaF*L>?}%eP7;J_sVBQh-@KZafL2~9;ZE(wFK-y{ITdfIL_AyCz7$ZO z?G$u!xDGO^yD9)?6=SKt4zN0Sr$g18ZZ1AFv9Nx$)MZVt^W|creH8;Lj`AmFo3KN% zQYIHzqLe^L3+Df~YSzEir9>Fzu>VtmEL(TqAc_f)s#Z}I{dPEzK?fM=o9b2ST)X`r DP%iL7 literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2-0@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2-0@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..456cee538227bd08e4edcb652d421db6cf08d5a2 GIT binary patch literal 1865 zcmbVLeNYr-7=MqDPDjhi$;45%GX=G~-TP3y^-ekOKuaWdPv0DemM{G1ZoUlPs+wBpa2N<|Hm)nCs;TGK&%s2bJk&jEc^0YZQpvX;i#D z!-m;7Gv#tG$m6NSd5OtnUKXi$D(22X3|<@((3D6ZUV1qr;9jF*fES0dq(&9UfQgu8 zR6GhQ)n-S`EKecPDojaY7=}daRZhY|kPgS2hz8TBQA~%bbxI7wwR&8qLk5omy5pTo z@gz&!pfmU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m!Ldc@f23k^j5E^<6O^Jb|KzuMW~TcPELZTWcH{fSP?gk31&<$ zN94RsP(s@V9OS-KYmhe-9P5QN;$EC?t=vR%xO%RUbZ~OM7R>RYM>{(`Fkc`@bKX z-*oYWvpiO9%Z(=<-+_6I*ros$YIT zl0{1nx)XIuPo?K?v+0e<+c`J^?%3p_%C@uSx1qDYE+n^ja z`cHDkG7Ydc|LF1-fDj+K!_U@(zeXn$s>4<8%V}vn4Od|YyN?*VEdOw}x@t?s03ZR- nQ2mAe|K_(~7E(DD&s)?1(zQFTFZk)Z0sMGSe8@MQ|9s@%;dFKP literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2H@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-note2H@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e6da7a10550e46638ecb65a4460eea43eb4d66c8 GIT binary patch literal 5294 zcmb`KXHZjH)c5xZp#(%gX`(;`Q9&spMHE6*xKgBuND(Q5C`AY$z2%@+MO2C?5fDKs zp-6{Nq{K#*8tE;f^eTiF2zhcp+z;=je>q_qch-+06Ootsw7a zXH5VEP4#uon+Fcgr?kHK)gYjI0x}~>mw5$FXs=(|dR%4}_>Rjp3zhLl3YDguw=b0D zqB0dpaf=JwUrChX5p8Dfu8tuA(3aqR%rb;n`p2L31>p6K2M*@%Fo-{=7Cpq7)0;{7 zRHjT!q1D?YbGwq&l_;a2!0SO%jXl;A^2GQW`ibD4-hRm#Vrg#fRx##da9CgX46(pg z`zB>AzMYHV|8a9tw@}e7?x*vc9fC1)^X$$^l!G3AYoorqgW1%ZKe+M5z1m@t=a_G8 zYrMu0%I=Q@xj3DDCSYH*z@6l8qggFJnW9O$=k(S3AVbeAzEIrS7o5Bi=9}lYr2+-m zc)LI{{JLc###hUY;nTBhmfD=RSu@JLmNVjYyZcVX4%KaK`g~WTMH=5B5iNR7LIGQq zE}rtNaHo57VT0CM$f{=pG|-q+9Tokl@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)l;kWF=7YZ9{Kay&RE>d3s^!B4Xy31PHBG zs_QF1Hu6Oh>&P)PkxgM7s`S?`u=o8tMKNC<_LRN8cI3L?!DAC(Kk#dvGm8~!$N?G3 zRpsY^d+dv!rGf_^U7>~^ErX6md7O`=?vj^tOUdo}9fNPIR~n=AQdPvE8bz3_rH{Wj zHXzoLH7fvbAMC|^wHioL!Y?xbZ0XfYS#s*!=*3r7t4HxV@JCSl9nZ^-VB`h84KIIE zI_`0_@DMr9K1EkAz+6@bpH$&>db^}5WLEQzPkz&(QWW0B z0&SEPmt#icvcW$@LSqP=v=*rsbunOJT#Sy;5`%U0tzG<az>% z$_#Ab4*u>hKt{fkpI_kY86Q6Mg6*;j%;TXq5TXR>DgvfXEkryowwM`;4uLiruq79|&Bl(8kZSB;w}kG2Pb zHh7El(E|zCDAgNYHH%v45vQiX8dTJO>B;7ImyUfEZr*q^xl%H@6)*WsIjO4k<|lmYrWH?Edx HIXwI~zp|9c literal 0 HcmV?d00001 diff --git a/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-noteSH@2x.png b/osu.Game.Rulesets.Mania.Tests/Resources/metrics-skin/mania-noteSH@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..c9bc23e8d9233fbb3b3adb132c50eef6d7f78a11 GIT binary patch literal 3963 zcmb`KXHe72`p5Sd6A2*Fi-HnVK&8V$0Vx4Qs!EfN(tA-l0w&iZ2nxgl3JNG4M0y8- z5T!{|Ff=LB4j=-C9v~#SIWPV*|1)#%t9xF2XLo0Ip6A)`?(Anb&iIBd8_P)+005i5 z-c?foV2m!vL;ltHA)!b{b0SE`D#*;=EhyA6z!hk^_&d3x^nD%OT}@pbUBd5myQ%`f zeoFtUrg_-->g(S7D|NirDw%t_mPhsRH&ps0wx=kk!{c4Px{Wy7o(s`5trFz~m-V_g zT}vyxjFM-rAM#gRP|l%;0I<&Hse}Lk$w>QZ zHR$J=QF~o4Xr_ccigPF(4_a`qdO!~Q2Mmcr*HWv#4|eFB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