Skip to content

Commit 04c7769

Browse files
committed
FIX: 1) check empty beatmap; 2) escape [ and ] in filename
1 parent 43c8bc1 commit 04c7769

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

BmsToOsu/Converter/SampleToMp3.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ private class FilterComplex
2020
(@"\", @"\\\\"),
2121
(@"=", @"\\\="),
2222
(@",", @"\,"),
23+
(@"[", @"\["),
24+
(@"]", @"\]"),
2325
(@":", @"\\\:"),
2426
(@"'", @"\\\'")
2527
};
@@ -151,7 +153,7 @@ public void GenerateMp3(BmsFileData data, string output)
151153
{
152154
var allSoundList = data.GetSoundFileList();
153155

154-
var groupSize = Math.Min(allSoundList.Count / 10, 1300);
156+
var groupSize = Math.Max(Math.Min(allSoundList.Count / 10, 1300), 10);
155157

156158
var groupedSoundList = new List<(List<(double StartTime, string SoundFile)> SoundList, string Output)>();
157159

BmsToOsu/Entity/BmsFileData.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ public static BmsFileData FromFile(string fp)
540540
startTrackAt += fullLengthOfTrack;
541541
}
542542

543+
if (data.HitObject.Values.All(x => !x.Any()) && !data.SoundEffects.Any())
544+
{
545+
Log.Error($"{fp}: The beatmap has no object, skipping...");
546+
throw new InvalidDataException();
547+
}
548+
543549
data.BgaFrames.Sort((a, b) => a.StartTime.CompareTo(b.StartTime));
544550
return data;
545551
}

0 commit comments

Comments
 (0)