Skip to content

Commit d473193

Browse files
authored
Merge branch 'master' into fix-mania-editor-drag-outside-playfield
2 parents 71ff44b + ab2daf6 commit d473193

File tree

7 files changed

+29
-11
lines changed

7 files changed

+29
-11
lines changed

osu.Desktop/OsuGameDesktop.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.IO;
66
using System.Reflection;
77
using System.Runtime.Versioning;
8-
using System.Threading.Tasks;
98
using Microsoft.Win32;
109
using osu.Desktop.Performance;
1110
using osu.Desktop.Security;
@@ -20,7 +19,6 @@
2019
using osu.Game.Configuration;
2120
using osu.Game.IO;
2221
using osu.Game.IPC;
23-
using osu.Game.Online.Multiplayer;
2422
using osu.Game.Performance;
2523
using osu.Game.Utils;
2624

@@ -123,7 +121,7 @@ protected override UpdateManager CreateUpdateManager()
123121

124122
public override bool RestartAppWhenExited()
125123
{
126-
Task.Run(() => Velopack.UpdateExe.Start(waitPid: (uint)Environment.ProcessId)).FireAndForget();
124+
RestartOnExitAction = () => Velopack.UpdateExe.Start(waitPid: (uint)Environment.ProcessId);
127125
return true;
128126
}
129127

osu.Desktop/Updater/VelopackUpdateManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ private void runOutsideOfGameplay(Action action, CancellationToken cancellationT
146146
action();
147147
}
148148

149-
private void restartToApplyUpdate(Velopack.UpdateManager updateManager, UpdateInfo update) => Task.Run(async () =>
149+
private void restartToApplyUpdate(Velopack.UpdateManager updateManager, UpdateInfo update)
150150
{
151-
await updateManager.WaitExitThenApplyUpdatesAsync(update.TargetFullRelease).ConfigureAwait(false);
152-
Schedule(() => game.AttemptExit());
153-
});
151+
game.RestartOnExitAction = () => updateManager.WaitExitThenApplyUpdates(update.TargetFullRelease);
152+
game.AttemptExit();
153+
}
154154

155155
private static void log(string text) => Logger.Log($"VelopackUpdateManager: {text}");
156156
}

osu.Game/OsuGame.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public partial class OsuGame : OsuGameBase, IKeyBindingHandler<GlobalAction>, IL
193193

194194
protected readonly Bindable<LocalUserPlayingState> UserPlayingState = new Bindable<LocalUserPlayingState>();
195195

196-
protected OsuScreenStack ScreenStack;
196+
public OsuScreenStack ScreenStack { get; private set; }
197197

198198
protected BackButton BackButton => screenStackFooter.BackButton;
199199
protected ScreenFooter ScreenFooter => screenStackFooter.Footer;

osu.Game/OsuGameBase.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Reflection;
1111
using System.Threading;
1212
using System.Threading.Tasks;
13+
using JetBrains.Annotations;
1314
using osu.Framework.Allocation;
1415
using osu.Framework.Audio;
1516
using osu.Framework.Audio.Track;
@@ -517,6 +518,8 @@ public override void SetHost(GameHost host)
517518
host.ExceptionThrown += onExceptionThrown;
518519
}
519520

521+
#region Exit handling
522+
520523
/// <summary>
521524
/// Use to programatically exit the game as if the user was triggering via alt-f4.
522525
/// By default, will keep persisting until an exit occurs (exit may be blocked multiple times).
@@ -530,12 +533,28 @@ public virtual void AttemptExit()
530533
Scheduler.AddDelayed(AttemptExit, 2000);
531534
}
532535

536+
/// <summary>
537+
/// An action that restarts the application after it has exited.
538+
/// </summary>
539+
[CanBeNull]
540+
public Action RestartOnExitAction { private get; set; }
541+
542+
/// <summary>
543+
/// Signals that the application should not be restarted after it is exited.
544+
/// </summary>
545+
public void CancelRestartOnExit()
546+
{
547+
RestartOnExitAction = null;
548+
}
549+
533550
/// <summary>
534551
/// If supported by the platform, the game will automatically restart after the next exit.
535552
/// </summary>
536553
/// <returns>Whether a restart operation was queued.</returns>
537554
public virtual bool RestartAppWhenExited() => false;
538555

556+
#endregion
557+
539558
/// <summary>
540559
/// Perform migration of user data to a specified path.
541560
/// </summary>
@@ -742,6 +761,8 @@ protected override void Dispose(bool isDisposing)
742761

743762
if (Host != null)
744763
Host.ExceptionThrown -= onExceptionThrown;
764+
765+
RestartOnExitAction?.Invoke();
745766
}
746767

747768
ControlPointInfo IBeatSyncProvider.ControlPoints => Beatmap.Value.BeatmapLoaded ? Beatmap.Value.Beatmap.ControlPointInfo : null;

osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public partial class TabletSettings : InputSubsection
6262
/// <summary>
6363
/// Based on ultrawide monitor configurations, plus a bit of lenience for users which are intentionally aiming for higher horizontal velocity.
6464
/// </summary>
65-
private const float largest_feasible_aspect_ratio = 23f / 9;
65+
private const float largest_feasible_aspect_ratio = 32f / 9;
6666

6767
private readonly BindableNumber<float> aspectRatio = new BindableFloat(1)
6868
{

osu.Game/Screens/Menu/MainMenu.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ public override bool OnExiting(ScreenExitEvent e)
429429
}, () =>
430430
{
431431
holdToExitGameOverlay.Abort();
432+
Game.CancelRestartOnExit();
432433
}));
433434
}
434435

osu.Game/Tests/Visual/OsuGameTestScene.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ public partial class TestOsuGame : OsuGame
124124
{
125125
public new const float SIDE_OVERLAY_OFFSET_RATIO = OsuGame.SIDE_OVERLAY_OFFSET_RATIO;
126126

127-
public new ScreenStack ScreenStack => base.ScreenStack;
128-
129127
public RealmAccess Realm => Dependencies.Get<RealmAccess>();
130128

131129
public new GlobalCursorDisplay GlobalCursorDisplay => base.GlobalCursorDisplay;

0 commit comments

Comments
 (0)