1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 14:07:19 +08:00

Don't require a restart when selecting Automatic and startup setting was also automatic

This commit is contained in:
Dean Herbert 2023-03-22 16:56:35 +09:00
parent aabe86dc26
commit 3050a16bf8

View File

@ -17,10 +17,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
{
protected override LocalisableString Header => GraphicsSettingsStrings.RendererHeader;
private bool automaticRendererInUse;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, IDialogOverlay dialogOverlay, OsuGame game, GameHost host)
{
var renderer = config.GetBindable<RendererType>(FrameworkSetting.Renderer);
automaticRendererInUse = renderer.Value == RendererType.Automatic;
Children = new Drawable[]
{
@ -55,6 +58,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
if (r.NewValue == host.ResolvedRenderer)
return;
// Need to check startup renderer for the "automatic" case, as ResolvedRenderer above will track the final resolved renderer instead.
if (r.NewValue == RendererType.Automatic && automaticRendererInUse)
return;
dialogOverlay.Push(new ConfirmDialog(GraphicsSettingsStrings.ChangeRendererConfirmation, game.AttemptExit, () =>
{
renderer.SetDefault();