From 740f9b0cdfcf2551b4767836b84b80001bcfce2b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Mar 2024 18:29:36 -0300 Subject: [PATCH 01/11] Add WIP turbo mode --- .../Configuration/Hid/KeyboardHotkeys.cs | 1 + src/Ryujinx.Cpu/TickSource.cs | 20 ++++++++-- src/Ryujinx.Gtk3/UI/MainWindow.cs | 3 +- src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs | 3 +- src/Ryujinx.HLE/HLEConfiguration.cs | 9 ++++- .../Services/SurfaceFlinger/SurfaceFlinger.cs | 3 +- src/Ryujinx.HLE/Switch.cs | 1 + src/Ryujinx.Headless.SDL2/Options.cs | 3 ++ src/Ryujinx.Headless.SDL2/Program.cs | 3 +- src/Ryujinx.Headless.SDL2/WindowBase.cs | 3 +- .../Configuration/ConfigurationFileFormat.cs | 7 +++- .../Configuration/ConfigurationState.cs | 34 +++++++++++++++++ src/Ryujinx/AppHost.cs | 19 +++++++++- src/Ryujinx/Assets/Locales/en_US.json | 4 ++ src/Ryujinx/Common/KeyboardHotkeyState.cs | 1 + .../UI/ViewModels/SettingsViewModel.cs | 25 ++++++++++++ .../Views/Settings/SettingsHotkeysView.axaml | 12 +++++- .../Views/Settings/SettingsSystemView.axaml | 38 ++++++++++++++++++- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 10 +++++ 19 files changed, 183 insertions(+), 16 deletions(-) diff --git a/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs b/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs index e9c163cf20..8d4dd7518e 100644 --- a/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs +++ b/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs @@ -13,5 +13,6 @@ namespace Ryujinx.Common.Configuration.Hid public Key ResScaleDown { get; set; } public Key VolumeUp { get; set; } public Key VolumeDown { get; set; } + public Key ToggleTurbo { get; set; } } } diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index eee83fc62b..a23e664968 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -15,11 +15,25 @@ namespace Ryujinx.Cpu /// public ulong Counter => (ulong)(ElapsedSeconds * Frequency); - /// - public TimeSpan ElapsedTime => _tickCounter.Elapsed; + public static long s_tickMultiplier = 100; + private static long AcumElapsedTicks = 0; + private static long LastElapsedTicks = 0; + private long Elapsedticks + { + get + { + long ElapsedTicks = _tickCounter.ElapsedTicks; + AcumElapsedTicks += (ElapsedTicks - LastElapsedTicks) * s_tickMultiplier / 100; + LastElapsedTicks = ElapsedTicks; + return AcumElapsedTicks; + } + } /// - public double ElapsedSeconds => _tickCounter.ElapsedTicks * _hostTickFreq; + public TimeSpan ElapsedTime => Stopwatch.GetElapsedTime(0, Elapsedticks); + + /// + public double ElapsedSeconds => Elapsedticks * _hostTickFreq; public TickSource(ulong frequency) { diff --git a/src/Ryujinx.Gtk3/UI/MainWindow.cs b/src/Ryujinx.Gtk3/UI/MainWindow.cs index d1ca6ce6ab..ba0b7397e4 100644 --- a/src/Ryujinx.Gtk3/UI/MainWindow.cs +++ b/src/Ryujinx.Gtk3/UI/MainWindow.cs @@ -669,7 +669,8 @@ namespace Ryujinx.UI ConfigurationState.Instance.System.AudioVolume, ConfigurationState.Instance.System.UseHypervisor, ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value, - ConfigurationState.Instance.Multiplayer.Mode); + ConfigurationState.Instance.Multiplayer.Mode, + ConfigurationState.Instance.System.TurboMultiplier); _emulationContext = new HLE.Switch(configuration); } diff --git a/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs b/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs index 0e636792db..fdb066ef0f 100644 --- a/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs +++ b/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs @@ -497,7 +497,8 @@ namespace Ryujinx.UI _gpuBackendName, dockedMode, ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(), - $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)", + $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)" + + (Device.TurboMode ? $" Turbo ({Device.Configuration.TurboMultiplier}%)" : ""), $"FIFO: {Device.Statistics.GetFifoPercent():0.00} %", $"GPU: {_gpuDriverName}")); diff --git a/src/Ryujinx.HLE/HLEConfiguration.cs b/src/Ryujinx.HLE/HLEConfiguration.cs index 955fee4b5f..73eb2b3e71 100644 --- a/src/Ryujinx.HLE/HLEConfiguration.cs +++ b/src/Ryujinx.HLE/HLEConfiguration.cs @@ -83,6 +83,11 @@ namespace Ryujinx.HLE /// This cannot be changed after instantiation. internal readonly RegionCode Region; + /// + /// Turbo mode speed multiplier + /// + public long TurboMultiplier; + /// /// Control the initial state of the vertical sync in the SurfaceFlinger service. /// @@ -194,7 +199,8 @@ namespace Ryujinx.HLE float audioVolume, bool useHypervisor, string multiplayerLanInterfaceId, - MultiplayerMode multiplayerMode) + MultiplayerMode multiplayerMode, + long turboMultiplier) { VirtualFileSystem = virtualFileSystem; LibHacHorizonManager = libHacHorizonManager; @@ -207,6 +213,7 @@ namespace Ryujinx.HLE HostUIHandler = hostUIHandler; SystemLanguage = systemLanguage; Region = region; + TurboMultiplier = turboMultiplier; EnableVsync = enableVsync; EnableDockedMode = enableDockedMode; EnablePtc = enablePtc; diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs index fd517b1ae8..475494c6a8 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs @@ -2,6 +2,7 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Common.PreciseSleep; +using Ryujinx.Cpu; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap; @@ -88,7 +89,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger } else { - _ticksPerFrame = Stopwatch.Frequency / TargetFps; + _ticksPerFrame = (Stopwatch.Frequency / TargetFps * 100) / TickSource.s_tickMultiplier; } } diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index 81c3ab4731..413447533f 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -28,6 +28,7 @@ namespace Ryujinx.HLE public IHostUIHandler UIHandler { get; } public bool EnableDeviceVsync { get; set; } = true; + public bool TurboMode { get; set; } = false; public bool IsFrameAvailable => Gpu.Window.IsFrameAvailable; diff --git a/src/Ryujinx.Headless.SDL2/Options.cs b/src/Ryujinx.Headless.SDL2/Options.cs index ea2063758d..190302769e 100644 --- a/src/Ryujinx.Headless.SDL2/Options.cs +++ b/src/Ryujinx.Headless.SDL2/Options.cs @@ -114,6 +114,9 @@ namespace Ryujinx.Headless.SDL2 [Option("fs-global-access-log-mode", Required = false, Default = 0, HelpText = "Enables FS access log output to the console.")] public int FsGlobalAccessLogMode { get; set; } + [Option("turbo-multiplier", Required = false, Default = 200, HelpText = "The Turbo mode clock speed multiplier.")] + public long TurboMultiplier { get; set; } + [Option("disable-vsync", Required = false, HelpText = "Disables Vertical Sync.")] public bool DisableVSync { get; set; } diff --git a/src/Ryujinx.Headless.SDL2/Program.cs b/src/Ryujinx.Headless.SDL2/Program.cs index 85aff67129..59a91525be 100644 --- a/src/Ryujinx.Headless.SDL2/Program.cs +++ b/src/Ryujinx.Headless.SDL2/Program.cs @@ -571,7 +571,8 @@ namespace Ryujinx.Headless.SDL2 options.AudioVolume, options.UseHypervisor ?? true, options.MultiplayerLanInterfaceId, - Common.Configuration.Multiplayer.MultiplayerMode.Disabled); + Common.Configuration.Multiplayer.MultiplayerMode.Disabled, + options.TurboMultiplier); return new Switch(configuration); } diff --git a/src/Ryujinx.Headless.SDL2/WindowBase.cs b/src/Ryujinx.Headless.SDL2/WindowBase.cs index 8768913f5a..3d40a04521 100644 --- a/src/Ryujinx.Headless.SDL2/WindowBase.cs +++ b/src/Ryujinx.Headless.SDL2/WindowBase.cs @@ -312,7 +312,8 @@ namespace Ryujinx.Headless.SDL2 Device.EnableDeviceVsync, dockedMode, Device.Configuration.AspectRatio.ToText(), - $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)", + $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)" + + (Device.TurboMode ? $" Turbo ({Device.Configuration.TurboMultiplier}%)" : ""), $"FIFO: {Device.Statistics.GetFifoPercent():0.00} %", $"GPU: {_gpuDriverName}")); diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs index 0f6c21ef24..7530a2c3bf 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs @@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 49; + public const int CurrentVersion = 50; /// /// Version of the configuration file format @@ -167,6 +167,11 @@ namespace Ryujinx.UI.Common.Configuration /// public HideCursorMode HideCursor { get; set; } + /// + /// Clock speed multiplier for Turbo mode + /// + public long TurboMultiplier { get; set; } + /// /// Enables or disables Vertical Sync /// diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index b7f36087cb..e2a8b319a3 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -365,6 +365,11 @@ namespace Ryujinx.UI.Common.Configuration /// public ReactiveObject UseHypervisor { get; private set; } + /// + /// Turbo mode clock speed multiplier + /// + public ReactiveObject TurboMultiplier { get; private set; } + public SystemSection() { Language = new ReactiveObject(); @@ -393,6 +398,8 @@ namespace Ryujinx.UI.Common.Configuration AudioVolume.Event += static (sender, e) => LogValueChange(e, nameof(AudioVolume)); UseHypervisor = new ReactiveObject(); UseHypervisor.Event += static (sender, e) => LogValueChange(e, nameof(UseHypervisor)); + TurboMultiplier = new ReactiveObject(); + TurboMultiplier.Event += static (sender, e) => LogValueChange(e, nameof(TurboMultiplier)); } } @@ -675,6 +682,7 @@ namespace Ryujinx.UI.Common.Configuration SystemTimeZone = System.TimeZone, SystemTimeOffset = System.SystemTimeOffset, DockedMode = System.EnableDockedMode, + TurboMultiplier = System.TurboMultiplier, EnableDiscordIntegration = EnableDiscordIntegration, CheckUpdatesOnStart = CheckUpdatesOnStart, ShowConfirmExit = ShowConfirmExit, @@ -782,6 +790,7 @@ namespace Ryujinx.UI.Common.Configuration System.TimeZone.Value = "UTC"; System.SystemTimeOffset.Value = 0; System.EnableDockedMode.Value = true; + System.TurboMultiplier.Value = 200; EnableDiscordIntegration.Value = true; CheckUpdatesOnStart.Value = true; ShowConfirmExit.Value = true; @@ -854,6 +863,7 @@ namespace Ryujinx.UI.Common.Configuration ResScaleDown = Key.Unbound, VolumeUp = Key.Unbound, VolumeDown = Key.Unbound, + ToggleTurbo = Key.F3, }; Hid.InputConfig.Value = new List { @@ -1442,6 +1452,29 @@ namespace Ryujinx.UI.Common.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 50) + { + Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 50."); + + configurationFileFormat.TurboMultiplier = 200; + + configurationFileFormat.Hotkeys = new KeyboardHotkeys + { + ToggleTurbo = Key.F3, + Screenshot = configurationFileFormat.Hotkeys.Screenshot, + ShowUI = configurationFileFormat.Hotkeys.ShowUI, + Pause = configurationFileFormat.Hotkeys.Pause, + ToggleMute = configurationFileFormat.Hotkeys.ToggleMute, + ResScaleUp = configurationFileFormat.Hotkeys.ResScaleUp, + ResScaleDown = configurationFileFormat.Hotkeys.ResScaleDown, + VolumeUp = configurationFileFormat.Hotkeys.VolumeUp, + VolumeDown = configurationFileFormat.Hotkeys.VolumeDown, + ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync, + }; + + configurationFileUpdated = true; + } + Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; Graphics.ResScale.Value = configurationFileFormat.ResScale; Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; @@ -1469,6 +1502,7 @@ namespace Ryujinx.UI.Common.Configuration System.TimeZone.Value = configurationFileFormat.SystemTimeZone; System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset; System.EnableDockedMode.Value = configurationFileFormat.DockedMode; + System.TurboMultiplier.Value = configurationFileFormat.TurboMultiplier; EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart; ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit; diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 2620ea68c6..57d87ff6e5 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -23,6 +23,7 @@ using Ryujinx.Common.Configuration.Multiplayer; using Ryujinx.Common.Logging; using Ryujinx.Common.SystemInterop; using Ryujinx.Common.Utilities; +using Ryujinx.Cpu; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL.Multithreading; using Ryujinx.Graphics.Gpu; @@ -795,7 +796,8 @@ namespace Ryujinx.Ava ConfigurationState.Instance.System.AudioVolume, ConfigurationState.Instance.System.UseHypervisor, ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value, - ConfigurationState.Instance.Multiplayer.Mode); + ConfigurationState.Instance.Multiplayer.Mode, + ConfigurationState.Instance.System.TurboMultiplier); Device = new Switch(configuration); } @@ -980,7 +982,8 @@ namespace Ryujinx.Ava ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan ? "Vulkan" : "OpenGL", dockedMode, ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(), - LocaleManager.Instance[LocaleKeys.Game] + $": {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)", + LocaleManager.Instance[LocaleKeys.Game] + $": {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)" + + (Device.TurboMode ? $" Turbo ({Device.Configuration.TurboMultiplier}%)" : ""), $"FIFO: {Device.Statistics.GetFifoPercent():00.00} %", $"GPU: {_renderer.GetHardwareInfo().GpuDriver}")); } @@ -1065,6 +1068,12 @@ namespace Ryujinx.Ava if (currentHotkeyState != _prevHotkeyState) { + if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ToggleTurbo) != Device.TurboMode) + { + Device.TurboMode = !Device.TurboMode; + long turboMultiplier = Device.TurboMode ? Device.Configuration.TurboMultiplier : 100; + TickSource.s_tickMultiplier = turboMultiplier; + } switch (currentHotkeyState) { case KeyboardHotkeyState.ToggleVSync: @@ -1077,6 +1086,8 @@ namespace Ryujinx.Ava case KeyboardHotkeyState.ShowUI: _viewModel.ShowMenuAndStatusBar = !_viewModel.ShowMenuAndStatusBar; break; + case KeyboardHotkeyState.ToggleTurbo: + break; case KeyboardHotkeyState.Pause: if (_viewModel.IsPaused) { @@ -1192,6 +1203,10 @@ namespace Ryujinx.Ava { state = KeyboardHotkeyState.VolumeDown; } + else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ToggleTurbo)) + { + state = KeyboardHotkeyState.ToggleTurbo; + } return state; } diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 3a3cb3017d..d5adf474c2 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -129,6 +129,9 @@ "SettingsTabSystemSystemLanguageTraditionalChinese": "Traditional Chinese", "SettingsTabSystemSystemTimeZone": "System TimeZone:", "SettingsTabSystemSystemTime": "System Time:", + "SettingsTabSystemTurboMultiplierValue": "Turbo multiplier:", + "SettingsTabSystemTurboMultiplierSliderTooltip": "The Turbo mode multiplier target value.", + "SettingsTabSystemTurboMultiplierValueTooltip": "The Turbo mode multiplier, as a percentage of the normal Switch clock speed.", "SettingsTabSystemEnableVsync": "VSync", "SettingsTabSystemEnablePptc": "PPTC (Profiled Persistent Translation Cache)", "SettingsTabSystemEnableFsIntegrityChecks": "FS Integrity Checks", @@ -627,6 +630,7 @@ "RyujinxUpdaterMessage": "Do you want to update Ryujinx to the latest version?", "SettingsTabHotkeysVolumeUpHotkey": "Increase Volume:", "SettingsTabHotkeysVolumeDownHotkey": "Decrease Volume:", + "SettingsTabHotkeysToggleTurboHotkey": "Toggle turbo mode", "SettingsEnableMacroHLE": "Enable Macro HLE", "SettingsEnableMacroHLETooltip": "High-level emulation of GPU Macro code.\n\nImproves performance, but may cause graphical glitches in some games.\n\nLeave ON if unsure.", "SettingsEnableColorSpacePassthrough": "Color Space Passthrough", diff --git a/src/Ryujinx/Common/KeyboardHotkeyState.cs b/src/Ryujinx/Common/KeyboardHotkeyState.cs index 6e49209887..ea86f6a368 100644 --- a/src/Ryujinx/Common/KeyboardHotkeyState.cs +++ b/src/Ryujinx/Common/KeyboardHotkeyState.cs @@ -12,5 +12,6 @@ namespace Ryujinx.Ava.Common ResScaleDown, VolumeUp, VolumeDown, + ToggleTurbo, } } diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index fde8f74ae4..b3e96b9308 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -13,6 +13,7 @@ using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Multiplayer; using Ryujinx.Common.GraphicsDriver; using Ryujinx.Common.Logging; +using Ryujinx.Cpu; using Ryujinx.Graphics.Vulkan; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS.Services.Time.TimeZone; @@ -50,6 +51,7 @@ namespace Ryujinx.Ava.UI.ViewModels private int _graphicsBackendIndex; private int _scalingFilter; private int _scalingFilterLevel; + private long _turboModeMultiplier; public event Action CloseWindow; public event Action SaveSettingsEvent; @@ -135,6 +137,26 @@ namespace Ryujinx.Ava.UI.ViewModels public int HideCursor { get; set; } public bool EnableDockedMode { get; set; } public bool EnableKeyboard { get; set; } + public long TurboMultiplier + { + get => _turboModeMultiplier; + set + { + if (_turboModeMultiplier != value) + { + _turboModeMultiplier = value; + OnPropertyChanged(); + OnPropertyChanged((nameof(TurboMultiplierPercentageText))); + } + } + } + public string TurboMultiplierPercentageText + { + get + { + return TurboMultiplier.ToString() + "%"; + } + } public bool EnableMouse { get; set; } public bool EnableVsync { get; set; } public bool EnablePptc { get; set; } @@ -434,6 +456,7 @@ namespace Ryujinx.Ava.UI.ViewModels EnablePptc = config.System.EnablePtc; MemoryMode = (int)config.System.MemoryManagerMode.Value; UseHypervisor = config.System.UseHypervisor; + _turboModeMultiplier = config.System.TurboMultiplier; // Graphics GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value; @@ -512,6 +535,7 @@ namespace Ryujinx.Ava.UI.ViewModels } config.System.SystemTimeOffset.Value = Convert.ToInt64((CurrentDate.ToUnixTimeSeconds() + CurrentTime.TotalSeconds) - DateTimeOffset.Now.ToUnixTimeSeconds()); + config.System.TurboMultiplier.Value = TurboMultiplier; config.Graphics.EnableVsync.Value = EnableVsync; config.System.EnableFsIntegrityChecks.Value = EnableFsIntegrityChecks; config.System.ExpandRam.Value = ExpandDramSize; @@ -578,6 +602,7 @@ namespace Ryujinx.Ava.UI.ViewModels config.ToFileFormat().SaveConfig(Program.ConfigurationPath); MainWindow.UpdateGraphicsConfig(); + MainWindow.UpdateTurboConfig(TurboMultiplier); SaveSettingsEvent?.Invoke(); diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml index b4eae01ef9..4bdf006514 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml @@ -1,4 +1,4 @@ - + + + + + + - \ No newline at end of file + diff --git a/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml index e6f7c6e463..96d49b78a2 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml @@ -1,9 +1,10 @@ - + + + + + + - \ No newline at end of file + diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 33a9af5b61..ac77f02ef8 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -11,6 +11,7 @@ using Ryujinx.Ava.UI.Applet; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Common.Logging; +using Ryujinx.Cpu; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS; @@ -407,6 +408,15 @@ namespace Ryujinx.Ava.UI.Windows } } + public static void UpdateTurboConfig(long turboMultiplier) + { + MainWindow.MainWindowViewModel.AppHost.Device.Configuration.TurboMultiplier = turboMultiplier; + if (MainWindow.MainWindowViewModel.AppHost.Device.TurboMode) + { + TickSource.s_tickMultiplier = turboMultiplier; + } + } + public static void UpdateGraphicsConfig() { #pragma warning disable IDE0055 // Disable formatting From 08e66df407af024785108c0b36d97a68afad0d94 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Mar 2024 18:47:11 -0300 Subject: [PATCH 02/11] Change local var name from prev. commit to camelCase --- src/Ryujinx.Cpu/TickSource.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index a23e664968..d06644e565 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -22,9 +22,9 @@ namespace Ryujinx.Cpu { get { - long ElapsedTicks = _tickCounter.ElapsedTicks; - AcumElapsedTicks += (ElapsedTicks - LastElapsedTicks) * s_tickMultiplier / 100; - LastElapsedTicks = ElapsedTicks; + long elapsedTicks = _tickCounter.ElapsedTicks; + AcumElapsedTicks += (elapsedTicks - LastElapsedTicks) * s_tickMultiplier / 100; + LastElapsedTicks = elapsedTicks; return AcumElapsedTicks; } } From 9c0446ec24c753fe5abc5c67997257f3cd2443ce Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Mar 2024 19:44:42 -0300 Subject: [PATCH 03/11] Make Turbo hotkey unbounded by default --- src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index e2a8b319a3..fdc51a91bf 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -863,7 +863,7 @@ namespace Ryujinx.UI.Common.Configuration ResScaleDown = Key.Unbound, VolumeUp = Key.Unbound, VolumeDown = Key.Unbound, - ToggleTurbo = Key.F3, + ToggleTurbo = Key.Unbound, }; Hid.InputConfig.Value = new List { @@ -1460,7 +1460,7 @@ namespace Ryujinx.UI.Common.Configuration configurationFileFormat.Hotkeys = new KeyboardHotkeys { - ToggleTurbo = Key.F3, + ToggleTurbo = Key.Unbound, Screenshot = configurationFileFormat.Hotkeys.Screenshot, ShowUI = configurationFileFormat.Hotkeys.ShowUI, Pause = configurationFileFormat.Hotkeys.Pause, From 7815fd574656e575b1d4b02ceab545b47be905e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Mar 2024 19:45:34 -0300 Subject: [PATCH 04/11] Move turbo multiplier setting to CPU tab --- src/Ryujinx/Assets/Locales/en_US.json | 1 + .../UI/Views/Settings/SettingsCPUView.axaml | 47 ++++++++++++++++++- .../Views/Settings/SettingsSystemView.axaml | 34 -------------- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 10 ++-- 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index d5adf474c2..34bdb80839 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -523,6 +523,7 @@ "SettingsTabNetworkConnection": "Network Connection", "SettingsTabCpuCache": "CPU Cache", "SettingsTabCpuMemory": "CPU Mode", + "SettingsTabCpuHacks": "Hacks", "DialogUpdaterFlatpakNotSupportedMessage": "Please update Ryujinx via FlatHub.", "UpdaterDisabledWarningTitle": "Updater Disabled!", "ControllerSettingsRotate90": "Rotate 90° Clockwise", diff --git a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml index c74d3dd579..67bd687c5b 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml @@ -1,10 +1,11 @@ - @@ -71,6 +72,50 @@ ToolTip.Tip="{locale:Locale UseHypervisorTooltip}" /> + + + + + + + + + + + diff --git a/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml index 96d49b78a2..e8cab19f4f 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml @@ -4,7 +4,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" @@ -219,39 +218,6 @@ - - - - - - diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index ac77f02ef8..233de61f0f 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -11,7 +11,6 @@ using Ryujinx.Ava.UI.Applet; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Common.Logging; -using Ryujinx.Cpu; using Ryujinx.Graphics.Gpu; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS; @@ -410,10 +409,13 @@ namespace Ryujinx.Ava.UI.Windows public static void UpdateTurboConfig(long turboMultiplier) { - MainWindow.MainWindowViewModel.AppHost.Device.Configuration.TurboMultiplier = turboMultiplier; - if (MainWindow.MainWindowViewModel.AppHost.Device.TurboMode) + if (MainWindow.MainWindowViewModel.IsGameRunning) { - TickSource.s_tickMultiplier = turboMultiplier; + MainWindow.MainWindowViewModel.AppHost.Device.Configuration.TurboMultiplier = turboMultiplier; + if (MainWindow.MainWindowViewModel.AppHost.Device.TurboMode) + { + MainWindow.MainWindowViewModel.AppHost.Device.SetTickSourceMultiplier(turboMultiplier); + } } } From 9731aedf4eae91c155fd9f3e6955e104a3ff6edd Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Mar 2024 19:46:30 -0300 Subject: [PATCH 05/11] Change TickSource TickMultiplier from static to an instance variable --- src/Ryujinx.Cpu/ITickSource.cs | 5 +++++ src/Ryujinx.Cpu/TickSource.cs | 4 ++-- .../HOS/Services/SurfaceFlinger/SurfaceFlinger.cs | 2 +- src/Ryujinx.HLE/Switch.cs | 5 +++++ src/Ryujinx/AppHost.cs | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx.Cpu/ITickSource.cs b/src/Ryujinx.Cpu/ITickSource.cs index e65e99e265..d598719ca3 100644 --- a/src/Ryujinx.Cpu/ITickSource.cs +++ b/src/Ryujinx.Cpu/ITickSource.cs @@ -13,6 +13,11 @@ namespace Ryujinx.Cpu /// TimeSpan ElapsedTime { get; } + /// + /// Clock tick multiplier, in percent points (100 = 1.0). + /// + long TickMultiplier { get; set; } + /// /// Time elapsed since the counter was created, in seconds. /// diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index d06644e565..7467a080c6 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Cpu /// public ulong Counter => (ulong)(ElapsedSeconds * Frequency); - public static long s_tickMultiplier = 100; + public long TickMultiplier { get; set; } = 100; private static long AcumElapsedTicks = 0; private static long LastElapsedTicks = 0; private long Elapsedticks @@ -23,7 +23,7 @@ namespace Ryujinx.Cpu get { long elapsedTicks = _tickCounter.ElapsedTicks; - AcumElapsedTicks += (elapsedTicks - LastElapsedTicks) * s_tickMultiplier / 100; + AcumElapsedTicks += (elapsedTicks - LastElapsedTicks) * TickMultiplier / 100; LastElapsedTicks = elapsedTicks; return AcumElapsedTicks; } diff --git a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs index 475494c6a8..c4c53acaa2 100644 --- a/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs +++ b/src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs @@ -89,7 +89,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger } else { - _ticksPerFrame = (Stopwatch.Frequency / TargetFps * 100) / TickSource.s_tickMultiplier; + _ticksPerFrame = (Stopwatch.Frequency / TargetFps * 100) / (_device.System?.TickSource?.TickMultiplier ?? 100); } } diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index 413447533f..fc707e7141 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -126,6 +126,11 @@ namespace Ryujinx.HLE return AudioDeviceDriver.Volume; } + public void SetTickSourceMultiplier(long tickMultiplier) + { + System.TickSource.TickMultiplier = tickMultiplier; + } + public void EnableCheats() { ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine); diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 57d87ff6e5..6fe0a4288d 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -1072,7 +1072,7 @@ namespace Ryujinx.Ava { Device.TurboMode = !Device.TurboMode; long turboMultiplier = Device.TurboMode ? Device.Configuration.TurboMultiplier : 100; - TickSource.s_tickMultiplier = turboMultiplier; + Device.SetTickSourceMultiplier(turboMultiplier); } switch (currentHotkeyState) { From e4d39b4c24abbdc62480448b81b4bf8fb395d32f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 24 Mar 2024 23:22:18 -0300 Subject: [PATCH 06/11] Add setting to switch between toggle and enabled-while-held turbo hotkey behaviour --- .../Configuration/Hid/KeyboardHotkeys.cs | 1 + src/Ryujinx.HLE/Switch.cs | 7 +++++++ .../Configuration/ConfigurationState.cs | 2 ++ src/Ryujinx/AppHost.cs | 11 +++++++---- src/Ryujinx/Assets/Locales/en_US.json | 4 +++- src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml | 4 +--- .../UI/Views/Settings/SettingsHotkeysView.axaml | 6 ++++++ 7 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs b/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs index 8d4dd7518e..af0c4616a5 100644 --- a/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs +++ b/src/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs @@ -14,5 +14,6 @@ namespace Ryujinx.Common.Configuration.Hid public Key VolumeUp { get; set; } public Key VolumeDown { get; set; } public Key ToggleTurbo { get; set; } + public bool TurboWhileHeld { get; set; } } } diff --git a/src/Ryujinx.HLE/Switch.cs b/src/Ryujinx.HLE/Switch.cs index fc707e7141..f0b359a32b 100644 --- a/src/Ryujinx.HLE/Switch.cs +++ b/src/Ryujinx.HLE/Switch.cs @@ -131,6 +131,13 @@ namespace Ryujinx.HLE System.TickSource.TickMultiplier = tickMultiplier; } + public void ToggleTurbo() + { + TurboMode = !TurboMode; + long turboMultiplier = TurboMode ? Configuration.TurboMultiplier : 100; + SetTickSourceMultiplier(turboMultiplier); + } + public void EnableCheats() { ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine); diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index fdc51a91bf..2dca1c7f26 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -864,6 +864,7 @@ namespace Ryujinx.UI.Common.Configuration VolumeUp = Key.Unbound, VolumeDown = Key.Unbound, ToggleTurbo = Key.Unbound, + TurboWhileHeld = false, }; Hid.InputConfig.Value = new List { @@ -1461,6 +1462,7 @@ namespace Ryujinx.UI.Common.Configuration configurationFileFormat.Hotkeys = new KeyboardHotkeys { ToggleTurbo = Key.Unbound, + TurboWhileHeld = false, Screenshot = configurationFileFormat.Hotkeys.Screenshot, ShowUI = configurationFileFormat.Hotkeys.ShowUI, Pause = configurationFileFormat.Hotkeys.Pause, diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 6fe0a4288d..a7e5498975 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -1068,11 +1068,10 @@ namespace Ryujinx.Ava if (currentHotkeyState != _prevHotkeyState) { - if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ToggleTurbo) != Device.TurboMode) + if (ConfigurationState.Instance.Hid.Hotkeys.Value.TurboWhileHeld && + _keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ToggleTurbo) != Device.TurboMode) { - Device.TurboMode = !Device.TurboMode; - long turboMultiplier = Device.TurboMode ? Device.Configuration.TurboMultiplier : 100; - Device.SetTickSourceMultiplier(turboMultiplier); + Device.ToggleTurbo(); } switch (currentHotkeyState) { @@ -1087,6 +1086,10 @@ namespace Ryujinx.Ava _viewModel.ShowMenuAndStatusBar = !_viewModel.ShowMenuAndStatusBar; break; case KeyboardHotkeyState.ToggleTurbo: + if (!ConfigurationState.Instance.Hid.Hotkeys.Value.TurboWhileHeld) + { + Device.ToggleTurbo(); + } break; case KeyboardHotkeyState.Pause: if (_viewModel.IsPaused) diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 34bdb80839..6214b0a940 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -631,7 +631,9 @@ "RyujinxUpdaterMessage": "Do you want to update Ryujinx to the latest version?", "SettingsTabHotkeysVolumeUpHotkey": "Increase Volume:", "SettingsTabHotkeysVolumeDownHotkey": "Decrease Volume:", - "SettingsTabHotkeysToggleTurboHotkey": "Toggle turbo mode", + "SettingsTabHotkeysToggleTurboHotkey": "Toggle turbo mode:", + "SettingsTabHotkeysToggleTurboToggleTooltip": "Makes the turbo hotkey enable turbo while held instead of toggling it.", + "SettingsTabHotkeysToggleTurboToggle": "Enable turbo while held:", "SettingsEnableMacroHLE": "Enable Macro HLE", "SettingsEnableMacroHLETooltip": "High-level emulation of GPU Macro code.\n\nImproves performance, but may cause graphical glitches in some games.\n\nLeave ON if unsure.", "SettingsEnableColorSpacePassthrough": "Color Space Passthrough", diff --git a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml index 67bd687c5b..caf3a0c10c 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml @@ -73,6 +73,7 @@ + @@ -112,9 +113,6 @@ VerticalAlignment="Center" Minimum="50" Maximum="500" /> - diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml index 4bdf006514..f624dc1d6f 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml @@ -105,6 +105,12 @@ TextAlignment="Center" /> + + + + From 2b12165e9fecc09d717722ca7a5393b34f054547 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Jun 2024 22:43:27 -0300 Subject: [PATCH 07/11] Bump config version --- src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs index 10e492d48d..114f086e62 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs @@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 51; + public const int CurrentVersion = 52; /// /// Version of the configuration file format From 32c4a5c04c0958e6dd33d14c2e6f76898a457655 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Jun 2024 22:44:13 -0300 Subject: [PATCH 08/11] Fix whitespace --- src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index 20f5eda7de..6f6e769e01 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -1491,7 +1491,7 @@ namespace Ryujinx.UI.Common.Configuration if (configurationFileFormat.Version < 52) { Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 52."); - + configurationFileFormat.TurboMultiplier = 200; configurationFileFormat.Hotkeys = new KeyboardHotkeys From c5eecc320c2d108f0ea469c51a2f269b2383d5db Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 2 Jun 2024 23:01:54 -0300 Subject: [PATCH 09/11] Update ToggleTurbo hotkey to refactored Input --- src/Ryujinx/UI/Models/Input/HotkeyConfig.cs | 13 +++++++++++++ .../UI/Views/Settings/SettingsHotkeysView.axaml | 2 +- .../UI/Views/Settings/SettingsHotkeysView.axaml.cs | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs index b5f53508bd..02fd84b836 100644 --- a/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs +++ b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs @@ -104,6 +104,17 @@ namespace Ryujinx.Ava.UI.Models.Input } } + private Key _toggleTurbo; + public Key ToggleTurbo + { + get => _toggleTurbo; + set + { + _toggleTurbo = value; + OnPropertyChanged(); + } + } + public HotkeyConfig(KeyboardHotkeys config) { if (config != null) @@ -117,6 +128,7 @@ namespace Ryujinx.Ava.UI.Models.Input ResScaleDown = config.ResScaleDown; VolumeUp = config.VolumeUp; VolumeDown = config.VolumeDown; + ToggleTurbo = config.ToggleTurbo; } } @@ -133,6 +145,7 @@ namespace Ryujinx.Ava.UI.Models.Input ResScaleDown = ResScaleDown, VolumeUp = VolumeUp, VolumeDown = VolumeDown, + ToggleTurbo = ToggleTurbo, }; return config; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml index 62a69f9e6c..4a1c75b473 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml @@ -105,7 +105,7 @@ - + diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs index fb0fe2bb12..0974f0eeea 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs @@ -109,6 +109,9 @@ namespace Ryujinx.Ava.UI.Views.Settings case "VolumeDown": viewModel.KeyboardHotkey.VolumeDown = buttonValue.AsHidType(); break; + case "ToggleTurbo": + viewModel.KeyboardHotkey.ToggleTurbo = buttonValue.AsHidType(); + break; } } }; From 784f75e66556cce8705f77ebe632637ea11c5566 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jun 2024 00:10:31 -0300 Subject: [PATCH 10/11] Update TurboWhileHeld hotkey to refactored Input --- src/Ryujinx/UI/Models/Input/HotkeyConfig.cs | 15 ++++++++++++++- .../UI/Views/Settings/SettingsHotkeysView.axaml | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs index 02fd84b836..e7e5375008 100644 --- a/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs +++ b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs @@ -115,6 +115,17 @@ namespace Ryujinx.Ava.UI.Models.Input } } + private bool _turboWhileHeld; + public bool TurboWhileHeld + { + get => _turboWhileHeld; + set + { + _turboWhileHeld = value; + OnPropertyChanged(); + } + } + public HotkeyConfig(KeyboardHotkeys config) { if (config != null) @@ -129,6 +140,7 @@ namespace Ryujinx.Ava.UI.Models.Input VolumeUp = config.VolumeUp; VolumeDown = config.VolumeDown; ToggleTurbo = config.ToggleTurbo; + TurboWhileHeld = config.TurboWhileHeld; } } @@ -146,7 +158,8 @@ namespace Ryujinx.Ava.UI.Models.Input VolumeUp = VolumeUp, VolumeDown = VolumeDown, ToggleTurbo = ToggleTurbo, - }; + TurboWhileHeld = TurboWhileHeld, + }; return config; } diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml index 4a1c75b473..d0479ee192 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml @@ -107,7 +107,7 @@ @@ -115,7 +115,7 @@ - + From c42c30d7ef59b61e823d7530892a03724be3ed45 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jun 2024 09:48:05 -0300 Subject: [PATCH 11/11] Fix whitespace --- src/Ryujinx/UI/Models/Input/HotkeyConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs index e7e5375008..6b233a2dcd 100644 --- a/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs +++ b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs @@ -159,7 +159,7 @@ namespace Ryujinx.Ava.UI.Models.Input VolumeDown = VolumeDown, ToggleTurbo = ToggleTurbo, TurboWhileHeld = TurboWhileHeld, - }; + }; return config; }