ErisApps / HitScoreVisualizer

Beat Saber plugin that colors the scores that pop up when you hit notes
MIT License
71 stars 13 forks source link

Updates for Beat Saber v1.31.0 #17

Closed daniel-chambers closed 3 months ago

daniel-chambers commented 1 year ago

I really like this mod, and I wanted to use it on the latest Beat Saber version, so I've taken the liberty of fixing it up. 🙂

The biggest breaking change is that class methods are no longer virtualized by BSIPA (afaik), and while I did add BepInExp.AssemblyPublicizer to the project, that doesn't make otherwise normal methods virtual. This means that the approach of replacing the built in FlyingScoreEffect with the HsvFlyingScoreEffect subclass no longer works, since the subclass can't override the methods it needs to replace.

My solution is to simply use Harmony patches to patch FlyingScoreEffect with the same code that HsvFlyingScoreEffect used. This now lives in FlyingCoreEffectPatch and HsvFlyingScoreEffect has been deleted. Most of the patching logic that used to live in the FlyingCoreEffectPatch.cs file was about patching EffectPoolsManualInstaller to install HsvFlyingScoreEffect as a replacement. This is no longer required. The only logic retained was the configuration of the bloom font on the FlyingScoreEffect's _text, which has been moved to the new EffectPoolsManualInstallerPatch.

The other breaking change is that PersistentSingleton is not built in any more and has been replaced with a substitute from BSML. The usage of MenuButtons class (which is a PersistentSingleton) used in SettingsControllerManager has been updated to reflect this, removing logic that is no longer necessary.