From 9a1e92800b4e799bfd5a058a921ddbc395ceec51 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 14:30:44 +0900 Subject: [PATCH 01/11] Adjust with framework-side screenchanges --- osu.Game/Graphics/ScreenshotManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 7b3337cb23..bc30794298 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Drawing.Imaging; using System.IO; using System.Threading; using System.Threading.Tasks; @@ -19,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Input.Bindings; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using SixLabors.ImageSharp; namespace osu.Game.Graphics { @@ -90,7 +90,7 @@ namespace osu.Game.Graphics waitDelegate.Cancel(); } - using (var bitmap = await host.TakeScreenshotAsync()) + using (var image = await host.TakeScreenshotAsync()) { Interlocked.Decrement(ref screenShotTasks); @@ -102,10 +102,10 @@ namespace osu.Game.Graphics switch (screenshotFormat.Value) { case ScreenshotFormat.Png: - bitmap.Save(stream, ImageFormat.Png); + image.SaveAsPng(stream); break; case ScreenshotFormat.Jpg: - bitmap.Save(stream, ImageFormat.Jpeg); + image.SaveAsJpeg(stream); break; default: throw new ArgumentOutOfRangeException(nameof(screenshotFormat)); From 6b0ed4a68d12f8867d498ab2c833423c946105d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 13:37:59 +0900 Subject: [PATCH 02/11] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da17500128..b4e9c748d9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From e628e78f24a1601e3387e19f63821f0c805cddeb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 13:39:22 +0900 Subject: [PATCH 03/11] Update uniform usage --- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 0532fe0223..abcd1ddbda 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -197,7 +197,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor if (Shared.VertexBuffer == null) Shared.VertexBuffer = new QuadVertexBuffer(max_sprites, BufferUsageHint.DynamicDraw); - Shader.GetUniform("g_FadeClock").Value = Time; + Shader.GetUniform("g_FadeClock").UpdateValue(ref Time); int updateStart = -1, updateEnd = 0; for (int i = 0; i < Parts.Length; ++i) From 18aa30fcb03c96a07ae6ecfaf02942025ea55b85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 14:27:32 +0900 Subject: [PATCH 04/11] Unbind song select's ruleset to avoid test failures --- osu.Game/Screens/Select/SongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 54143bef8a..dcc0760262 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -460,6 +460,8 @@ namespace osu.Game.Screens.Select { base.Dispose(isDisposing); + Ruleset.UnbindAll(); + if (beatmaps != null) { beatmaps.ItemAdded -= onBeatmapSetAdded; From 65dc9f44e514ab816bbb2e1698774d4ba6724f17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 14:42:37 +0900 Subject: [PATCH 05/11] Catch OperationCanceledException in single file load sequence --- osu.Game/OsuGame.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d54bdee1b2..967cf95565 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -504,7 +504,16 @@ namespace osu.Game // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile, // we could avoid the need for scheduling altogether. - Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(t => LoadComponentAsync(d, add).Wait()) ?? LoadComponentAsync(d, add); }); + Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(async t => + { + try + { + await LoadComponentAsync(d, add); + } + catch (OperationCanceledException) + { + } + }) ?? LoadComponentAsync(d, add); }); } public bool OnPressed(GlobalAction action) From 39aa98d12de07050f459a0a0eeb219a2cfb079ce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 14:58:02 +0900 Subject: [PATCH 06/11] Fix logo flying off-screen when exiting game --- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index ce00686c02..7f2bc1d357 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -278,7 +278,7 @@ namespace osu.Game.Screens.Menu if (logo != null) { - if (logoTracking && iconFacade.IsLoaded) + if (logoTracking && logo.RelativePositionAxes == Axes.None && iconFacade.IsLoaded) logo.Position = logoTrackingPosition; iconFacade.Width = logo.SizeForFlow * 0.5f; From 295ccabf64e81b84cb386b9121f3390a4b132d72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 16:06:12 +0900 Subject: [PATCH 07/11] Expand out on to multiple lines --- osu.Game/OsuGame.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 967cf95565..94678a9dde 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -504,16 +504,25 @@ namespace osu.Game // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile, // we could avoid the need for scheduling altogether. - Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(async t => + Schedule(() => { - try + if (asyncLoadStream != null) { - await LoadComponentAsync(d, add); + //chain with existing load stream + asyncLoadStream = asyncLoadStream.ContinueWith(async t => + { + try + { + await LoadComponentAsync(d, add); + } + catch (OperationCanceledException) + { + } + }); } - catch (OperationCanceledException) - { - } - }) ?? LoadComponentAsync(d, add); }); + else + asyncLoadStream = LoadComponentAsync(d, add); + }); } public bool OnPressed(GlobalAction action) From 7add4a8cc75df572fa695860f6abd52a021adeb7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 18:26:34 +0900 Subject: [PATCH 08/11] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b4e9c748d9..06fb1c4f82 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 4a68b14447fd082f7c973ffa9def4e1943da21b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Aug 2018 00:15:51 +0900 Subject: [PATCH 09/11] Fix crash when selecting mods after entering play mode Closes #3260. --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 894322dd41..1a164b473d 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -63,6 +63,12 @@ namespace osu.Game.Screens.Play.HUD }; } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + mods.UnbindAll(); + } + protected override void LoadComplete() { base.LoadComplete(); From da13266ae95f28b1121ce7df7f193dd832cfa807 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 09:17:44 +0900 Subject: [PATCH 10/11] Fix missed string interpolation --- 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 71613753bc..257155478f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -63,7 +63,7 @@ namespace osu.Desktop { bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; - Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); + Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); // restore the stock of allowable exceptions after a short delay. Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); From 541c4daa810ad3700e7381b9a0f3dddfbc796749 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 11:10:54 +0900 Subject: [PATCH 11/11] Use ordinal string comparison in hot paths --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 76a3d75e36..e9f37e583b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats if (ShouldSkipLine(line)) continue; - if (line.StartsWith(@"[") && line.EndsWith(@"]")) + if (line.StartsWith(@"[", StringComparison.Ordinal) && line.EndsWith(@"]", StringComparison.Ordinal)) { if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section)) { @@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps.Formats } } - protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//"); + protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//", StringComparison.Ordinal); protected virtual void ParseLine(T output, Section section, string line) { diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index a8a62013b1..1063dfc923 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps.Formats private void handleEvents(string line) { var depth = 0; - while (line.StartsWith(" ") || line.StartsWith("_")) + while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal)) { ++depth; line = line.Substring(1);