Fix extensions not being specified in time for realm file caching

This commit is contained in:
Dean Herbert 2022-03-23 13:36:33 +09:00
parent a7f63fb034
commit e1236e07ad
3 changed files with 20 additions and 15 deletions

View File

@ -21,8 +21,9 @@ namespace osu.Game.Skinning
protected override bool AllowManiaSkin => false;
protected override bool UseCustomSampleBanks => true;
public LegacyBeatmapSkin(BeatmapInfo beatmapInfo, IStorageResourceProvider resources, [CanBeNull] IResourceStore<byte[]> storage = null)
: base(createSkinInfo(beatmapInfo), storage ?? new RealmBackedResourceStore(beatmapInfo.BeatmapSet, resources.Files), resources, beatmapInfo.Path)
public LegacyBeatmapSkin(BeatmapInfo beatmapInfo, [CanBeNull] IStorageResourceProvider resources, [CanBeNull] IResourceStore<byte[]> storage = null)
: base(createSkinInfo(beatmapInfo), storage ?? (resources != null ? new RealmBackedResourceStore(beatmapInfo.BeatmapSet, resources.Files, new[] { @"ogg" }) : null), resources,
beatmapInfo.Path)
{
// Disallow default colours fallback on beatmap skins to allow using parent skin combo colours. (via SkinProvidingContainer)
Configuration.AllowDefaultComboColoursFallback = false;

View File

@ -13,9 +13,16 @@ namespace osu.Game.Skinning
{
private readonly Dictionary<string, string> fileToStoragePathMapping = new Dictionary<string, string>();
public RealmBackedResourceStore(IHasRealmFiles source, IResourceStore<byte[]> underlyingStore)
public RealmBackedResourceStore(IHasRealmFiles source, IResourceStore<byte[]> underlyingStore, string[] extensions = null)
: base(underlyingStore)
{
// Must be initialised before the file cache.
if (extensions != null)
{
foreach (string extension in extensions)
AddExtension(extension);
}
initialiseFileCache(source);
}

View File

@ -60,19 +60,15 @@ namespace osu.Game.Skinning
{
SkinInfo = skin.ToLive(resources.RealmAccess);
if (storage == null)
{
var realmStorage = new RealmBackedResourceStore(skin, resources.Files);
realmStorage.AddExtension("ogg");
storage = realmStorage;
}
storage ??= new RealmBackedResourceStore(skin, resources.Files, new[] { @"ogg" });
}
else
{
SkinInfo = skin.ToLiveUnmanaged();
}
if (storage != null)
{
var samples = resources.AudioManager?.GetSampleStore(storage);
if (samples != null)
samples.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY;
@ -80,6 +76,7 @@ namespace osu.Game.Skinning
Samples = samples;
Textures = new TextureStore(resources.CreateTextureLoaderStore(storage));
}
}
configurationStream ??= storage?.GetStream(@"skin.ini");