1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Fix some older beatmaps having missing backgrounds

Closes https://github.com/ppy/osu/issues/20824.

Note that this will require a reimport of beatmaps as it is baked into the database. Probably not worth making a migration for at this point in time.
This commit is contained in:
Dean Herbert 2022-10-19 16:01:07 +09:00
parent 31f499a950
commit 59e2478b0e

View File

@ -355,6 +355,14 @@ namespace osu.Game.Beatmaps.Formats
switch (type)
{
case LegacyEventType.Sprite:
// Generally, the background is the first thing defined in a beatmap file.
// In some older beatmaps, it is not present and replaced by a storyboard-level background instead.
// Allow the first sprite (by file order) to act as the background in such cases.
if (string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.BackgroundFile))
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[3]);
break;
case LegacyEventType.Background:
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
break;