From 000ddc14acadf104af4724731c0aa41e27952ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 30 Jan 2024 20:50:00 +0100 Subject: [PATCH 1/6] Fix broken locking in `OAuth` Closes https://github.com/ppy/osu/issues/26824... I think? Can be reproduced via something like diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 485274f349..e6e93ab4c7 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -151,6 +151,11 @@ internal string RequestAccessToken() { if (!ensureAccessToken()) return null; + for (int i = 0; i < 10000; ++i) + { + _ = Token.Value.AccessToken; + } + return Token.Value.AccessToken; } The cause is `SecondFactorAuthForm` calling `Logout()`, which calls `OAuth.Clear()`, _while_ the `APIAccess` connect loop is checking if `authentication.HasValidAccessToken` is true, which happens to internally check `Token.Value.AccessToken`, which the clearing of tokens can brutally interrupt. --- osu.Game/Online/API/OAuth.cs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 485274f349..4829310870 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -128,19 +128,12 @@ namespace osu.Game.Online.API // if we already have a valid access token, let's use it. if (accessTokenValid) return true; - // we want to ensure only a single authentication update is happening at once. - lock (access_token_retrieval_lock) - { - // re-check if valid, in case another request completed and revalidated our access. - if (accessTokenValid) return true; + // if not, let's try using our refresh token to request a new access token. + if (!string.IsNullOrEmpty(Token.Value?.RefreshToken)) + // ReSharper disable once PossibleNullReferenceException + AuthenticateWithRefresh(Token.Value.RefreshToken); - // if not, let's try using our refresh token to request a new access token. - if (!string.IsNullOrEmpty(Token.Value?.RefreshToken)) - // ReSharper disable once PossibleNullReferenceException - AuthenticateWithRefresh(Token.Value.RefreshToken); - - return accessTokenValid; - } + return accessTokenValid; } private bool accessTokenValid => Token.Value?.IsValid ?? false; @@ -149,14 +142,18 @@ namespace osu.Game.Online.API internal string RequestAccessToken() { - if (!ensureAccessToken()) return null; + lock (access_token_retrieval_lock) + { + if (!ensureAccessToken()) return null; - return Token.Value.AccessToken; + return Token.Value.AccessToken; + } } internal void Clear() { - Token.Value = null; + lock (access_token_retrieval_lock) + Token.Value = null; } private class AccessTokenRequestRefresh : AccessTokenRequest From c5e118bd1011a3a2f9b5f1affa832dc2e0735c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 30 Jan 2024 22:15:35 +0100 Subject: [PATCH 2/6] Revert "Move fade more local to avoid fading twice" This reverts commit d0421fe20667530bf1bca1a5c8e3f387dde0cf6a and fixes https://github.com/ppy/osu/issues/26801. https://github.com/ppy/osu/pull/26703#discussion_r1469409667 was correct in saying that the early fade-out needs to be restored, and that's because of the early-return. Legacy judgements that are the temporary displayed judgement from new piece should also receive the fade-out, and d0421fe20667530bf1bca1a5c8e3f387dde0cf6a broke that. --- osu.Game/Skinning/LegacyJudgementPieceOld.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Skinning/LegacyJudgementPieceOld.cs b/osu.Game/Skinning/LegacyJudgementPieceOld.cs index edfb5a23ec..068707ba4f 100644 --- a/osu.Game/Skinning/LegacyJudgementPieceOld.cs +++ b/osu.Game/Skinning/LegacyJudgementPieceOld.cs @@ -46,6 +46,7 @@ namespace osu.Game.Skinning const double fade_out_length = 600; this.FadeInFromZero(fade_in_length); + this.Delay(fade_out_delay).FadeOut(fade_out_length); // legacy judgements don't play any transforms if they are an animation.... UNLESS they are the temporary displayed judgement from new piece. if (animation?.FrameCount > 1 && !forceTransforms) @@ -79,8 +80,6 @@ namespace osu.Game.Skinning this.RotateTo(0); this.RotateTo(rotation, fade_in_length) .Then().RotateTo(rotation * 2, fade_out_delay + fade_out_length - fade_in_length, Easing.In); - - this.Delay(fade_out_delay).FadeOut(fade_out_length); } } else @@ -94,8 +93,6 @@ namespace osu.Game.Skinning // so we need to force the current value to be correct at 1.2 (0.95) then complete the // second half of the transform. .ScaleTo(0.95f).ScaleTo(finalScale, fade_in_length * 0.2f); // t = 1.4 - - this.Delay(fade_out_delay).FadeOut(fade_out_length); } } From 9b1bbe5f48eaaf6854c6055d45d6c4601ff3226e Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 31 Jan 2024 15:54:43 +0900 Subject: [PATCH 3/6] Adjust default min result of SliderTailHit, remove override --- osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 1 - osu.Game/Rulesets/Judgements/Judgement.cs | 4 +++- osu.Game/Rulesets/Scoring/HitResult.cs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index ceee513412..ee2490439f 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -30,7 +30,6 @@ namespace osu.Game.Rulesets.Osu.Objects public class TailJudgement : SliderEndJudgement { public override HitResult MaxResult => HitResult.SliderTailHit; - public override HitResult MinResult => HitResult.IgnoreMiss; } } } diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 93386de483..d4d06167f1 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -73,9 +73,11 @@ namespace osu.Game.Rulesets.Judgements return HitResult.SmallTickMiss; case HitResult.LargeTickHit: - case HitResult.SliderTailHit: return HitResult.LargeTickMiss; + case HitResult.SliderTailHit: + return HitResult.IgnoreMiss; + default: return HitResult.Miss; } diff --git a/osu.Game/Rulesets/Scoring/HitResult.cs b/osu.Game/Rulesets/Scoring/HitResult.cs index 20ec3c4946..b6cfca58db 100644 --- a/osu.Game/Rulesets/Scoring/HitResult.cs +++ b/osu.Game/Rulesets/Scoring/HitResult.cs @@ -138,7 +138,8 @@ namespace osu.Game.Rulesets.Scoring ComboBreak, /// - /// A special judgement similar to that's used to increase the valuation of the final tick of a slider. + /// A special tick judgement to increase the valuation of the final tick of a slider. + /// The default minimum result is , but may be overridden to . /// [EnumMember(Value = "slider_tail_hit")] [Order(8)] From 3f527081bd663064cf098b5b8af003ba4d41b2ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Jan 2024 16:12:46 +0900 Subject: [PATCH 4/6] Update framework --- 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 55ef55ab7d..d944e2ce8e 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 5b99319499..bd6891f448 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -23,6 +23,6 @@ iossimulator-x64 - + From a7f9f50ce5c3924733c82934fc0402af41d83802 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Jan 2024 16:52:50 +0900 Subject: [PATCH 5/6] Show a better message when score submission fails due to system clock being set wrong --- osu.Game/Screens/Play/SubmittingPlayer.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index 171ceea84f..c8e84f1961 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -132,7 +132,18 @@ namespace osu.Game.Screens.Play if (string.IsNullOrEmpty(exception.Message)) Logger.Error(exception, "Failed to retrieve a score submission token."); else - Logger.Log($"You are not able to submit a score: {exception.Message}", level: LogLevel.Important); + { + switch (exception.Message) + { + case "expired token": + Logger.Log("Score submission failed because your system clock is set incorrectly. Please check your system time, date and timezone.", level: LogLevel.Important); + break; + + default: + Logger.Log($"You are not able to submit a score: {exception.Message}", level: LogLevel.Important); + break; + } + } Schedule(() => { From fbc923b47ed5e00ac94b5fa20b7310208e650e8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 31 Jan 2024 17:51:38 +0900 Subject: [PATCH 6/6] Revert "Merge pull request #26870 from smoogipoo/adjust-default-minresult" This reverts commit 1acff746ee65020689b873c279aefb9c6c3d8124, reversing changes made to 696ecda398b22da06066bb4d5fc32861758829a8. --- osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 1 + osu.Game/Rulesets/Judgements/Judgement.cs | 4 +--- osu.Game/Rulesets/Scoring/HitResult.cs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index ee2490439f..ceee513412 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -30,6 +30,7 @@ namespace osu.Game.Rulesets.Osu.Objects public class TailJudgement : SliderEndJudgement { public override HitResult MaxResult => HitResult.SliderTailHit; + public override HitResult MinResult => HitResult.IgnoreMiss; } } } diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index d4d06167f1..93386de483 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -73,10 +73,8 @@ namespace osu.Game.Rulesets.Judgements return HitResult.SmallTickMiss; case HitResult.LargeTickHit: - return HitResult.LargeTickMiss; - case HitResult.SliderTailHit: - return HitResult.IgnoreMiss; + return HitResult.LargeTickMiss; default: return HitResult.Miss; diff --git a/osu.Game/Rulesets/Scoring/HitResult.cs b/osu.Game/Rulesets/Scoring/HitResult.cs index b6cfca58db..20ec3c4946 100644 --- a/osu.Game/Rulesets/Scoring/HitResult.cs +++ b/osu.Game/Rulesets/Scoring/HitResult.cs @@ -138,8 +138,7 @@ namespace osu.Game.Rulesets.Scoring ComboBreak, /// - /// A special tick judgement to increase the valuation of the final tick of a slider. - /// The default minimum result is , but may be overridden to . + /// A special judgement similar to that's used to increase the valuation of the final tick of a slider. /// [EnumMember(Value = "slider_tail_hit")] [Order(8)]