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" /> + + + +