Automatically use an `AssemblyRulesetStore` if no custom store is registered

This commit is contained in:
Dean Herbert 2022-02-18 16:48:30 +09:00
parent 631c23ea3a
commit 420e2c538f
1 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Extensions.EnumExtensions; using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Logging;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Legacy;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
@ -44,7 +45,10 @@ public LegacyBeatmapDecoder(int version = LATEST_VERSION)
: base(version) : base(version)
{ {
if (RulesetStore == null) if (RulesetStore == null)
throw new InvalidOperationException($"Call {nameof(Decoder)}.{nameof(RegisterDependencies)} before using {nameof(LegacyBeatmapDecoder)}."); {
Logger.Log($"A {nameof(RulesetStore)} was not provided via {nameof(Decoder)}.{nameof(RegisterDependencies)}; falling back to default {nameof(AssemblyRulesetStore)}.");
RulesetStore = new AssemblyRulesetStore();
}
// BeatmapVersion 4 and lower had an incorrect offset (stable has this set as 24ms off) // BeatmapVersion 4 and lower had an incorrect offset (stable has this set as 24ms off)
offset = FormatVersion < 5 ? 24 : 0; offset = FormatVersion < 5 ? 24 : 0;