mirror of
https://github.com/ppy/osu.git
synced 2026-05-18 14:10:33 +08:00
exclude all beatmap audios from the check
- prevents false positives on maps with multiple audios
This commit is contained in:
@@ -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<Issue> 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<RealmNamedFileUsage>();
|
||||
|
||||
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()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user