diff --git a/src/Ryujinx.Gtk3/UI/MainWindow.cs b/src/Ryujinx.Gtk3/UI/MainWindow.cs index d1ca6ce6a..9e34c4115 100644 --- a/src/Ryujinx.Gtk3/UI/MainWindow.cs +++ b/src/Ryujinx.Gtk3/UI/MainWindow.cs @@ -1,3 +1,4 @@ +using Avalonia.Controls; using Gtk; using LibHac.Common; using LibHac.Common.Keys; @@ -1442,7 +1443,19 @@ namespace Ryujinx.UI _pauseEmulation.Sensitive = false; _resumeEmulation.Sensitive = false; UpdateMenuItem.Sensitive = true; - RendererWidget?.Exit(); + + Logger.Warning?.Print(LogClass.Emulation, "afgadfgasgfgsjhfgdsjfgds" + ConfigurationState.Instance.CloseOnEmulatorStop.Value); + //Shutdown if "Close Ryujinx on Emulator Stop" is enabled + if (ConfigurationState.Instance.CloseOnEmulatorStop.Value) + { + Logger.Warning?.Print(LogClass.Emulation, "Shut Ryujinx down" + ConfigurationState.Instance.CloseOnEmulatorStop.Value); + UserControl.CloseWindow(); + } + else + { + Logger.Warning?.Print(LogClass.Emulation, "Don't shut Ryujinx down" + ConfigurationState.Instance.CloseOnEmulatorStop.Value); + RendererWidget?.Exit(); + } } private void PauseEmulation_Pressed(object sender, EventArgs args) @@ -1451,7 +1464,7 @@ namespace Ryujinx.UI _resumeEmulation.Sensitive = true; _emulationContext.System.TogglePauseEmulation(true); Title = TitleHelper.ActiveApplicationTitle(_emulationContext.Processes.ActiveApplication, Program.Version, "Paused"); - Logger.Info?.Print(LogClass.Emulation, "Emulation was paused"); + Logger.Info?.Print(LogClass.Emulation, "Emulation was dinkleberry"); } private void ResumeEmulation_Pressed(object sender, EventArgs args) diff --git a/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs b/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs index dc467c0f2..5ed930615 100644 --- a/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs +++ b/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs @@ -53,6 +53,7 @@ namespace Ryujinx.UI.Windows [GUI] CheckButton _discordToggle; [GUI] CheckButton _checkUpdatesToggle; [GUI] CheckButton _showConfirmExitToggle; + [GUI] CheckButton _closeOnEmulatorStopToggle; [GUI] RadioButton _hideCursorNever; [GUI] RadioButton _hideCursorOnIdle; [GUI] RadioButton _hideCursorAlways; @@ -230,6 +231,11 @@ namespace Ryujinx.UI.Windows _showConfirmExitToggle.Click(); } + if (ConfigurationState.Instance.CloseOnEmulatorStop) + { + _closeOnEmulatorStopToggle.Click(); + } + switch (ConfigurationState.Instance.HideCursor.Value) { case HideCursorMode.Never: @@ -627,6 +633,7 @@ namespace Ryujinx.UI.Windows ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active; ConfigurationState.Instance.CheckUpdatesOnStart.Value = _checkUpdatesToggle.Active; ConfigurationState.Instance.ShowConfirmExit.Value = _showConfirmExitToggle.Active; + ConfigurationState.Instance.CloseOnEmulatorStop.Value = _closeOnEmulatorStopToggle.Active; ConfigurationState.Instance.HideCursor.Value = hideCursor; ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active; ConfigurationState.Instance.Graphics.EnableShaderCache.Value = _shaderCacheToggle.Active; diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs index 0f6c21ef2..56a91dab8 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Multiplayer; @@ -162,6 +163,11 @@ namespace Ryujinx.UI.Common.Configuration /// public bool ShowConfirmExit { get; set; } + /// + /// Close Ryujinx on Emulator Stop + /// + public bool CloseOnEmulatorStop { get; set; } + /// /// Whether to hide cursor on idle, always or never /// diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index b7f36087c..bd08ca78d 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -626,6 +626,11 @@ namespace Ryujinx.UI.Common.Configuration /// public ReactiveObject ShowConfirmExit { get; private set; } + /// + /// Close Ryujinx on Emulator Stop + /// + public ReactiveObject CloseOnEmulatorStop { get; private set; } + /// /// Hide Cursor on Idle /// @@ -642,6 +647,7 @@ namespace Ryujinx.UI.Common.Configuration EnableDiscordIntegration = new ReactiveObject(); CheckUpdatesOnStart = new ReactiveObject(); ShowConfirmExit = new ReactiveObject(); + CloseOnEmulatorStop = new ReactiveObject(); HideCursor = new ReactiveObject(); } @@ -678,6 +684,7 @@ namespace Ryujinx.UI.Common.Configuration EnableDiscordIntegration = EnableDiscordIntegration, CheckUpdatesOnStart = CheckUpdatesOnStart, ShowConfirmExit = ShowConfirmExit, + CloseOnEmulatorStop = CloseOnEmulatorStop, HideCursor = HideCursor, EnableVsync = Graphics.EnableVsync, EnableShaderCache = Graphics.EnableShaderCache, @@ -785,6 +792,7 @@ namespace Ryujinx.UI.Common.Configuration EnableDiscordIntegration.Value = true; CheckUpdatesOnStart.Value = true; ShowConfirmExit.Value = true; + CloseOnEmulatorStop.Value = false; HideCursor.Value = HideCursorMode.OnIdle; Graphics.EnableVsync.Value = true; Graphics.EnableShaderCache.Value = true; @@ -1056,6 +1064,8 @@ namespace Ryujinx.UI.Common.Configuration configurationFileFormat.ShowConfirmExit = true; + configurationFileFormat.CloseOnEmulatorStop = false; + configurationFileUpdated = true; } @@ -1472,6 +1482,7 @@ namespace Ryujinx.UI.Common.Configuration EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit; + CloseOnEmulatorStop.Value = configurationFileFormat.CloseOnEmulatorStop; HideCursor.Value = configurationFileFormat.HideCursor; Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache; diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 2febf90ec..3cd28b43c 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -92,6 +92,7 @@ "SettingsTabGeneralEnableDiscordRichPresence": "Enable Discord Rich Presence", "SettingsTabGeneralCheckUpdatesOnLaunch": "Check for Updates on Launch", "SettingsTabGeneralShowConfirmExitDialog": "Show \"Confirm Exit\" Dialog", + "SettingsTabGeneralCloseOnEmulatorStop": "Close Ryujinx on Emulator Stop", "SettingsTabGeneralHideCursor": "Hide Cursor:", "SettingsTabGeneralHideCursorNever": "Never", "SettingsTabGeneralHideCursorOnIdle": "On Idle", diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index bcaa08600..42530b077 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -132,6 +132,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnableDiscordIntegration { get; set; } public bool CheckUpdatesOnStart { get; set; } public bool ShowConfirmExit { get; set; } + public bool CloseOnEmulatorStop { get; set; } public int HideCursor { get; set; } public bool EnableDockedMode { get; set; } public bool EnableKeyboard { get; set; } @@ -405,6 +406,7 @@ namespace Ryujinx.Ava.UI.ViewModels EnableDiscordIntegration = config.EnableDiscordIntegration; CheckUpdatesOnStart = config.CheckUpdatesOnStart; ShowConfirmExit = config.ShowConfirmExit; + CloseOnEmulatorStop = config.CloseOnEmulatorStop; HideCursor = (int)config.HideCursor.Value; GameDirectories.Clear(); @@ -489,6 +491,7 @@ namespace Ryujinx.Ava.UI.ViewModels config.EnableDiscordIntegration.Value = EnableDiscordIntegration; config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart; config.ShowConfirmExit.Value = ShowConfirmExit; + config.CloseOnEmulatorStop.Value = CloseOnEmulatorStop; config.HideCursor.Value = (HideCursorMode)HideCursor; if (_directoryChanged) diff --git a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml index 6504637e6..2dc66a34b 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml @@ -1,4 +1,4 @@ - + + +