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 crashes when attempting to change from a custom ruleset with mods selected to another #30195

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Oct 10, 2024

RFC. Closes #30163.

If I'm to be blunt, the decoupled stuff in song select makes my head spin. I spent a solid 20 minutes thinking how I was going to fix this one but then finally realised that generally most of the cause there was the fact that AdvancedStats was seeing the new rulesets before the "ensure global selected mods are valid for current ruleset" logic, and so decided to just delay that until the decoupled transfer thingamajig happens.

I was honestly considering combining BeatmapInfo, Ruleset, and Mods into one property on AdvancedStats. I figured I'd rather not push my luck and try the baseline version first, but I honestly think that direction is going to be required at some point to properly corral all of the decoupled madness taking place in song select.

The nice thing is that due to this, one previous hack is now removable after AdvancedStats has been weaned off the global mods bindable. I think this is a win all things considered? But I'm unsure of how ugly this in general is compared to the current state...

@peppy
Copy link
Member

peppy commented Oct 10, 2024

If I'm to be blunt, the decoupled stuff in song select makes my head spin.

Have brought this up (likely IRL) that it needs to not exist, and be handled more local to the places that debounce needs to apply. Although I don't know how feasible that will be to make happen.

@peppy peppy self-requested a review October 10, 2024 11:28
@LumpBloom7
Copy link
Contributor

I did a quick test on this branch, and the crash still occurs for the same reason. (mods not being valid for the updated ruleset)

Swapping these two lines around seems to avoid the crash by ensuring that mods are in a sane state beforehand. The ruleset will still be wrong when updating the statistics after mod changes, but it should correct itself when the method is run again when the ruleset changes.

bdach added 2 commits October 10, 2024 14:22
Closes ppy#30163.

If I'm to be blunt, the decoupled stuff in song select makes my head
spin. I spent a solid 20 minutes thinking how I was going to fix this
one but then finally realised that generally most of the cause there
was the fact that `AdvancedStats` was seeing the new rulesets *before*
the "ensure global selected mods are valid for current ruleset" logic,
and so decided to just _delay_ that until the decoupled transfer
thingamajig happens.

I was honestly considering combining `BeatmapInfo`, `Ruleset`, and
`Mods` into one property on `AdvancedStats`. I figured I'd rather not
push my luck and try the baseline version first, but I honestly think
that direction is going to be required at some point to properly corral
all of the decoupled madness taking place in song select.
This is now removable after `AdvancedStats` has been weaned off the
global mods bindable. I think this is a win all things considered?
@bdach bdach force-pushed the advanced-stats-stupid-shenanigans branch from 96f621c to 687bdad Compare October 10, 2024 12:22
@bdach
Copy link
Collaborator Author

bdach commented Oct 10, 2024

I did a quick test on this branch, and the crash still occurs for the same reason.

I... have no idea how that happened. I swear on anything holy that I did test, with that line somewhere in there, then went to commit, noticed it missing, and added it back where I thought it should have gone. And probably tested after? But clearly not.

Anyway, the fact that swapping these lines "fixes" this truly speaks to the quality of this fix. I'll let the review process judge this. I have nothing better to offer, other than maybe this:

I was honestly considering combining BeatmapInfo, Ruleset, and Mods into one property on AdvancedStats

Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work? Code looks better than before the change?

@peppy peppy merged commit 14ecd56 into ppy:master Oct 10, 2024
13 checks passed
@bdach bdach deleted the advanced-stats-stupid-shenanigans branch October 11, 2024 06:18
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.

Attempting to change from a custom ruleset with mods selected to another results in a crash
3 participants