1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:47:28 +08:00

Merge pull request #18629 from smoogipoo/remove-player-load-timeout

Allow beatmaps to load endlessly when entering Player
This commit is contained in:
Dean Herbert 2022-06-09 15:16:40 +09:00 committed by GitHub
commit a604ebfa85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@ -181,7 +182,7 @@ namespace osu.Game.Screens.Play
}
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game, CancellationToken cancellationToken)
{
var gameplayMods = Mods.Value.Select(m => m.DeepClone()).ToArray();
@ -194,7 +195,7 @@ namespace osu.Game.Screens.Play
if (Beatmap.Value is DummyWorkingBeatmap)
return;
IBeatmap playableBeatmap = loadPlayableBeatmap(gameplayMods);
IBeatmap playableBeatmap = loadPlayableBeatmap(gameplayMods, cancellationToken);
if (playableBeatmap == null)
return;
@ -483,7 +484,7 @@ namespace osu.Game.Screens.Play
}
}
private IBeatmap loadPlayableBeatmap(Mod[] gameplayMods)
private IBeatmap loadPlayableBeatmap(Mod[] gameplayMods, CancellationToken cancellationToken)
{
IBeatmap playable;
@ -500,7 +501,7 @@ namespace osu.Game.Screens.Play
try
{
playable = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, gameplayMods);
playable = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, gameplayMods, cancellationToken);
}
catch (BeatmapInvalidForRulesetException)
{
@ -508,7 +509,7 @@ namespace osu.Game.Screens.Play
rulesetInfo = Beatmap.Value.BeatmapInfo.Ruleset;
ruleset = rulesetInfo.CreateInstance();
playable = Beatmap.Value.GetPlayableBeatmap(rulesetInfo, gameplayMods);
playable = Beatmap.Value.GetPlayableBeatmap(rulesetInfo, gameplayMods, cancellationToken);
}
if (playable.HitObjects.Count == 0)
@ -517,6 +518,11 @@ namespace osu.Game.Screens.Play
return null;
}
}
catch (OperationCanceledException)
{
// Load has been cancelled. No logging is required.
return null;
}
catch (Exception e)
{
Logger.Error(e, "Could not load beatmap successfully!");