working on issue #4929

This commit is contained in:
Levi Dumas 2024-03-11 23:23:10 -05:00
parent 5a900f38c5
commit b6478ea388
7 changed files with 47 additions and 3 deletions

View file

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

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

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

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

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}"