Add setting to switch between toggle and enabled-while-held turbo hotkey behaviour

This commit is contained in:
unknown 2024-03-24 23:22:18 -03:00
parent 9731aedf4e
commit e4d39b4c24
7 changed files with 27 additions and 8 deletions

View file

@ -14,5 +14,6 @@ namespace Ryujinx.Common.Configuration.Hid
public Key VolumeUp { get; set; } public Key VolumeUp { get; set; }
public Key VolumeDown { get; set; } public Key VolumeDown { get; set; }
public Key ToggleTurbo { get; set; } public Key ToggleTurbo { get; set; }
public bool TurboWhileHeld { get; set; }
} }
} }

View file

@ -131,6 +131,13 @@ namespace Ryujinx.HLE
System.TickSource.TickMultiplier = tickMultiplier; System.TickSource.TickMultiplier = tickMultiplier;
} }
public void ToggleTurbo()
{
TurboMode = !TurboMode;
long turboMultiplier = TurboMode ? Configuration.TurboMultiplier : 100;
SetTickSourceMultiplier(turboMultiplier);
}
public void EnableCheats() public void EnableCheats()
{ {
ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine); ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine);

View file

@ -864,6 +864,7 @@ namespace Ryujinx.UI.Common.Configuration
VolumeUp = Key.Unbound, VolumeUp = Key.Unbound,
VolumeDown = Key.Unbound, VolumeDown = Key.Unbound,
ToggleTurbo = Key.Unbound, ToggleTurbo = Key.Unbound,
TurboWhileHeld = false,
}; };
Hid.InputConfig.Value = new List<InputConfig> Hid.InputConfig.Value = new List<InputConfig>
{ {
@ -1461,6 +1462,7 @@ namespace Ryujinx.UI.Common.Configuration
configurationFileFormat.Hotkeys = new KeyboardHotkeys configurationFileFormat.Hotkeys = new KeyboardHotkeys
{ {
ToggleTurbo = Key.Unbound, ToggleTurbo = Key.Unbound,
TurboWhileHeld = false,
Screenshot = configurationFileFormat.Hotkeys.Screenshot, Screenshot = configurationFileFormat.Hotkeys.Screenshot,
ShowUI = configurationFileFormat.Hotkeys.ShowUI, ShowUI = configurationFileFormat.Hotkeys.ShowUI,
Pause = configurationFileFormat.Hotkeys.Pause, Pause = configurationFileFormat.Hotkeys.Pause,

View file

@ -1068,11 +1068,10 @@ namespace Ryujinx.Ava
if (currentHotkeyState != _prevHotkeyState) 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; Device.ToggleTurbo();
long turboMultiplier = Device.TurboMode ? Device.Configuration.TurboMultiplier : 100;
Device.SetTickSourceMultiplier(turboMultiplier);
} }
switch (currentHotkeyState) switch (currentHotkeyState)
{ {
@ -1087,6 +1086,10 @@ namespace Ryujinx.Ava
_viewModel.ShowMenuAndStatusBar = !_viewModel.ShowMenuAndStatusBar; _viewModel.ShowMenuAndStatusBar = !_viewModel.ShowMenuAndStatusBar;
break; break;
case KeyboardHotkeyState.ToggleTurbo: case KeyboardHotkeyState.ToggleTurbo:
if (!ConfigurationState.Instance.Hid.Hotkeys.Value.TurboWhileHeld)
{
Device.ToggleTurbo();
}
break; break;
case KeyboardHotkeyState.Pause: case KeyboardHotkeyState.Pause:
if (_viewModel.IsPaused) if (_viewModel.IsPaused)

View file

@ -631,7 +631,9 @@
"RyujinxUpdaterMessage": "Do you want to update Ryujinx to the latest version?", "RyujinxUpdaterMessage": "Do you want to update Ryujinx to the latest version?",
"SettingsTabHotkeysVolumeUpHotkey": "Increase Volume:", "SettingsTabHotkeysVolumeUpHotkey": "Increase Volume:",
"SettingsTabHotkeysVolumeDownHotkey": "Decrease 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", "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.", "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", "SettingsEnableColorSpacePassthrough": "Color Space Passthrough",

View file

@ -73,6 +73,7 @@
</CheckBox> </CheckBox>
</StackPanel> </StackPanel>
<Separator Height="1" />
<StackPanel <StackPanel
Orientation="Vertical" Orientation="Vertical"
Spacing="2"> Spacing="2">
@ -112,9 +113,6 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Minimum="50" Minimum="50"
Maximum="500" /> Maximum="500" />
<TextBlock Margin="5,0"
Width="40"
Text="{Binding TurboMultiplierPercentageText}"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</Border> </Border>

View file

@ -105,6 +105,12 @@
TextAlignment="Center" /> TextAlignment="Center" />
</ToggleButton> </ToggleButton>
</StackPanel> </StackPanel>
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
<TextBlock Text="{locale:Locale SettingsTabHotkeysToggleTurboToggle}"
ToolTip.Tip="{locale:Locale SettingsTabHotkeysToggleTurboToggleTooltip}"
Width="230" />
<CheckBox IsChecked="{Binding KeyboardHotkeys.TurboWhileHeld}" />
</StackPanel>
</StackPanel> </StackPanel>
</Border> </Border>
</ScrollViewer> </ScrollViewer>