1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 04:47:50 +08:00
Commit Graph

471 Commits

Author SHA1 Message Date
Bartłomiej Dach
cefbc76490
Fix selection being dropped when changing carousel sort mode from difficulty sort
Closes https://github.com/ppy/osu/issues/29738.

This "regressed" in https://github.com/ppy/osu/pull/29639, but if I
didn't know better, I'd go as far as saying that this looks like a .NET
bug, because the fact that PR broke it looks not sane.

The TL;DR on this is that before the pull in question, the offending
`.Contains()` check that this commit modifies was called on a
`List<BeatmapSetInfo>`. The pull changed the collection type to
`BeatmapSetInfo[]`. That said, the call is a LINQ call, so all good,
right?

Not really. First off, the default overload resolution order means that
the previous code would call `List<T>.Contains()`, and not
`Enumerable.Contains<T>()`. Then again, why would that matter? In both
cases `T` is still `BeatmapSetInfo`, right? Well... about that...

It is difficult to tell for sure what precisely is happening here,
because of what looks like runtime magic. The end *symptom* is that the
old code ended up calling `Array<BeatmapSetInfo>.IndexOf()`, and the new
code ends up calling... `Array<object>.IndexOf()`.

So while yes, `BeatmapSetInfo` implements `IEquatable` and
the expectation would be that `Equals<BeatmapSetInfo>()` should be
getting called, the type elision to `object` means that we're back to
reference equality semantics, because that's what
`EqualityComparer.Default<object>` is.

A five-minute github search across dotnet/runtime yields this:

	c4792a228e/src/coreclr/vm/array.cpp (L984-L990)

Now again, if I didn't know better, I'd see that "OPTIMIZATION:"
comment, see what transpired in this scenario, and call that
optimisation invalid, because it changes semantics. But I *probably*
know that the dotnet team knows better and am probably just going to
take it for what it is, because blame on that code looks to be years
old and it's probably not a new behaviour. (I haven't tested empirically
if it is.)

Instead the fix is just to tell the `.Contains()` method to use the
correct comparer.
2024-09-08 16:06:35 +02:00
Dean Herbert
4c6eb89530
Fix beatmap difficulties not being split out on first load
Closes https://github.com/ppy/osu/issues/29728.
2024-09-07 22:14:03 +09:00
Dean Herbert
dfe11dc68a
Use for with exposed IReadOnlyList rather than making internal container public 2024-09-04 15:25:36 +09:00
Dean Herbert
421f245c31
Fix per-frame allocations in BeatmapCarousel 2024-09-04 14:31:59 +09:00
Dean Herbert
7b6e62283f
Fix beatmap not being detached on hide/unhide
The explicit detach call was removed from `updateBeatmapSet`, causing
this to occur. We could optionally add it back (it will be a noop in all
cases though).
2024-08-30 18:50:08 +09:00
Dean Herbert
1b9942cb30
Mark BeatmapSets as internal 2024-08-30 18:44:04 +09:00
Dean Herbert
291dd5b101
Remove TODO 2024-08-30 18:37:27 +09:00
Dean Herbert
1776d38809
Remove loadedTestBeatmaps flag 2024-08-28 23:28:44 +09:00
Dean Herbert
e04b5bb3f2
Tidy up test beatmap loading 2024-08-28 23:28:44 +09:00
Dean Herbert
9123d2cb7f
Fix multiple test failures 2024-08-28 23:28:43 +09:00
Dean Herbert
dd4a1104e4
Always debounce external Filter requests (except for tests)
The only exception to the rule here was "when screen isn't active apply
without debounce" but I'm not sure we want this. It would cause a
stutter on returning to song select and I'm not even sure this is a
common scenario.

I'd rather remove it and see if someone finds an actual case where this
is an issue.
2024-08-28 19:13:50 +09:00
Dean Herbert
336abadbd1
Allow running initial filter criteria asynchronously
This reverts a portion of https://github.com/ppy/osu/pull/9539.

The rearrangement in `SongSelect` is required to get the initial filter
into `BeatmapCarousel` (and avoid the `FilterChanged` event firing,
causing a delayed/scheduled filter application).
2024-08-28 19:13:50 +09:00
Dean Herbert
b1f653899c
Fix enumeration over modified collection 2024-08-28 19:13:49 +09:00
Dean Herbert
81b36d897d
Fix null reference in change handling code 2024-08-28 19:13:49 +09:00
Dean Herbert
081c9eb21b
Fix incorrect cancellation / disposal handling of DetachedBeatmapStore 2024-08-28 17:21:19 +09:00
Dean Herbert
4d42274771
Use bindable list implementation 2024-08-28 16:03:37 +09:00
Dean Herbert
466ed5de78
Add basic detached beatmap store 2024-08-28 16:03:37 +09:00
Dean Herbert
b567ab2a39
Fix context menus sometimes not being clickable at song select
Closes https://github.com/ppy/osu/issues/21602.
2024-08-12 20:31:20 +09:00
Dean Herbert
0f29ed618a
Don't attempt to clear the carousel during realm blocking operation 2024-07-19 17:39:47 +09:00
Dean Herbert
0560214d5b
Fix beatmap carousel performance regression with large databases 2024-07-19 17:39:47 +09:00
Dean Herbert
123d3d2ff8
Add similar special case for insert after removal 2024-07-09 20:44:55 +09:00
Dean Herbert
920c0e4d25
Fix deleted beatmap sets potentially reappearing due to pending update requests 2024-07-09 17:08:26 +09:00
Dean Herbert
63b4327978
Ensure beatmap set is always detached when updating
Slight performance improvement by doing the detach as early as possible.
2024-07-09 17:08:25 +09:00
Dean Herbert
9a61adc4bc
Ensure other lists are cleared when realm is reset 2024-07-08 23:59:20 +09:00
Dean Herbert
8f271170e9
Coalesce beatmap updates 2024-07-08 20:05:18 +09:00
Dean Herbert
1095137a5b
Simplify tracking of hidden beatmaps
Handling a few extra events is preferrable to keeping a second realm
subscription live.
2024-07-08 20:05:18 +09:00
Dean Herbert
151c448535
Simplify tracking of beatmap sets in BeatmapCarousel 2024-07-08 20:05:18 +09:00
Dean Herbert
5350945340
Update HasFlag usages 2024-07-03 00:19:04 +09:00
Dean Herbert
6beae91d53
Ensure carousel panel depth is consistent based on vertical position
I thought this was already being handled, but it turns out that changing
sort mode (and potentially other operations) could break the depth of
display of panels due to pooling and what not.

This ensures consistency and also employs @bdach's suggestion of
reversing the depth above and below the current selection for a better
visual effect.
2024-06-26 21:10:29 +09:00
Dean Herbert
5d4509150b
Adjust beatmap carousel's spacing to remove dead-space
As discussed in https://github.com/ppy/osu/discussions/28599.

I think this feels better overall, and would like to apply the change
before other design changes to the carousel.
2024-06-26 11:56:58 +09:00
Bartłomiej Dach
659505f711
Adjust calls to GetContainingInputManager() 2024-06-18 07:41:19 +02:00
Dean Herbert
cc341b4119
Adjust beatmap carousel padding to avoid scrollbar disappearing underneath logo 2024-01-25 15:21:19 +09:00
Dean Herbert
1f0ad5cff2
Apply same fix in more places 2024-01-22 15:56:16 +09:00
Dean Herbert
74f05a5c4b
Use container itself rather than ScrollContent 2024-01-22 15:54:24 +09:00
Andrei Zavatski
cec4f670d1 Reduce allocation overhead in BeatmapCarousel 2024-01-22 03:12:23 +03:00
Dean Herbert
81c6fd5589
Load items closer to the centre of the screen as a priority 2024-01-04 19:25:12 +09:00
Dean Herbert
adac3b65ce
Fix beatmap carousel not preloading panels when off-screen 2024-01-04 19:25:12 +09:00
Nathan Tran
060bf8beff Fix rewind backtracking 2023-12-25 15:27:32 -08:00
Dean Herbert
7fa4dcf0fb
Fix selection retention logic copy paste failure 2023-12-20 19:27:57 +09:00
Dean Herbert
e003462f7d
Fix beatmap updates causing one extra carousel selection 2023-12-20 19:15:02 +09:00
Dean Herbert
64f62e7d90
Fix song select running updates when screen is not active
Who would have guessed that `Schedule` calls were there for a reason!

I've tidied things up. Most of the changes I've made here are not
required – the schedule is the main thing here. The reason the sound was
playing is because one-too-many schedules was removed causing beatmap
updates to update carousel specifics while still at the player loader
screen.

Note that the selection sound still plays on returning to song select,
but this is not a regression. I'm looking at fixing this in a separate
PR because I'm in a good place as far as understanding the logic right
now and it would be a waste to leave it broken.

Closes https://github.com/ppy/osu/issues/25875.
2023-12-20 17:31:09 +09:00
Dean Herbert
502e3edac3
Add missing invalidation call 2023-12-19 19:39:48 +09:00
Dean Herbert
8f5d21dc70
Actually fix realm selection retention regression 2023-12-19 18:10:55 +09:00
Dean Herbert
7e9c1b2acb
Use sender's realm (because we can) 2023-12-19 17:27:52 +09:00
Dean Herbert
25e3a8e82e
Fix a few of silly issues 2023-12-18 22:45:58 +09:00
Dean Herbert
5755fa214a
Cache non-filtered beatmap counts to massively improve count performance 2023-12-18 20:44:08 +09:00
Dean Herbert
6fa1f5ef9b
Simplify invalidation logic
The only case where this was checking is guaranteed by realm to only be called once.
2023-12-18 20:31:02 +09:00
Dean Herbert
87b7699fcc
Avoid calling invalidation logic per beatmap set updated
Realm will batch the updates. We don't want to do expensive operations per set when we don't need to.
2023-12-18 20:31:02 +09:00
Dean Herbert
32cc3f9ef7
Combine multiple similar invalidation logic into single event 2023-12-18 20:31:02 +09:00
Dean Herbert
137a1d948d
Allow interacting with the carousel anywhere in empty space at song select 2023-10-20 20:04:11 +09:00