1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-05 01:52:21 +00:00

settings: add Show Confirm Exist toggle (#1856)

This commit is contained in:
Bruno Macabeus 2021-01-14 22:30:52 +00:00 committed by GitHub
parent 5be6ec6364
commit 1e5b37c94f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 5 deletions

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Configuration
/// <summary> /// <summary>
/// The current version of the file format /// The current version of the file format
/// </summary> /// </summary>
public const int CurrentVersion = 18; public const int CurrentVersion = 20;
public int Version { get; set; } public int Version { get; set; }
@ -128,6 +128,11 @@ namespace Ryujinx.Configuration
/// </summary> /// </summary>
public bool CheckUpdatesOnStart { get; set; } public bool CheckUpdatesOnStart { get; set; }
/// <summary>
/// Show "Confirm Exit" Dialog
/// </summary>
public bool ShowConfirmExit { get; set; }
/// <summary> /// <summary>
/// Enables or disables Vertical Sync /// Enables or disables Vertical Sync
/// </summary> /// </summary>

View file

@ -360,6 +360,11 @@ namespace Ryujinx.Configuration
/// </summary> /// </summary>
public ReactiveObject<bool> CheckUpdatesOnStart { get; private set; } public ReactiveObject<bool> CheckUpdatesOnStart { get; private set; }
/// <summary>
/// Show "Confirm Exit" Dialog
/// </summary>
public ReactiveObject<bool> ShowConfirmExit { get; private set; }
private ConfigurationState() private ConfigurationState()
{ {
Ui = new UiSection(); Ui = new UiSection();
@ -369,6 +374,7 @@ namespace Ryujinx.Configuration
Hid = new HidSection(); Hid = new HidSection();
EnableDiscordIntegration = new ReactiveObject<bool>(); EnableDiscordIntegration = new ReactiveObject<bool>();
CheckUpdatesOnStart = new ReactiveObject<bool>(); CheckUpdatesOnStart = new ReactiveObject<bool>();
ShowConfirmExit = new ReactiveObject<bool>();
} }
public ConfigurationFileFormat ToFileFormat() public ConfigurationFileFormat ToFileFormat()
@ -413,6 +419,7 @@ namespace Ryujinx.Configuration
DockedMode = System.EnableDockedMode, DockedMode = System.EnableDockedMode,
EnableDiscordIntegration = EnableDiscordIntegration, EnableDiscordIntegration = EnableDiscordIntegration,
CheckUpdatesOnStart = CheckUpdatesOnStart, CheckUpdatesOnStart = CheckUpdatesOnStart,
ShowConfirmExit = ShowConfirmExit,
EnableVsync = Graphics.EnableVsync, EnableVsync = Graphics.EnableVsync,
EnableShaderCache = Graphics.EnableShaderCache, EnableShaderCache = Graphics.EnableShaderCache,
EnablePtc = System.EnablePtc, EnablePtc = System.EnablePtc,
@ -475,6 +482,7 @@ namespace Ryujinx.Configuration
System.EnableDockedMode.Value = false; System.EnableDockedMode.Value = false;
EnableDiscordIntegration.Value = true; EnableDiscordIntegration.Value = true;
CheckUpdatesOnStart.Value = true; CheckUpdatesOnStart.Value = true;
ShowConfirmExit.Value = true;
Graphics.EnableVsync.Value = true; Graphics.EnableVsync.Value = true;
Graphics.EnableShaderCache.Value = true; Graphics.EnableShaderCache.Value = true;
System.EnablePtc.Value = true; System.EnablePtc.Value = true;
@ -770,6 +778,15 @@ namespace Ryujinx.Configuration
configurationFileUpdated = true; 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>(); List<InputConfig> inputConfig = new List<InputConfig>();
inputConfig.AddRange(configurationFileFormat.ControllerConfig); inputConfig.AddRange(configurationFileFormat.ControllerConfig);
inputConfig.AddRange(configurationFileFormat.KeyboardConfig); inputConfig.AddRange(configurationFileFormat.KeyboardConfig);
@ -796,6 +813,7 @@ namespace Ryujinx.Configuration
System.EnableDockedMode.Value = configurationFileFormat.DockedMode; System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache; Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
System.EnablePtc.Value = configurationFileFormat.EnablePtc; System.EnablePtc.Value = configurationFileFormat.EnablePtc;

View file

@ -1,5 +1,5 @@
{ {
"version": 18, "version": 20,
"res_scale": 1, "res_scale": 1,
"res_scale_custom": 1, "res_scale_custom": 1,
"max_anisotropy": -1, "max_anisotropy": -1,
@ -21,6 +21,7 @@
"docked_mode": false, "docked_mode": false,
"enable_discord_integration": true, "enable_discord_integration": true,
"check_updates_on_start": true, "check_updates_on_start": true,
"show_confirm_exit": true,
"enable_vsync": true, "enable_vsync": true,
"enable_shader_cache": true, "enable_shader_cache": true,
"enable_ptc": true, "enable_ptc": true,

View file

@ -154,7 +154,7 @@ namespace Ryujinx.Ui
{ {
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape)) if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape))
{ {
if (GtkDialog.CreateExitDialog()) if (!ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
{ {
Exit(); Exit();
} }

View file

@ -907,7 +907,7 @@ namespace Ryujinx.Ui
private void Exit_Pressed(object sender, EventArgs args) private void Exit_Pressed(object sender, EventArgs args)
{ {
if (!_gameLoaded || GtkDialog.CreateExitDialog()) if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
{ {
End(); End();
} }
@ -915,7 +915,7 @@ namespace Ryujinx.Ui
private void Window_Close(object sender, DeleteEventArgs args) private void Window_Close(object sender, DeleteEventArgs args)
{ {
if (!_gameLoaded || GtkDialog.CreateExitDialog()) if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
{ {
End(); End();
} }

View file

@ -41,6 +41,7 @@ namespace Ryujinx.Ui.Windows
[GUI] CheckButton _dockedModeToggle; [GUI] CheckButton _dockedModeToggle;
[GUI] CheckButton _discordToggle; [GUI] CheckButton _discordToggle;
[GUI] CheckButton _checkUpdatesToggle; [GUI] CheckButton _checkUpdatesToggle;
[GUI] CheckButton _showConfirmExitToggle;
[GUI] CheckButton _vSyncToggle; [GUI] CheckButton _vSyncToggle;
[GUI] CheckButton _shaderCacheToggle; [GUI] CheckButton _shaderCacheToggle;
[GUI] CheckButton _ptcToggle; [GUI] CheckButton _ptcToggle;
@ -176,6 +177,11 @@ namespace Ryujinx.Ui.Windows
_checkUpdatesToggle.Click(); _checkUpdatesToggle.Click();
} }
if (ConfigurationState.Instance.ShowConfirmExit)
{
_showConfirmExitToggle.Click();
}
if (ConfigurationState.Instance.Graphics.EnableVsync) if (ConfigurationState.Instance.Graphics.EnableVsync)
{ {
_vSyncToggle.Click(); _vSyncToggle.Click();
@ -393,6 +399,7 @@ namespace Ryujinx.Ui.Windows
ConfigurationState.Instance.System.EnableDockedMode.Value = _dockedModeToggle.Active; ConfigurationState.Instance.System.EnableDockedMode.Value = _dockedModeToggle.Active;
ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active; ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active;
ConfigurationState.Instance.CheckUpdatesOnStart.Value = _checkUpdatesToggle.Active; ConfigurationState.Instance.CheckUpdatesOnStart.Value = _checkUpdatesToggle.Active;
ConfigurationState.Instance.ShowConfirmExit.Value = _showConfirmExitToggle.Active;
ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active; ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active;
ConfigurationState.Instance.Graphics.EnableShaderCache.Value = _shaderCacheToggle.Active; ConfigurationState.Instance.Graphics.EnableShaderCache.Value = _shaderCacheToggle.Active;
ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active; ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active;

View file

@ -137,6 +137,22 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </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> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

View file

@ -1199,6 +1199,17 @@
false 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": { "enable_vsync": {
"$id": "#/properties/enable_vsync", "$id": "#/properties/enable_vsync",
"type": "boolean", "type": "boolean",