From 71af50f67541fcac80c4e1e97b8028aad761a3c3 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 7 Apr 2025 20:55:50 +0900 Subject: [PATCH] Validate state with lesser magic --- .../Multiplayer/MultiplayerMatchSubScreen.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index f1736903df..f1eeae2d61 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -518,9 +518,19 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer return; } - if (beatmapAvailabilityTracker.Availability.Value.State != DownloadState.LocallyAvailable) - return; + // Ensure all the gameplay states are up-to-date, forgoing any misordering/scheduling shenanigans. + updateGameplayState(); + // ... And then check that the set gameplay state is valid. + // When spectating, we'll receive LoadRequested() from the server even though we may not yet have the beatmap. + // In that case, this method will be invoked again after availability changes in onBeatmapAvailabilityChanged(). + if (Beatmap.IsDefault) + { + Logger.Log("Aborting gameplay start - beatmap not downloaded."); + return; + } + + // Start the gameplay session. sampleStart?.Play(); int[] userIds = client.CurrentMatchPlayingUserIds.ToArray();