diff options
| author | Bruno Macabeus <macabeus@users.noreply.github.com> | 2021-01-14 22:30:52 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-14 23:30:52 +0100 |
| commit | 1e5b37c94f870dc3faa94fb2d095cfa39fecb2a3 (patch) | |
| tree | fbae59991dd72db91d46f7b33802af1c91591b13 | |
| parent | 5be6ec63648eec8ad108c3b4bd681e5397afb646 (diff) | |
settings: add Show Confirm Exist toggle (#1856)
| -rw-r--r-- | Ryujinx.Common/Configuration/ConfigurationFileFormat.cs | 7 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/ConfigurationState.cs | 18 | ||||
| -rw-r--r-- | Ryujinx/Config.json | 3 | ||||
| -rw-r--r-- | Ryujinx/Ui/GLRenderer.cs | 2 | ||||
| -rw-r--r-- | Ryujinx/Ui/MainWindow.cs | 4 | ||||
| -rw-r--r-- | Ryujinx/Ui/Windows/SettingsWindow.cs | 7 | ||||
| -rw-r--r-- | Ryujinx/Ui/Windows/SettingsWindow.glade | 16 | ||||
| -rw-r--r-- | Ryujinx/_schema.json | 11 |
8 files changed, 63 insertions, 5 deletions
diff --git a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs index cb7c3b7e..72cc579c 100644 --- a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Configuration /// <summary> /// The current version of the file format /// </summary> - public const int CurrentVersion = 18; + public const int CurrentVersion = 20; public int Version { get; set; } @@ -129,6 +129,11 @@ namespace Ryujinx.Configuration public bool CheckUpdatesOnStart { get; set; } /// <summary> + /// Show "Confirm Exit" Dialog + /// </summary> + public bool ShowConfirmExit { get; set; } + + /// <summary> /// Enables or disables Vertical Sync /// </summary> public bool EnableVsync { get; set; } diff --git a/Ryujinx.Common/Configuration/ConfigurationState.cs b/Ryujinx.Common/Configuration/ConfigurationState.cs index 4457eb36..a0fef1b2 100644 --- a/Ryujinx.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Common/Configuration/ConfigurationState.cs @@ -360,6 +360,11 @@ namespace Ryujinx.Configuration /// </summary> public ReactiveObject<bool> CheckUpdatesOnStart { get; private set; } + /// <summary> + /// Show "Confirm Exit" Dialog + /// </summary> + public ReactiveObject<bool> ShowConfirmExit { get; private set; } + private ConfigurationState() { Ui = new UiSection(); @@ -369,6 +374,7 @@ namespace Ryujinx.Configuration Hid = new HidSection(); EnableDiscordIntegration = new ReactiveObject<bool>(); CheckUpdatesOnStart = new ReactiveObject<bool>(); + ShowConfirmExit = new ReactiveObject<bool>(); } public ConfigurationFileFormat ToFileFormat() @@ -413,6 +419,7 @@ namespace Ryujinx.Configuration DockedMode = System.EnableDockedMode, EnableDiscordIntegration = EnableDiscordIntegration, CheckUpdatesOnStart = CheckUpdatesOnStart, + ShowConfirmExit = ShowConfirmExit, EnableVsync = Graphics.EnableVsync, EnableShaderCache = Graphics.EnableShaderCache, EnablePtc = System.EnablePtc, @@ -475,6 +482,7 @@ namespace Ryujinx.Configuration System.EnableDockedMode.Value = false; EnableDiscordIntegration.Value = true; CheckUpdatesOnStart.Value = true; + ShowConfirmExit.Value = true; Graphics.EnableVsync.Value = true; Graphics.EnableShaderCache.Value = true; System.EnablePtc.Value = true; @@ -770,6 +778,15 @@ namespace Ryujinx.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 20) + { + Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 20."); + + configurationFileFormat.ShowConfirmExit = true; + + configurationFileUpdated = true; + } + List<InputConfig> inputConfig = new List<InputConfig>(); inputConfig.AddRange(configurationFileFormat.ControllerConfig); inputConfig.AddRange(configurationFileFormat.KeyboardConfig); @@ -796,6 +813,7 @@ namespace Ryujinx.Configuration System.EnableDockedMode.Value = configurationFileFormat.DockedMode; EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; + ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit; Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache; System.EnablePtc.Value = configurationFileFormat.EnablePtc; diff --git a/Ryujinx/Config.json b/Ryujinx/Config.json index f7a119e3..dac28ef3 100644 --- a/Ryujinx/Config.json +++ b/Ryujinx/Config.json @@ -1,5 +1,5 @@ { - "version": 18, + "version": 20, "res_scale": 1, "res_scale_custom": 1, "max_anisotropy": -1, @@ -21,6 +21,7 @@ "docked_mode": false, "enable_discord_integration": true, "check_updates_on_start": true, + "show_confirm_exit": true, "enable_vsync": true, "enable_shader_cache": true, "enable_ptc": true, diff --git a/Ryujinx/Ui/GLRenderer.cs b/Ryujinx/Ui/GLRenderer.cs index 6115c22b..35c00a33 100644 --- a/Ryujinx/Ui/GLRenderer.cs +++ b/Ryujinx/Ui/GLRenderer.cs @@ -154,7 +154,7 @@ namespace Ryujinx.Ui { if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape)) { - if (GtkDialog.CreateExitDialog()) + if (!ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog()) { Exit(); } diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index c197ad12..2e343729 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -907,7 +907,7 @@ namespace Ryujinx.Ui private void Exit_Pressed(object sender, EventArgs args) { - if (!_gameLoaded || GtkDialog.CreateExitDialog()) + if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog()) { End(); } @@ -915,7 +915,7 @@ namespace Ryujinx.Ui private void Window_Close(object sender, DeleteEventArgs args) { - if (!_gameLoaded || GtkDialog.CreateExitDialog()) + if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog()) { End(); } diff --git a/Ryujinx/Ui/Windows/SettingsWindow.cs b/Ryujinx/Ui/Windows/SettingsWindow.cs index a44abfcc..4497dedf 100644 --- a/Ryujinx/Ui/Windows/SettingsWindow.cs +++ b/Ryujinx/Ui/Windows/SettingsWindow.cs @@ -41,6 +41,7 @@ namespace Ryujinx.Ui.Windows [GUI] CheckButton _dockedModeToggle; [GUI] CheckButton _discordToggle; [GUI] CheckButton _checkUpdatesToggle; + [GUI] CheckButton _showConfirmExitToggle; [GUI] CheckButton _vSyncToggle; [GUI] CheckButton _shaderCacheToggle; [GUI] CheckButton _ptcToggle; @@ -176,6 +177,11 @@ namespace Ryujinx.Ui.Windows _checkUpdatesToggle.Click(); } + if (ConfigurationState.Instance.ShowConfirmExit) + { + _showConfirmExitToggle.Click(); + } + if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); @@ -393,6 +399,7 @@ namespace Ryujinx.Ui.Windows ConfigurationState.Instance.System.EnableDockedMode.Value = _dockedModeToggle.Active; ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active; ConfigurationState.Instance.CheckUpdatesOnStart.Value = _checkUpdatesToggle.Active; + ConfigurationState.Instance.ShowConfirmExit.Value = _showConfirmExitToggle.Active; ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active; ConfigurationState.Instance.Graphics.EnableShaderCache.Value = _shaderCacheToggle.Active; ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active; diff --git a/Ryujinx/Ui/Windows/SettingsWindow.glade b/Ryujinx/Ui/Windows/SettingsWindow.glade index 936aa520..97a88b22 100644 --- a/Ryujinx/Ui/Windows/SettingsWindow.glade +++ b/Ryujinx/Ui/Windows/SettingsWindow.glade @@ -137,6 +137,22 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="_showConfirmExitToggle"> + <property name="label" translatable="yes">Show "Confirm Exit" Dialog</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="halign">start</property> + <property name="draw-indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">5</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">True</property> diff --git a/Ryujinx/_schema.json b/Ryujinx/_schema.json index d8402fee..549611af 100644 --- a/Ryujinx/_schema.json +++ b/Ryujinx/_schema.json @@ -1199,6 +1199,17 @@ false ] }, + "show_confirm_exit": { + "$id": "#/properties/show_confirm_exit", + "type": "boolean", + "title": "Show \"Confirm Exit\" Dialog", + "description": "Check to shows the \"Confirm Exit\" dialog when closing Ryujinx.", + "default": true, + "examples": [ + true, + false + ] + }, "enable_vsync": { "$id": "#/properties/enable_vsync", "type": "boolean", |
