aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx/Ui
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-05-16 17:12:14 +0200
committerGitHub <noreply@github.com>2021-05-16 17:12:14 +0200
commitbec67dbef7a505fb5c4a1734be1517f67474fb4d (patch)
tree3a0353d8e0fce1c8e02544b465eb1d3aacadf125 /Ryujinx/Ui
parentf48828351c759ef63e015ca9806406fab278c458 (diff)
misc: Move configuration management to the Ryujinx project (#2269)
* Decouple configuration from Ryujinx.HLE and Ryujinx.Input * Move Configuration to the Ryujinx project
Diffstat (limited to 'Ryujinx/Ui')
-rw-r--r--Ryujinx/Ui/Applet/GtkHostUiHandler.cs2
-rw-r--r--Ryujinx/Ui/MainWindow.cs67
-rw-r--r--Ryujinx/Ui/RendererWidgetBase.cs6
-rw-r--r--Ryujinx/Ui/Windows/ControllerWindow.cs2
-rw-r--r--Ryujinx/Ui/Windows/SettingsWindow.cs4
5 files changed, 61 insertions, 20 deletions
diff --git a/Ryujinx/Ui/Applet/GtkHostUiHandler.cs b/Ryujinx/Ui/Applet/GtkHostUiHandler.cs
index d74ea3d5..c227ebd3 100644
--- a/Ryujinx/Ui/Applet/GtkHostUiHandler.cs
+++ b/Ryujinx/Ui/Applet/GtkHostUiHandler.cs
@@ -131,7 +131,7 @@ namespace Ryujinx.Ui.Applet
public void ExecuteProgram(HLE.Switch device, ProgramSpecifyKind kind, ulong value)
{
- device.UserChannelPersistence.ExecuteProgram(kind, value);
+ device.Configuration.UserChannelPersistence.ExecuteProgram(kind, value);
((MainWindow)_parent).RendererWidget?.Exit();
}
diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs
index a2a00992..1eef7554 100644
--- a/Ryujinx/Ui/MainWindow.cs
+++ b/Ryujinx/Ui/MainWindow.cs
@@ -2,12 +2,14 @@ using ARMeilleure.Translation;
using ARMeilleure.Translation.PTC;
using Gtk;
using LibHac.Common;
+using LibHac.FsSystem;
using LibHac.Ns;
using Ryujinx.Audio.Backends.Dummy;
using Ryujinx.Audio.Backends.OpenAL;
using Ryujinx.Audio.Backends.SDL2;
using Ryujinx.Audio.Backends.SoundIo;
using Ryujinx.Audio.Integration;
+using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Common.System;
@@ -18,6 +20,7 @@ using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services.Account.Acc;
+using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.Input.GTK3;
using Ryujinx.Input.HLE;
using Ryujinx.Input.SDL2;
@@ -166,6 +169,10 @@ namespace Ryujinx.Ui
RendererWidgetBase.StatusUpdatedEvent += Update_StatusBar;
+ ConfigurationState.Instance.System.IgnoreMissingServices.Event += UpdateIgnoreMissingServicesState;
+ ConfigurationState.Instance.Graphics.AspectRatio.Event += UpdateAspectRatioState;
+ ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
+
if (ConfigurationState.Instance.Ui.StartFullscreen)
{
_startFullScreen.Active = true;
@@ -236,6 +243,30 @@ namespace Ryujinx.Ui
InputManager = new InputManager(new GTK3KeyboardDriver(this), new SDL2GamepadDriver());
}
+ private void UpdateIgnoreMissingServicesState(object sender, ReactiveEventArgs<bool> args)
+ {
+ if (_emulationContext != null)
+ {
+ _emulationContext.Configuration.IgnoreMissingServices = args.NewValue;
+ }
+ }
+
+ private void UpdateAspectRatioState(object sender, ReactiveEventArgs<AspectRatio> args)
+ {
+ if (_emulationContext != null)
+ {
+ _emulationContext.Configuration.AspectRatio = args.NewValue;
+ }
+ }
+
+ private void UpdateDockedModeState(object sender, ReactiveEventArgs<bool> e)
+ {
+ if (_emulationContext != null)
+ {
+ _emulationContext.System.ChangeDockedModeState(e.NewValue);
+ }
+ }
+
private void WindowStateEvent_Changed(object o, WindowStateEventArgs args)
{
_fullScreen.Label = args.Event.NewWindowState.HasFlag(Gdk.WindowState.Fullscreen) ? "Exit Fullscreen" : "Enter Fullscreen";
@@ -380,19 +411,29 @@ namespace Ryujinx.Ui
? HLE.MemoryConfiguration.MemoryConfiguration6GB
: HLE.MemoryConfiguration.MemoryConfiguration4GB;
- _emulationContext = new HLE.Switch(
- _virtualFileSystem,
- _contentManager,
- _accountManager,
- _userChannelPersistence,
- renderer,
- deviceDriver,
- memoryConfiguration)
- {
- UiHandler = _uiHandler
- };
-
- _emulationContext.Initialize();
+ IntegrityCheckLevel fsIntegrityCheckLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None;
+
+ HLE.HLEConfiguration configuration = new HLE.HLEConfiguration(_virtualFileSystem,
+ _contentManager,
+ _accountManager,
+ _userChannelPersistence,
+ renderer,
+ deviceDriver,
+ memoryConfiguration,
+ _uiHandler,
+ (SystemLanguage)ConfigurationState.Instance.System.Language.Value,
+ (RegionCode)ConfigurationState.Instance.System.Region.Value,
+ ConfigurationState.Instance.Graphics.EnableVsync,
+ ConfigurationState.Instance.System.EnableDockedMode,
+ ConfigurationState.Instance.System.EnablePtc,
+ fsIntegrityCheckLevel,
+ ConfigurationState.Instance.System.FsGlobalAccessLogMode,
+ ConfigurationState.Instance.System.SystemTimeOffset,
+ ConfigurationState.Instance.System.TimeZone,
+ ConfigurationState.Instance.System.IgnoreMissingServices,
+ ConfigurationState.Instance.Graphics.AspectRatio);
+
+ _emulationContext = new HLE.Switch(configuration);
}
private void SetupProgressUiHandlers()
diff --git a/Ryujinx/Ui/RendererWidgetBase.cs b/Ryujinx/Ui/RendererWidgetBase.cs
index 1e388747..00882ba0 100644
--- a/Ryujinx/Ui/RendererWidgetBase.cs
+++ b/Ryujinx/Ui/RendererWidgetBase.cs
@@ -73,8 +73,6 @@ namespace Ryujinx.Ui
NpadManager = _inputManager.CreateNpadManager();
_keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0");
- NpadManager.ReloadConfiguration(ConfigurationState.Instance.Hid.InputConfig.Value.ToList());
-
WaitEvent = new ManualResetEvent(false);
_glLogLevel = glLogLevel;
@@ -300,6 +298,8 @@ namespace Ryujinx.Ui
Device = device;
Renderer = Device.Gpu.Renderer;
Renderer?.Window.SetSize(_windowWidth, _windowHeight);
+
+ NpadManager.Initialize(device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard);
}
public void Render()
@@ -488,7 +488,7 @@ namespace Ryujinx.Ui
});
}
- NpadManager.Update(Device.Hid, Device.TamperMachine);
+ NpadManager.Update();
if (_isFocused)
{
diff --git a/Ryujinx/Ui/Windows/ControllerWindow.cs b/Ryujinx/Ui/Windows/ControllerWindow.cs
index 2732bdcb..0a3deec1 100644
--- a/Ryujinx/Ui/Windows/ControllerWindow.cs
+++ b/Ryujinx/Ui/Windows/ControllerWindow.cs
@@ -1143,7 +1143,7 @@ namespace Ryujinx.Ui.Windows
if (_mainWindow.RendererWidget != null)
{
- _mainWindow.RendererWidget.NpadManager.ReloadConfiguration(newConfig);
+ _mainWindow.RendererWidget.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard);
}
// Atomically replace and signal input change.
diff --git a/Ryujinx/Ui/Windows/SettingsWindow.cs b/Ryujinx/Ui/Windows/SettingsWindow.cs
index 94afb242..43fea4e2 100644
--- a/Ryujinx/Ui/Windows/SettingsWindow.cs
+++ b/Ryujinx/Ui/Windows/SettingsWindow.cs
@@ -263,7 +263,7 @@ namespace Ryujinx.Ui.Windows
}
_systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width
- _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName();
+ _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName(ConfigurationState.Instance.System.TimeZone);
_systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc;
@@ -462,7 +462,7 @@ namespace Ryujinx.Ui.Windows
{
if (!_validTzRegions.Contains(_systemTimeZoneEntry.Text))
{
- _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName();
+ _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName(ConfigurationState.Instance.System.TimeZone);
}
}