mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Gracefully handle beatmaps specifying images using the video storyboard type
This commit is contained in:
parent
eb37d740b1
commit
da947d8661
@ -363,6 +363,19 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[3]);
|
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[3]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LegacyEventType.Video:
|
||||||
|
string filename = CleanFilename(split[2]);
|
||||||
|
|
||||||
|
// Some very old beatmaps had incorrect type specifications for their backgrounds (ie. using 1 for VIDEO
|
||||||
|
// instead of 0 for BACKGROUND). To handle this gracefully, check the file extension against known supported
|
||||||
|
// video extensions and handle similar to a background if it doesn't match.
|
||||||
|
if (!OsuGameBase.VIDEO_EXTENSIONS.Contains(Path.GetExtension(filename)))
|
||||||
|
{
|
||||||
|
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case LegacyEventType.Background:
|
case LegacyEventType.Background:
|
||||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
|
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
|
||||||
break;
|
break;
|
||||||
|
@ -109,6 +109,14 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
int offset = Parsing.ParseInt(split[1]);
|
int offset = Parsing.ParseInt(split[1]);
|
||||||
string path = CleanFilename(split[2]);
|
string path = CleanFilename(split[2]);
|
||||||
|
|
||||||
|
// See handling in LegacyBeatmapDecoder for the special case where a video type is used but
|
||||||
|
// the file extension is not a valid video.
|
||||||
|
//
|
||||||
|
// This avoids potential weird crashes when ffmpeg attempts to parse an image file as a video
|
||||||
|
// (see https://github.com/ppy/osu/issues/22829#issuecomment-1465552451).
|
||||||
|
if (!OsuGameBase.VIDEO_EXTENSIONS.Contains(Path.GetExtension(path)))
|
||||||
|
break;
|
||||||
|
|
||||||
storyboard.GetLayer("Video").Add(new StoryboardVideo(path, offset));
|
storyboard.GetLayer("Video").Add(new StoryboardVideo(path, offset));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -276,7 +284,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "A":
|
case "A":
|
||||||
timelineGroup?.BlendingParameters.Add(easing, startTime, endTime, BlendingParameters.Additive, startTime == endTime ? BlendingParameters.Additive : BlendingParameters.Inherit);
|
timelineGroup?.BlendingParameters.Add(easing, startTime, endTime, BlendingParameters.Additive,
|
||||||
|
startTime == endTime ? BlendingParameters.Additive : BlendingParameters.Inherit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "H":
|
case "H":
|
||||||
|
Loading…
Reference in New Issue
Block a user