Make hid keyboard feature toggleable
This commit is contained in:
parent
edb7b6222f
commit
2f18fa1d6a
6 changed files with 37 additions and 7 deletions
|
@ -150,8 +150,8 @@ namespace Ryujinx.HLE.Input
|
|||
_device.Memory.WriteInt64(keyboardOffset + 0x18, HidEntryCount - 1);
|
||||
|
||||
long keyboardEntryOffset = keyboardOffset + HidKeyboardHeaderSize;
|
||||
long lastEntryOffset = keyboardEntryOffset + lastEntry * HidKeyboardEntrySize;
|
||||
long sampleCounter = _device.Memory.ReadInt64(lastEntryOffset);
|
||||
long lastEntryOffset = keyboardEntryOffset + lastEntry * HidKeyboardEntrySize;
|
||||
long sampleCounter = _device.Memory.ReadInt64(lastEntryOffset);
|
||||
|
||||
keyboardEntryOffset += currEntry * HidKeyboardEntrySize;
|
||||
_device.Memory.WriteInt64(keyboardEntryOffset + 0x00, sampleCounter + 1);
|
||||
|
|
|
@ -45,12 +45,15 @@
|
|||
"enable_aggressive_cpu_opts": true,
|
||||
|
||||
// Enable or disable ignoring missing services, this may cause instability
|
||||
"ignore_missing_services": false,
|
||||
"ignore_missing_services": false,
|
||||
|
||||
// The primary controller's type
|
||||
// Supported Values: Handheld, ProController, NpadPair, NpadLeft, NpadRight
|
||||
"controller_type": "Handheld",
|
||||
|
||||
// Enable or disable keyboard support (Independent from controllers binding)
|
||||
"enable_keyboard": true,
|
||||
|
||||
// Keyboard Controls
|
||||
// https://github.com/opentk/opentk/blob/master/src/OpenTK/Input/Key.cs
|
||||
"keyboard_controls": {
|
||||
|
|
|
@ -102,6 +102,11 @@ namespace Ryujinx
|
|||
/// </summary>
|
||||
public HidControllerType ControllerType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable keyboard support (Independent from controllers binding)
|
||||
/// </summary>
|
||||
public bool EnableKeyboard { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Keyboard control bindings
|
||||
/// </summary>
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace Ryujinx
|
|||
HidControllerButtons currentButton = 0;
|
||||
HidJoystickPosition leftJoystick;
|
||||
HidJoystickPosition rightJoystick;
|
||||
HidKeyboard hidKeyboard;
|
||||
HidKeyboard? hidKeyboard = null;
|
||||
|
||||
int leftJoystickDx = 0;
|
||||
int leftJoystickDy = 0;
|
||||
|
@ -165,12 +165,17 @@ namespace Ryujinx
|
|||
// Normal Input
|
||||
currentHotkeyButtons = Configuration.Instance.KeyboardControls.GetHotkeyButtons(keyboard);
|
||||
currentButton = Configuration.Instance.KeyboardControls.GetButtons(keyboard);
|
||||
hidKeyboard = Configuration.Instance.KeyboardControls.GetKeysDown(keyboard);
|
||||
|
||||
if (Configuration.Instance.EnableKeyboard)
|
||||
{
|
||||
hidKeyboard = Configuration.Instance.KeyboardControls.GetKeysDown(keyboard);
|
||||
}
|
||||
|
||||
(leftJoystickDx, leftJoystickDy) = Configuration.Instance.KeyboardControls.GetLeftStick(keyboard);
|
||||
(rightJoystickDx, rightJoystickDy) = Configuration.Instance.KeyboardControls.GetRightStick(keyboard);
|
||||
}
|
||||
else
|
||||
|
||||
if (!hidKeyboard.HasValue)
|
||||
{
|
||||
hidKeyboard = new HidKeyboard
|
||||
{
|
||||
|
@ -265,7 +270,10 @@ namespace Ryujinx
|
|||
_device.Hid.SetTouchPoints();
|
||||
}
|
||||
|
||||
_device.Hid.WriteKeyboard(hidKeyboard);
|
||||
if (Configuration.Instance.EnableKeyboard && hidKeyboard.HasValue)
|
||||
{
|
||||
_device.Hid.WriteKeyboard(hidKeyboard.Value);
|
||||
}
|
||||
|
||||
HidControllerBase controller = _device.Hid.PrimaryController;
|
||||
|
||||
|
|
|
@ -279,12 +279,14 @@ namespace Ryujinx.UI.Input
|
|||
foreach (KeyMapping keyMapping in KEY_MAPPING)
|
||||
{
|
||||
int value = keyboard[keyMapping.TargetKey] ? 1 : 0;
|
||||
|
||||
hidKeyboard.Keys[keyMapping.Target / 0x20] |= (value << (keyMapping.Target % 0x20));
|
||||
}
|
||||
|
||||
foreach (KeyMapping keyMapping in KEY_MODIFIER_MAPPING)
|
||||
{
|
||||
int value = keyboard[keyMapping.TargetKey] ? 1 : 0;
|
||||
|
||||
hidKeyboard.Modifier |= value << keyMapping.Target;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
"enable_fs_integrity_checks",
|
||||
"enable_aggressive_cpu_opts",
|
||||
"controller_type",
|
||||
"enable_keyboard",
|
||||
"keyboard_controls",
|
||||
"gamepad_controls"
|
||||
],
|
||||
|
@ -442,6 +443,17 @@
|
|||
"NpadRight"
|
||||
]
|
||||
},
|
||||
"enable_keyboard": {
|
||||
"$id": "#/properties/enable_keyboard",
|
||||
"type": "boolean",
|
||||
"title": "Keyboard Enable",
|
||||
"description": "Enables or disables keyboard support",
|
||||
"default": true,
|
||||
"examples": [
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"keyboard_controls": {
|
||||
"$id": "#/properties/keyboard_controls",
|
||||
"type": "object",
|
||||
|
|
Loading…
Add table
Reference in a new issue