Skip to content

Commit

Permalink
Should load the resource file from the dll in the debug build.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jun 8, 2022
1 parent 83674f0 commit 5df8fc3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using osu.Game.Rulesets.Karaoke.Edit.Setup;
using osu.Game.Rulesets.Karaoke.Mods;
using osu.Game.Rulesets.Karaoke.Replays;
using osu.Game.Rulesets.Karaoke.Resources;
using osu.Game.Rulesets.Karaoke.Scoring;
using osu.Game.Rulesets.Karaoke.Skinning.Legacy;
using osu.Game.Rulesets.Karaoke.Statistics;
Expand Down Expand Up @@ -182,23 +183,16 @@ public override IResourceStore<byte[]> CreateResourceStore()
{
var store = new ResourceStore<byte[]>();

// add ruleset store
store.AddStore(getRulesetStore());
// add resource in the current dll.
store.AddStore(base.CreateResourceStore());

// add resource dll, it only works in the local because it will be packed into main dll in the resource build.
store.AddStore(new DllResourceStore(KaraokeResources.ResourceAssembly));

// add shader resource from font package.
store.AddStore(new NamespacedResourceStore<byte[]>(new ShaderResourceStore(), "Resources"));

return store;

IResourceStore<byte[]> getRulesetStore()
{
var rulesetStore = base.CreateResourceStore();
if (rulesetStore.GetAvailableResources().Any())
return rulesetStore;

// IRMerge might change the assembly name, which will cause resource not found.
return new NamespacedResourceStore<byte[]>(new DllResourceStore("osu.Game.Rulesets.Karaoke.dll"), @"Resources");
}
}

public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new KaraokeDifficultyCalculator(RulesetInfo, beatmap);
Expand Down

0 comments on commit 5df8fc3

Please sign in to comment.