The recent changes related to adding support for working beatmap load
cancellation exposed a flaw in the beatmap difficulty cache. With the
way the difficulty computation logic was written, any error in the
calculation process (including beatmap load timeout, or cancellation)
would result in a 0.00 star rating being permanently cached in memory
for the given beatmap.
To resolve, change the difficulty cache's return type to nullable.
In failure scenarios, `null` is returned, rather than
`default(StarDifficulty)` as done previously.
`AdvancedStats` was locally assuming that the only changes in mods that
are relevant to it are if the mods are `IApplicableToDifficulty`. This
is not true, as other mods (such as `IApplicableToRate` mods, or more
recently, Flashlight) can also affect star difficulty, which is shown on
one of the bars in `AdvancedStats`.
Due to the use of bindable flow provided by `BeatmapDifficultyCache` in
this usage, the display would briefly flash to zero while difficulty
calculation was still running (as there is no way for a consumer of the
provided bindable to know whether the returned 0 is an actual 0 SR or a
"pending" calculation).
While I hope to fix this by making the bindable flow return nullable
values, I think this particular use case works better with non-bindable
flow so have switched across to that.
In some cases, applying the Difficulty Adjust mod without actually
changing any of the settings previously caused the bar in song select
beatmap details to appear red/blue instead of staying white.
This was caused by not accounting for floating-point imprecisions when
determining bar colour in AdvancedStats. To resolve, first check
equality with tolerance, and only then apply blue/red colours if that
equality check does not hold.