From 1aa79a2d884a6daf4cba7837fe0d1f1eca8ab4ce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Nov 2017 01:26:21 +0900 Subject: [PATCH 1/9] Hide inspectcode output from appveyor console --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 9048428590..78e0e6da4e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,5 +21,5 @@ build: parallel: true verbosity: minimal after_build: - - cmd: inspectcode /o="inspectcodereport.xml" /caches-home="inspectcode" osu.sln + - cmd: inspectcode /o="inspectcodereport.xml" /caches-home="inspectcode" osu.sln > NUL - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors \ No newline at end of file From 6f5803b5eb39a2103096f83e3731c9763ff08900 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Nov 2017 01:51:22 +0900 Subject: [PATCH 2/9] Shallow clone submodules --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 78e0e6da4e..ea9a1fa3bf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ cache: - inspectcode -> appveyor.yml - packages -> **\packages.config install: - - cmd: git submodule update --init --recursive + - cmd: git submodule update --init --recursive --depth=5 - cmd: choco install resharper-clt -y - cmd: choco install nvika -y - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.3/CodeFileSanity.exe From 8370d7694638d2de0f495e673b73b5687a654ff1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Nov 2017 12:27:18 +0900 Subject: [PATCH 3/9] Quieten nuget --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ea9a1fa3bf..9cf68803a2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,11 +15,11 @@ install: - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.3/CodeFileSanity.exe before_build: - cmd: CodeFileSanity.exe - - cmd: nuget restore + - cmd: nuget restore -verbosity quiet build: project: osu.sln parallel: true verbosity: minimal after_build: - - cmd: inspectcode /o="inspectcodereport.xml" /caches-home="inspectcode" osu.sln > NUL + - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors \ No newline at end of file From d1afbf80557773f00936865a860a8714e4a7b645 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Nov 2017 13:10:13 +0900 Subject: [PATCH 4/9] Load Player-based TestCases asynchronously --- osu.Game/Tests/Visual/TestCasePlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index f3a6d1efc3..64da838494 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual if (Player != null) Remove(Player); - LoadScreen(CreatePlayer(working, instance)); + LoadComponentAsync(CreatePlayer(working, instance), LoadScreen); } protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player From 1136db15562454e6c44d23b7d23030d9e1d501d9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 29 Nov 2017 14:20:15 +0900 Subject: [PATCH 5/9] Fix mania replays not defining important frames Resolves https://github.com/ppy/osu/issues/1495 . --- .../Replays/ManiaAutoGenerator.cs | 9 +++++---- .../Replays/ManiaReplayFrame.cs | 17 +++++++++++++++++ .../osu.Game.Rulesets.Mania.csproj | 1 + osu.Game/Rulesets/Replays/ReplayFrame.cs | 4 ++-- 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index 64982532a7..58fb43aa83 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.Replays public override Replay Generate() { // Todo: Realistically this shouldn't be needed, but the first frame is skipped with the way replays are currently handled - Replay.Frames.Add(new ReplayFrame(-100000, null, null, ReplayButtonState.None)); + Replay.Frames.Add(new ManiaReplayFrame(-100000, null, null, ReplayButtonState.None)); double[] holdEndTimes = new double[availableColumns]; for (int i = 0; i < availableColumns; i++) @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Mania.Replays activeColumns |= 1 << obj.Column; } - Replay.Frames.Add(new ReplayFrame(groupTime, activeColumns, null, ReplayButtonState.None)); + Replay.Frames.Add(new ManiaReplayFrame(groupTime, activeColumns, null, ReplayButtonState.None)); // Add the release frames. We can't do this with the loop above because we need activeColumns to be fully populated foreach (var obj in objGroup.GroupBy(h => (h as IHasEndTime)?.EndTime ?? h.StartTime + release_delay).OrderBy(h => h.Key)) @@ -74,14 +74,15 @@ namespace osu.Game.Rulesets.Mania.Replays activeColumnsAtEnd |= 1 << i; } - Replay.Frames.Add(new ReplayFrame(groupEndTime, activeColumnsAtEnd, 0, ReplayButtonState.None)); + Replay.Frames.Add(new ManiaReplayFrame(groupEndTime, activeColumnsAtEnd, 0, ReplayButtonState.None)); } } Replay.Frames = Replay.Frames // Pick the maximum activeColumns for all frames at the same time .GroupBy(f => f.Time) - .Select(g => new ReplayFrame(g.First().Time, maxMouseX(g), 0, ReplayButtonState.None)) + .Select(g => new ManiaReplayFrame(g.First().Time, maxMouseX(g), 0, ReplayButtonState.None)) + .Cast() // The addition of release frames above maybe result in unordered frames, but we need them ordered .OrderBy(f => f.Time) .ToList(); diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs new file mode 100644 index 0000000000..c27ffa1875 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Replays; + +namespace osu.Game.Rulesets.Mania.Replays +{ + public class ManiaReplayFrame : ReplayFrame + { + public override bool IsImportant => MouseX > 0; + + public ManiaReplayFrame(double time, float? mouseX, float? mouseY, ReplayButtonState buttonState) + : base(time, mouseX, mouseY, buttonState) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 6f45a64d92..22f858c2ea 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -72,6 +72,7 @@ + diff --git a/osu.Game/Rulesets/Replays/ReplayFrame.cs b/osu.Game/Rulesets/Replays/ReplayFrame.cs index b0f62e5271..02c969f648 100644 --- a/osu.Game/Rulesets/Replays/ReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/ReplayFrame.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Replays { public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0); - public bool IsImportant => MouseX.HasValue && MouseY.HasValue && (MouseLeft || MouseRight); + public virtual bool IsImportant => MouseX.HasValue && MouseY.HasValue && (MouseLeft || MouseRight); public float? MouseX; public float? MouseY; @@ -68,4 +68,4 @@ namespace osu.Game.Rulesets.Replays return $"{Time}\t({MouseX},{MouseY})\t{MouseLeft}\t{MouseRight}\t{MouseLeft1}\t{MouseRight1}\t{MouseLeft2}\t{MouseRight2}\t{ButtonState}"; } } -} \ No newline at end of file +} From 6fd550dc91de4557157a317de1897fd29f901184 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 29 Nov 2017 15:47:10 +0900 Subject: [PATCH 6/9] Simplify/sanitize construction of ManiaReplayFrame --- osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs | 10 +++++----- osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index 58fb43aa83..ca80bf8413 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.Replays public override Replay Generate() { // Todo: Realistically this shouldn't be needed, but the first frame is skipped with the way replays are currently handled - Replay.Frames.Add(new ManiaReplayFrame(-100000, null, null, ReplayButtonState.None)); + Replay.Frames.Add(new ManiaReplayFrame(-100000, 0)); double[] holdEndTimes = new double[availableColumns]; for (int i = 0; i < availableColumns; i++) @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Mania.Replays activeColumns |= 1 << obj.Column; } - Replay.Frames.Add(new ManiaReplayFrame(groupTime, activeColumns, null, ReplayButtonState.None)); + Replay.Frames.Add(new ManiaReplayFrame(groupTime, activeColumns)); // Add the release frames. We can't do this with the loop above because we need activeColumns to be fully populated foreach (var obj in objGroup.GroupBy(h => (h as IHasEndTime)?.EndTime ?? h.StartTime + release_delay).OrderBy(h => h.Key)) @@ -74,14 +74,14 @@ namespace osu.Game.Rulesets.Mania.Replays activeColumnsAtEnd |= 1 << i; } - Replay.Frames.Add(new ManiaReplayFrame(groupEndTime, activeColumnsAtEnd, 0, ReplayButtonState.None)); + Replay.Frames.Add(new ManiaReplayFrame(groupEndTime, activeColumnsAtEnd)); } } Replay.Frames = Replay.Frames // Pick the maximum activeColumns for all frames at the same time .GroupBy(f => f.Time) - .Select(g => new ManiaReplayFrame(g.First().Time, maxMouseX(g), 0, ReplayButtonState.None)) + .Select(g => new ManiaReplayFrame(g.First().Time, maxMouseX(g))) .Cast() // The addition of release frames above maybe result in unordered frames, but we need them ordered .OrderBy(f => f.Time) @@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Mania.Replays /// /// The grouping to search. /// The maximum by count of bits. - private float maxMouseX(IGrouping group) + private int maxMouseX(IGrouping group) { int currentCount = -1; int currentMax = 0; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index c27ffa1875..8473d23b89 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Mania.Replays { public override bool IsImportant => MouseX > 0; - public ManiaReplayFrame(double time, float? mouseX, float? mouseY, ReplayButtonState buttonState) - : base(time, mouseX, mouseY, buttonState) + public ManiaReplayFrame(double time, int activeColumns) + : base(time, (float)activeColumns, null, ReplayButtonState.None) { } } From 1ea089eb743c0f7b4eca26f5fc70e943a89d341f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Nov 2017 15:53:41 +0900 Subject: [PATCH 7/9] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index d92cec7645..4fc866eee3 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit d92cec764538da2e7ed95bfb566f6bc81a9667c8 +Subproject commit 4fc866eee3803f88b155150e32e021b9c21e647f From bad970d1d1f0b0feee09c54ab3b5ee7918458d90 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Nov 2017 17:25:55 +0900 Subject: [PATCH 8/9] Add wait steps to ensure the player is completely loaded before continuing --- osu.Game/Tests/Visual/TestCasePlayer.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 64da838494..d9951e002b 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -50,7 +50,11 @@ namespace osu.Game.Tests.Visual string instantiation = ruleset?.AssemblyQualifiedName; foreach (var r in rulesets.AvailableRulesets.Where(rs => instantiation == null || rs.InstantiationInfo == instantiation)) - AddStep(r.Name, () => loadPlayerFor(r)); + { + Player p = null; + AddStep(r.Name, () => p = loadPlayerFor(r)); + AddUntilStep(() => p.IsLoaded); + } } protected virtual Beatmap CreateBeatmap() @@ -64,7 +68,7 @@ namespace osu.Game.Tests.Visual return beatmap; } - private void loadPlayerFor(RulesetInfo r) + private Player loadPlayerFor(RulesetInfo r) { var beatmap = CreateBeatmap(); @@ -78,7 +82,11 @@ namespace osu.Game.Tests.Visual if (Player != null) Remove(Player); - LoadComponentAsync(CreatePlayer(working, instance), LoadScreen); + var player = CreatePlayer(working, instance); + + LoadComponentAsync(player, LoadScreen); + + return player; } protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player From 7cbca37e2df471b03f20232cc1eb58a074b383b4 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 29 Nov 2017 18:18:36 +0900 Subject: [PATCH 9/9] Remove redundant cast --- osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index 8473d23b89..d1bc7da911 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mania.Replays public override bool IsImportant => MouseX > 0; public ManiaReplayFrame(double time, int activeColumns) - : base(time, (float)activeColumns, null, ReplayButtonState.None) + : base(time, activeColumns, null, ReplayButtonState.None) { } }