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 VolumeDown { 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;
}
public void ToggleTurbo()
{
TurboMode = !TurboMode;
long turboMultiplier = TurboMode ? Configuration.TurboMultiplier : 100;
SetTickSourceMultiplier(turboMultiplier);
}
public void EnableCheats()
{
ModLoader.EnableCheats(Processes.ActiveApplication.ProgramId, TamperMachine);

View file

@ -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<InputConfig>
{
@ -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,

View file

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

View file

@ -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",

View file

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

View file

@ -105,6 +105,12 @@
TextAlignment="Center" />
</ToggleButton>
</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>
</Border>
</ScrollViewer>