From 7b455efe342da2b4b56dfabd0f6ed6deb061340a Mon Sep 17 00:00:00 2001 From: Hivie Date: Fri, 15 Aug 2025 00:11:16 +0100 Subject: [PATCH] exclude all beatmap audios from the check - prevents false positives on maps with multiple audios --- .../Rulesets/Edit/Checks/CheckHitsoundsFormat.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Edit/Checks/CheckHitsoundsFormat.cs b/osu.Game/Rulesets/Edit/Checks/CheckHitsoundsFormat.cs index b498cf0c52..a34d6a3fd0 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckHitsoundsFormat.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckHitsoundsFormat.cs @@ -3,10 +3,12 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using ManagedBass; using osu.Framework.Audio.Callbacks; using osu.Game.Beatmaps; using osu.Game.Extensions; +using osu.Game.Models; using osu.Game.Rulesets.Edit.Checks.Components; namespace osu.Game.Rulesets.Edit.Checks @@ -24,13 +26,22 @@ namespace osu.Game.Rulesets.Edit.Checks public IEnumerable Run(BeatmapVerifierContext context) { var beatmapSet = context.CurrentDifficulty.Playable.BeatmapInfo.BeatmapSet; - var audioFile = beatmapSet?.GetFile(context.CurrentDifficulty.Playable.Metadata.AudioFile); if (beatmapSet == null) yield break; + // Collect all audio files from all difficulties to exclude them from the check, as they aren't hitsounds. + var audioFiles = new HashSet(); + + foreach (var difficulty in context.AllDifficulties) + { + var audioFile = beatmapSet.GetFile(difficulty.Playable.Metadata.AudioFile); + if (audioFile != null) + audioFiles.Add(audioFile); + } + foreach (var file in beatmapSet.Files) { - if (audioFile != null && ReferenceEquals(file.File, audioFile.File)) continue; + if (audioFiles.Any(audioFile => ReferenceEquals(file.File, audioFile.File))) continue; using (Stream data = context.CurrentDifficulty.Working.GetStream(file.File.GetStoragePath())) {