1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-26 18:30:23 +08:00

Fix legacy beatmap export dropping background specification (#37892)

- Closes https://github.com/ppy/osu/issues/37884
- Closes https://github.com/ppy/osu/pull/37890

Due to lack of population of `Storyboard.Beatmap` and
`Storyboard.BeatmapInfo` post-decoding, `LegacyBeatmapExporter` would
completely drop background specifications on exported beatmap packages.
This affects both direct legacy export to file (`.osz`) as well as
beatmap submission.

I will not pretend that the API here is optimal but I do not see very
easy opportunities to curtail misuse. Storyboards can be treated as
either parts of a beatmap or standalone entities, and if a requirement
is added to forcibly provide a beatmap and its info when encoding out a
storyboard, I also foresee a requirement to bypass this later when
design mode is implemented, which would be a return to square one.

There is likely room for cleanup around `Storyboard` to maybe make this
nicer (remove passing of both `Beatmap` and `BeatmapInfo` and just pass
`Beatmap` instead, maybe shuffle some properties from `Beatmap` to
`Storyboard` to remove the requirement of having to bolt the beatmap on
to begin with). I leave voicing opinions on that, and how soon that
should be done, to reviewers. My primary intent at this time is to
hotfix a major issue in a released build.

The external editing feature is not involved in this bug and any
attempts to claim so are misdirections.
This commit is contained in:
Bartłomiej Dach
2026-05-24 13:55:53 +02:00
committed by GitHub
Unverified
parent 840d37e5d3
commit d89d6ed13f
3 changed files with 26 additions and 1 deletions
@@ -122,6 +122,29 @@ namespace osu.Game.Tests.Beatmaps.IO
() => Is.EqualTo(384).Within(0.00001));
}
[Test]
public void TestBackgroundSpecificationPreserved()
{
IWorkingBeatmap beatmap = null!;
MemoryStream outStream = null!;
// Ensure importer encoding is correct
AddStep("import beatmap", () => beatmap = importBeatmapFromArchives(@"241526 Soleily - Renatus.osz"));
AddAssert("beatmap background is correct", () => beatmap.BeatmapInfo.Metadata.BackgroundFile, () => Is.EqualTo("machinetop_background.jpg"));
// Ensure exporter legacy conversion is correct
AddStep("export", () =>
{
outStream = new MemoryStream();
new LegacyBeatmapExporter(LocalStorage)
.ExportToStream((BeatmapSetInfo)beatmap.BeatmapInfo.BeatmapSet!, outStream, null);
});
AddStep("import beatmap again", () => beatmap = importBeatmapFromStream(outStream));
AddAssert("beatmap background is still correct", () => beatmap.BeatmapInfo.Metadata.BackgroundFile, () => Is.EqualTo("machinetop_background.jpg"));
}
[Test]
public void TestExportStability()
{
@@ -74,6 +74,8 @@ namespace osu.Game.Database
using var storyboardStreamReader = new LineBufferedReader(storyboardStream);
var beatmapStoryboard = new LegacyStoryboardDecoder().Decode(storyboardStreamReader);
beatmapStoryboard.Beatmap = beatmapContent;
beatmapStoryboard.BeatmapInfo = beatmapInfo;
MutateBeatmap(model, playableBeatmap);
+1 -1
View File
@@ -18,7 +18,7 @@ namespace osu.Game.Storyboards
private readonly Dictionary<string, StoryboardLayer> layers = new Dictionary<string, StoryboardLayer>();
public IEnumerable<StoryboardLayer> Layers => layers.Values;
public BeatmapInfo BeatmapInfo = new BeatmapInfo();
public BeatmapInfo BeatmapInfo { get; set; } = new BeatmapInfo();
public IBeatmap Beatmap { get; set; } = new Beatmap();
/// <summary>