Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some mania replays failing to import #9993

Merged
merged 2 commits into from
Aug 28, 2020

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Aug 27, 2020

Found during testing of #9988.

Summary

At the start of each replay, stable adds two special replay frames: one at time 0, and one at the boundary of the skip to gameplay (minus one millisecond). The first frame was handled already:

if (i == 0 && diff == 0)
// osu-stable adds a zero-time frame before potentially valid negative user frames.
// we need to ignore this.
continue;

but the second wasn't. That same frame also happens to specify a position of (256, -500), which the mania decoder interpreted as belonging to the 9th column (as 256 == 1 << 8, and the shifts are zero-based).

Not all maps were affected by this, however; if a map doesn't have a skip at the start, the second frame has a time of -1, which would end up being caught by the second guard right underneath the first. In short, all replays that:

  • were for a mania map,
  • had below 9 keys,
  • whose associated map had a skip forward at the start,

would fail to import, catching this exception.

Resolve by replacing the existing check by a more directly targeted one.

Remarks

A rudimentary smoke test case is attached, to demonstrate that importing no longer crashes. I manually created this replay on stable, using a simple custom 7K beatmap. I actually found another bug during writing the test case, which will be addressed in a PR coming up ahead.

The check is quite ugly and brittle, but I'm not seeing another way of scoping this better. It shouldn't swallow frames it shouldn't, I think (stable replays are protected by the i < 2 index check, and lazer replays are protected by the Y check - there's nothing that has the right to return a meaningful frame with negative Y).

I'm not even sure if lazer has the same notion of a skip boundary that stable does, and even if it does, I'm not sure relying on that is any better than this.

@smoogipoo smoogipoo merged commit 9c0450b into ppy:master Aug 28, 2020
@bdach bdach deleted the mania-replay-crashes branch August 28, 2020 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants