From 9b44f447caa984fb55de7d5cdbc713b4bf185e0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 27 Feb 2018 17:50:26 +0900 Subject: [PATCH 1/8] Fix song select iteration when all panels are filtered Resolves #2069. --- osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs | 6 ++++++ osu.Game/Screens/Select/BeatmapCarousel.cs | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs index 901d24e531..e50dc4b8fc 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs @@ -207,6 +207,12 @@ namespace osu.Game.Tests.Visual checkVisibleItemCount(true, 0); AddAssert("Selection is null", () => currentSelection == null); + advanceSelection(true); + AddAssert("Selection is null", () => currentSelection == null); + + advanceSelection(false); + AddAssert("Selection is null", () => currentSelection == null); + AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false)); AddAssert("Selection is non-null", () => currentSelection != null); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 6a6042d7d4..3b837ffe7c 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -192,7 +192,9 @@ namespace osu.Game.Screens.Select /// Whether to skip individual difficulties and only increment over full groups. public void SelectNext(int direction = 1, bool skipDifficulties = true) { - if (!Items.Any()) + var visibleItems = Items.Where(s => !s.Item.Filtered).ToList(); + + if (!visibleItems.Any()) return; DrawableCarouselItem drawable = null; @@ -202,15 +204,15 @@ namespace osu.Game.Screens.Select // we can fix this by changing this method to not reference drawables / Items in the first place. return; - int originalIndex = Items.IndexOf(drawable); + int originalIndex = visibleItems.IndexOf(drawable); int currentIndex = originalIndex; // local function to increment the index in the required direction, wrapping over extremities. - int incrementIndex() => currentIndex = (currentIndex + direction + Items.Count) % Items.Count; + int incrementIndex() => currentIndex = (currentIndex + direction + visibleItems.Count) % visibleItems.Count; while (incrementIndex() != originalIndex) { - var item = Items[currentIndex].Item; + var item = visibleItems[currentIndex].Item; if (item.Filtered || item.State == CarouselItemState.Selected) continue; From ed99f26699fefc19165a061eb4070c0a4b454752 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Tue, 23 Jan 2018 20:49:48 +0300 Subject: [PATCH 2/8] Use Multicore JIT --- osu.Desktop/Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 048fe93c11..1284883dd7 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Linq; +using System.Runtime; using osu.Framework; using osu.Framework.Platform; using osu.Game.IPC; @@ -15,6 +16,8 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { + useMulticoreJit(); + // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; @@ -47,5 +50,15 @@ namespace osu.Desktop return 0; } } + + private static void useMulticoreJit() + { + var profilesFolder = Path.Combine(Environment.CurrentDirectory, "Profiles"); + if (!Directory.Exists(profilesFolder)) + Directory.CreateDirectory(profilesFolder); + + ProfileOptimization.SetProfileRoot(profilesFolder); + ProfileOptimization.StartProfile("Startup.Profile"); + } } } From 714d7b44778135ffbb5e2698d28d4f2f154d8730 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Wed, 24 Jan 2018 22:07:14 +0300 Subject: [PATCH 3/8] Do not use Multicore JIT on Mono --- osu.Desktop/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 1284883dd7..7da01c17b1 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -16,7 +16,8 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - useMulticoreJit(); + if (!RuntimeInfo.IsMono) + useMulticoreJit(); // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; @@ -47,6 +48,7 @@ namespace osu.Desktop break; } } + return 0; } } From 89bac13bf27eea58eb31aa6de6da05679f6972e9 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Wed, 24 Jan 2018 22:08:16 +0300 Subject: [PATCH 4/8] Fix profiles folder path --- osu.Desktop/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 7da01c17b1..80d273a1b2 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -55,7 +55,7 @@ namespace osu.Desktop private static void useMulticoreJit() { - var profilesFolder = Path.Combine(Environment.CurrentDirectory, "Profiles"); + var profilesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles"); if (!Directory.Exists(profilesFolder)) Directory.CreateDirectory(profilesFolder); From db9b5ebacafee8ffba5272c856e3925e2c9d67fd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 27 Feb 2018 22:26:54 +0900 Subject: [PATCH 5/8] Reduce complexity of code --- osu.Desktop/Program.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 80d273a1b2..d036a6822c 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -55,11 +55,8 @@ namespace osu.Desktop private static void useMulticoreJit() { - var profilesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles"); - if (!Directory.Exists(profilesFolder)) - Directory.CreateDirectory(profilesFolder); - - ProfileOptimization.SetProfileRoot(profilesFolder); + var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); + ProfileOptimization.SetProfileRoot(directory.FullName); ProfileOptimization.StartProfile("Startup.Profile"); } } From 0cd049c6b05d29b641e085a22101fdf34d37915d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 25 Feb 2018 05:49:45 +0900 Subject: [PATCH 6/8] Rely less on zero-duration transform helpers They have huge overheads. See ppy/osu-framework#1411. --- osu.Game/Graphics/Containers/ParallaxContainer.cs | 6 ++++-- osu.Game/Screens/Play/SongProgressBar.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index cb894ca382..8ab264da8e 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -8,6 +8,7 @@ using OpenTK; using osu.Framework.Allocation; using osu.Game.Configuration; using osu.Framework.Configuration; +using osu.Framework.MathUtils; namespace osu.Game.Graphics.Containers { @@ -61,8 +62,9 @@ namespace osu.Game.Graphics.Containers if (parallaxEnabled) { - Vector2 offset = input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2; - content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, Easing.OutQuint); + Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount; + + content.Position = Interpolation.ValueAt(Clock.ElapsedFrameTime, content.Position, offset, 0, 1000, Easing.OutQuint); content.Scale = new Vector2(1 + ParallaxAmount); } diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index ffe7ae04f8..4f5cc79b53 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play { var xFill = value * UsableWidth; fill.Width = xFill; - handleBase.MoveToX(xFill); + handleBase.X = xFill; } protected override void OnUserChange() => OnSeek?.Invoke(Current); From 4a52db14d1781a0a89d8910128dae4cc3161cf10 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 28 Feb 2018 14:18:25 +0900 Subject: [PATCH 7/8] Fix depth of already-visible panels not being updates after a sorting change --- osu.Game/Screens/Select/BeatmapCarousel.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 6a6042d7d4..6da6fe6b1e 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -407,12 +407,14 @@ namespace osu.Game.Screens.Select continue; } + float depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0); + // Only add if we're not already part of the content. if (!scrollableContent.Contains(item)) { // Makes sure headers are always _below_ items, // and depth flows downward. - item.Depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0); + item.Depth = depth; switch (item.LoadState) { @@ -426,6 +428,10 @@ namespace osu.Game.Screens.Select break; } } + else + { + scrollableContent.ChangeChildDepth(item, depth); + } } // this is not actually useful right now, but once we have groups may well be. From a0a215bc4294d617664483b437e8522cef09d687 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 28 Feb 2018 14:22:16 +0900 Subject: [PATCH 8/8] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 9a773e62eb..500a791577 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 9a773e62eb246206b918ba4fccf9f2507aaa4595 +Subproject commit 500a791577979669e47eece699d5bd8b9068ee4b