1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Fix beatmaps with multiple osb files potentially reading the storyboard from the wrong one

In stable, the storyboard filename is fixed. In lazer, we were always
looking for the first `.osb` in the database. In the case a beatmap
archive housed more than one `.osb` files, this may load the incorrect
one.

Using `GetDisplayString` here feels like it could potentially go wrong
in the future, so I'm open to hard-coding this locally (or using string
manipulation to remove the ` [creator_name]` portion of the beatmap's
filename). Open to opinions on that.

Fixes storyboard playback in https://osu.ppy.sh/beatmapsets/1913687#osu/3947758
This commit is contained in:
Dean Herbert 2023-01-25 17:11:14 +09:00
parent 4674956ccf
commit d15f8c2f3a

View File

@ -20,6 +20,7 @@ using osu.Framework.Statistics;
using osu.Framework.Testing;
using osu.Game.Beatmaps.Formats;
using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.IO;
using osu.Game.Skinning;
using osu.Game.Storyboards;
@ -268,7 +269,7 @@ namespace osu.Game.Beatmaps
Stream storyboardFileStream = null;
if (BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename is string storyboardFilename)
if (BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.Equals($"{BeatmapSetInfo.GetDisplayString()}.osb", StringComparison.OrdinalIgnoreCase))?.Filename is string storyboardFilename)
{
string storyboardFileStorePath = BeatmapSetInfo?.GetPathForFile(storyboardFilename);
storyboardFileStream = GetStream(storyboardFileStorePath);