From 316a764f6f85a91f42b1d11b6bb8b03b47392e73 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Thu, 23 Jan 2020 16:23:53 +0100 Subject: [PATCH 1/8] Minor cleanups for Legacy Storyboard/Beatmap decoder --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 12 ++++++------ osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 5 ++++- .../Beatmaps/Formats/LegacyStoryboardDecoder.cs | 14 +++++++------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 447d52d980..a8ec351817 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -239,11 +239,11 @@ namespace osu.Game.Beatmaps.Formats break; case @"Source": - beatmap.BeatmapInfo.Metadata.Source = pair.Value; + metadata.Source = pair.Value; break; case @"Tags": - beatmap.BeatmapInfo.Metadata.Tags = pair.Value; + metadata.Tags = pair.Value; break; case @"BeatmapID": @@ -300,13 +300,13 @@ namespace osu.Game.Beatmaps.Formats switch (type) { case LegacyEventType.Background: - string bgFilename = split[2].Trim('"'); - beatmap.BeatmapInfo.Metadata.BackgroundFile = bgFilename.ToStandardisedPath(); + string bgFilename = split[2]; + beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(bgFilename); ; break; case LegacyEventType.Video: - string videoFilename = split[2].Trim('"'); - beatmap.BeatmapInfo.Metadata.VideoFile = videoFilename.ToStandardisedPath(); + string videoFilename = split[2]; + beatmap.BeatmapInfo.Metadata.VideoFile = CleanFilename(videoFilename); break; case LegacyEventType.Break: diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index f55e24245b..0ec80eee41 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Framework.Extensions; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; @@ -115,7 +116,7 @@ namespace osu.Game.Beatmaps.Formats protected KeyValuePair SplitKeyVal(string line, char separator = ':') { - var split = line.Trim().Split(new[] { separator }, 2); + var split = line.Split(separator, 2); return new KeyValuePair ( @@ -124,6 +125,8 @@ namespace osu.Game.Beatmaps.Formats ); } + protected string CleanFilename(string path) => path.Trim('"').ToStandardisedPath(); + protected enum Section { None, diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index c46634e72f..cbf0f8dfbd 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.IO; using osuTK; using osuTK.Graphics; -using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Game.IO; using osu.Game.Storyboards; @@ -65,12 +64,14 @@ namespace osu.Game.Beatmaps.Formats private void handleEvents(string line) { var depth = 0; + var lineSpan = line.AsSpan(); - while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal)) + while (lineSpan.StartsWith(" ", StringComparison.Ordinal) || lineSpan.StartsWith("_", StringComparison.Ordinal)) { + lineSpan = lineSpan.Slice(1); ++depth; - line = line.Substring(1); } + line = line.Substring(depth); decodeVariables(ref line); @@ -89,7 +90,7 @@ namespace osu.Game.Beatmaps.Formats { var layer = parseLayer(split[1]); var origin = parseOrigin(split[2]); - var path = cleanFilename(split[3]); + var path = CleanFilename(split[3]); var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo); var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo); storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y)); @@ -101,7 +102,7 @@ namespace osu.Game.Beatmaps.Formats { var layer = parseLayer(split[1]); var origin = parseOrigin(split[2]); - var path = cleanFilename(split[3]); + var path = CleanFilename(split[3]); var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo); var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo); var frameCount = int.Parse(split[6]); @@ -116,7 +117,7 @@ namespace osu.Game.Beatmaps.Formats { var time = double.Parse(split[1], CultureInfo.InvariantCulture); var layer = parseLayer(split[2]); - var path = cleanFilename(split[3]); + var path = CleanFilename(split[3]); var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100; storyboard.GetLayer(layer).Add(new StoryboardSampleInfo(path, time, (int)volume)); break; @@ -332,6 +333,5 @@ namespace osu.Game.Beatmaps.Formats } } - private string cleanFilename(string path) => path.Trim('"').ToStandardisedPath(); } } From 6658bdb223c15661bf7836d66165dacef2d07eec Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Thu, 23 Jan 2020 16:34:43 +0100 Subject: [PATCH 2/8] Fix CodeFactor issues --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index a8ec351817..965fcc03a3 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -301,7 +301,7 @@ namespace osu.Game.Beatmaps.Formats { case LegacyEventType.Background: string bgFilename = split[2]; - beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(bgFilename); ; + beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(bgFilename); break; case LegacyEventType.Video: diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index cbf0f8dfbd..a7d0360f0d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -332,6 +332,5 @@ namespace osu.Game.Beatmaps.Formats break; } } - } } From 219e14baa2e0f7a9a63be5a78f418c5e826d6c71 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Fri, 24 Jan 2020 17:05:27 +0100 Subject: [PATCH 3/8] Address review and fix InspectCode --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 6 ++---- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 965fcc03a3..009da0656b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -300,13 +300,11 @@ namespace osu.Game.Beatmaps.Formats switch (type) { case LegacyEventType.Background: - string bgFilename = split[2]; - beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(bgFilename); + beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]); break; case LegacyEventType.Video: - string videoFilename = split[2]; - beatmap.BeatmapInfo.Metadata.VideoFile = CleanFilename(videoFilename); + beatmap.BeatmapInfo.Metadata.VideoFile = CleanFilename(split[2]); break; case LegacyEventType.Break: diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index a7d0360f0d..9ba4d7b05e 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -71,6 +71,7 @@ namespace osu.Game.Beatmaps.Formats lineSpan = lineSpan.Slice(1); ++depth; } + line = line.Substring(depth); decodeVariables(ref line); From fa595e07a65907e66cb2e37b31c7e76ab5cb62f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Jan 2020 12:44:48 +0900 Subject: [PATCH 4/8] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 2ccba60424..5497a82a7a 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -54,6 +54,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9b431e6425..0ea558bbc7 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -23,7 +23,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 4dc7403553..a215bc65e8 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -74,7 +74,7 @@ - + @@ -82,7 +82,7 @@ - + From 9a960a60e37fe69cb6140ca9fdb78f949b077b8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Jan 2020 17:08:24 +0900 Subject: [PATCH 5/8] Remove build target from Fastfile --- fastlane/Fastfile | 1 - 1 file changed, 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 28a83fbbae..510b53054b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -111,7 +111,6 @@ platform :ios do souyuz( platform: "ios", - build_target: "osu_iOS", plist_path: "../osu.iOS/Info.plist" ) end From 8aec9e450089d874caf812153c7dd7025621018a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sat, 25 Jan 2020 11:41:26 +0300 Subject: [PATCH 6/8] Fix NullReferenceException on main menu for mobile game hsots --- osu.Game/Screens/Menu/MainMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index b03febce31..cb5ceefb0f 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -116,7 +116,7 @@ namespace osu.Game.Screens.Menu Origin = Anchor.TopRight, Margin = new MarginPadding { Right = 15, Top = 5 } }, - exitConfirmOverlay.CreateProxy() + exitConfirmOverlay?.CreateProxy() ?? Drawable.Empty() }); buttons.StateChanged += state => From d2a032ca8d84453fc35cf54123dfda7dd8070c39 Mon Sep 17 00:00:00 2001 From: TheWildTree Date: Sat, 25 Jan 2020 22:16:21 +0100 Subject: [PATCH 7/8] Move reverse-order comparer to ChannelTabControl --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 14 -------------- osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 6a7998d5fb..1bfbee4a60 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -10,7 +10,6 @@ using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -84,14 +83,6 @@ namespace osu.Game.Graphics.UserInterface set => strip.Colour = value; } - protected override TabFillFlowContainer CreateTabFlow() => new OsuTabFillFlowContainer - { - Direction = FillDirection.Full, - RelativeSizeAxes = Axes.Both, - Depth = -1, - Masking = true - }; - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); @@ -283,10 +274,5 @@ namespace osu.Game.Graphics.UserInterface } } } - - private class OsuTabFillFlowContainer : TabFillFlowContainer - { - protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); - } } } diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index 2e4d8ce729..104495ae01 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -9,6 +9,7 @@ using osuTK; using System; using System.Linq; using osu.Framework.Bindables; +using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Chat.Tabs { @@ -113,5 +114,18 @@ namespace osu.Game.Overlays.Chat.Tabs OnRequestLeave?.Invoke(tab.Value); } + + protected override TabFillFlowContainer CreateTabFlow() => new ChannelTabFillFlowContainer + { + Direction = FillDirection.Full, + RelativeSizeAxes = Axes.Both, + Depth = -1, + Masking = true + }; + + private class ChannelTabFillFlowContainer : TabFillFlowContainer + { + protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y); + } } } From eabb5a870175e6f59fb86b9039c7a77d6cd832ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 26 Jan 2020 17:40:38 +0900 Subject: [PATCH 8/8] Use ToString instead of Substring --- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index 9ba4d7b05e..35576e0f33 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps.Formats ++depth; } - line = line.Substring(depth); + line = lineSpan.ToString(); decodeVariables(ref line);