This commit is contained in:
CoolBeansStudioOfficial 2024-04-06 22:46:42 +08:00 committed by GitHub
commit 3ec2be34c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 48 additions and 2 deletions

View file

@ -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;

View file

@ -162,6 +162,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public bool ShowConfirmExit { get; set; }
/// <summary>
/// Close Ryujinx on Emulator Stop
/// </summary>
public bool CloseOnEmulatorStop { get; set; }
/// <summary>
/// Whether to hide cursor on idle, always or never
/// </summary>

View file

@ -626,6 +626,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public ReactiveObject<bool> ShowConfirmExit { get; private set; }
/// <summary>
/// Close Ryujinx on Emulator Stop
/// </summary>
public ReactiveObject<bool> CloseOnEmulatorStop { get; private set; }
/// <summary>
/// Hide Cursor on Idle
/// </summary>
@ -642,6 +647,7 @@ namespace Ryujinx.UI.Common.Configuration
EnableDiscordIntegration = new ReactiveObject<bool>();
CheckUpdatesOnStart = new ReactiveObject<bool>();
ShowConfirmExit = new ReactiveObject<bool>();
CloseOnEmulatorStop = new ReactiveObject<bool>();
HideCursor = new ReactiveObject<HideCursorMode>();
}
@ -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;

View file

@ -742,6 +742,14 @@ namespace Ryujinx.Ava
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
}
internal void Close()
{
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime app)
{
app.MainWindow.Close();
}
}
private void InitializeSwitchInstance()
{
// Initialize KeySet.
@ -1010,7 +1018,15 @@ namespace Ryujinx.Ava
if (shouldExit)
{
Stop();
if (ConfigurationState.Instance.CloseOnEmulatorStop)
{
Close();
}
else
{
Stop();
}
}
}

View file

@ -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",

View file

@ -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; }
@ -400,6 +401,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();
@ -484,6 +486,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)

View file

@ -1,4 +1,4 @@
<UserControl
<UserControl
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsUiView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -36,6 +36,9 @@
<CheckBox IsChecked="{Binding ShowConfirmExit}">
<TextBlock Text="{locale:Locale SettingsTabGeneralShowConfirmExitDialog}" />
</CheckBox>
<CheckBox IsChecked="{Binding CloseOnEmulatorStop}">
<TextBlock Text="{locale:Locale SettingsTabGeneralCloseOnEmulatorStop}" />
</CheckBox>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="{locale:Locale SettingsTabGeneralHideCursor}"