From cd474de61f963c924d42291a8872ae7c6ffa0988 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 4 Apr 2024 15:55:05 +0900 Subject: [PATCH 1/3] Update osu.Framework package --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 4901f30d8a..2d7a9d2652 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -10,7 +10,7 @@ true - + diff --git a/osu.iOS.props b/osu.iOS.props index 6b63bfa1e2..b2e3fc0779 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -23,6 +23,6 @@ iossimulator-x64 - + From fb8fb4f34e2e7ef325248aaf264f8035a05795fc Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 4 Apr 2024 16:43:26 +0900 Subject: [PATCH 2/3] Disable Discord URI registration on macOS for now --- osu.Desktop/DiscordRichPresence.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index 6e8554d617..7553924d1b 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -6,6 +6,7 @@ using System.Text; using DiscordRPC; using DiscordRPC.Message; using Newtonsoft.Json; +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; @@ -78,9 +79,13 @@ namespace osu.Desktop client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network, LogLevel.Error); // A URI scheme is required to support game invitations, as well as informing Discord of the game executable path to support launching the game when a user clicks on join/spectate. - client.RegisterUriScheme(); - client.Subscribe(EventType.Join); - client.OnJoin += onJoin; + // The library doesn't properly support URI registration when ran from an app bundle on macOS. + if (!RuntimeInfo.IsApple) + { + client.RegisterUriScheme(); + client.Subscribe(EventType.Join); + client.OnJoin += onJoin; + } config.BindWith(OsuSetting.DiscordRichPresence, privacyMode); From 7b92c725b1e4004d1e082989522906335efe4859 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 5 Apr 2024 14:45:49 +0900 Subject: [PATCH 3/3] Revert "Merge pull request #27454 from EVAST9919/sb-lifetime-improvements" This reverts commit 0881e7c8c1f003416cc37507ce6448f74e9d1a7f, reversing changes made to 29a37e35852649c2f88b6c917b2921950c9e2dd9. --- osu.Game/Storyboards/CommandTimelineGroup.cs | 41 +++++++++++++- osu.Game/Storyboards/StoryboardSprite.cs | 58 +------------------- 2 files changed, 41 insertions(+), 58 deletions(-) diff --git a/osu.Game/Storyboards/CommandTimelineGroup.cs b/osu.Game/Storyboards/CommandTimelineGroup.cs index c899cf77d3..0b96db6861 100644 --- a/osu.Game/Storyboards/CommandTimelineGroup.cs +++ b/osu.Game/Storyboards/CommandTimelineGroup.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osuTK; using osuTK.Graphics; using osu.Framework.Graphics; @@ -45,10 +46,32 @@ namespace osu.Game.Storyboards } [JsonIgnore] - public double CommandsStartTime => timelines.Min(static t => t.StartTime); + public double CommandsStartTime + { + get + { + double min = double.MaxValue; + + for (int i = 0; i < timelines.Length; i++) + min = Math.Min(min, timelines[i].StartTime); + + return min; + } + } [JsonIgnore] - public double CommandsEndTime => timelines.Max(static t => t.EndTime); + public double CommandsEndTime + { + get + { + double max = double.MinValue; + + for (int i = 0; i < timelines.Length; i++) + max = Math.Max(max, timelines[i].EndTime); + + return max; + } + } [JsonIgnore] public double CommandsDuration => CommandsEndTime - CommandsStartTime; @@ -60,7 +83,19 @@ namespace osu.Game.Storyboards public virtual double EndTime => CommandsEndTime; [JsonIgnore] - public bool HasCommands => timelines.Any(static t => t.HasCommands); + public bool HasCommands + { + get + { + for (int i = 0; i < timelines.Length; i++) + { + if (timelines[i].HasCommands) + return true; + } + + return false; + } + } public virtual IEnumerable.TypedCommand> GetCommands(CommandTimelineSelector timelineSelector, double offset = 0) { diff --git a/osu.Game/Storyboards/StoryboardSprite.cs b/osu.Game/Storyboards/StoryboardSprite.cs index 4992ae128d..982185d51b 100644 --- a/osu.Game/Storyboards/StoryboardSprite.cs +++ b/osu.Game/Storyboards/StoryboardSprite.cs @@ -85,23 +85,12 @@ namespace osu.Game.Storyboards { get { - double latestEndTime = double.MaxValue; - - // Ignore the whole setup if there are loops. In theory they can be handled here too, however the logic will be overly complex. - if (loops.Count == 0) - { - // Take the minimum time of all the potential "death" reasons. - latestEndTime = calculateOptimisedEndTime(TimelineGroup); - } - - // If the logic above fails to find anything or discarded by the fact that there are loops present, latestEndTime will be double.MaxValue - // and thus conservativeEndTime will be used. - double conservativeEndTime = TimelineGroup.EndTime; + double latestEndTime = TimelineGroup.EndTime; foreach (var l in loops) - conservativeEndTime = Math.Max(conservativeEndTime, l.StartTime + l.CommandsDuration * l.TotalIterations); + latestEndTime = Math.Max(latestEndTime, l.StartTime + l.CommandsDuration * l.TotalIterations); - return Math.Min(latestEndTime, conservativeEndTime); + return latestEndTime; } } @@ -205,47 +194,6 @@ namespace osu.Game.Storyboards return commands; } - private static double calculateOptimisedEndTime(CommandTimelineGroup timelineGroup) - { - // Here we are starting from maximum value and trying to minimise the end time on each step. - // There are few solid guesses we can make using which sprite's end time can be minimised: alpha = 0, scale = 0, colour.a = 0. - double[] deathTimes = - { - double.MaxValue, // alpha - double.MaxValue, // colour alpha - double.MaxValue, // scale - double.MaxValue, // scale x - double.MaxValue, // scale y - }; - - // The loops below are following the same pattern. - // We could be using TimelineGroup.EndValue here, however it's possible to have multiple commands with 0 value in a row - // so we are saving the earliest of them. - foreach (var alphaCommand in timelineGroup.Alpha.Commands) - { - if (alphaCommand.EndValue == 0) - // commands are ordered by the start time, however end time may vary. Save the earliest. - deathTimes[0] = Math.Min(alphaCommand.EndTime, deathTimes[0]); - else - // If value isn't 0 (sprite becomes visible again), revert the saved state. - deathTimes[0] = double.MaxValue; - } - - foreach (var colourCommand in timelineGroup.Colour.Commands) - deathTimes[1] = colourCommand.EndValue.A == 0 ? Math.Min(colourCommand.EndTime, deathTimes[1]) : double.MaxValue; - - foreach (var scaleCommand in timelineGroup.Scale.Commands) - deathTimes[2] = scaleCommand.EndValue == 0 ? Math.Min(scaleCommand.EndTime, deathTimes[2]) : double.MaxValue; - - foreach (var scaleCommand in timelineGroup.VectorScale.Commands) - { - deathTimes[3] = scaleCommand.EndValue.X == 0 ? Math.Min(scaleCommand.EndTime, deathTimes[3]) : double.MaxValue; - deathTimes[4] = scaleCommand.EndValue.Y == 0 ? Math.Min(scaleCommand.EndTime, deathTimes[4]) : double.MaxValue; - } - - return deathTimes.Min(); - } - public override string ToString() => $"{Path}, {Origin}, {InitialPosition}";