From ba258b8a054398a1a860220db453301245b064b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 02:56:00 +0900 Subject: [PATCH] Fix lack of fallback logic for custom bank samples Closes #2966. --- Was causing some beatmaps to not play all of their hitsounds --- osu.Game/Audio/SampleInfo.cs | 13 ++++++++++++- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 7e329ac651..9ed40c648e 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -29,6 +29,11 @@ namespace osu.Game.Audio /// public string Name; + /// + /// An optional suffix to provide priority lookup. Falls back to non-suffixed . + /// + public string Suffix; + /// /// The sample volume. /// @@ -41,9 +46,15 @@ namespace osu.Game.Audio { get { + if (!string.IsNullOrEmpty(Suffix)) + { + if (!string.IsNullOrEmpty(Namespace)) + yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; + yield return $"{Bank}-{Name}{Suffix}"; // Without namespace as a fallback even when we have a namespace + } + if (!string.IsNullOrEmpty(Namespace)) yield return $"{Namespace}/{Bank}-{Name}"; - yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 22a6acf459..c8874c3bc7 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -179,7 +179,7 @@ namespace osu.Game.Beatmaps.Formats var baseInfo = base.ApplyTo(sampleInfo); if (CustomSampleBank > 1) - baseInfo.Name += CustomSampleBank; + baseInfo.Suffix = CustomSampleBank.ToString(); return baseInfo; }