Fix direct keyboard not working when connected with a controller
- Pass KeyboardDriver to NpadController.GetHLEKeyboardInput(). - Always fetch all keyboards if Direct Keyboard is turned on. - Remove unnecessary return null.
This commit is contained in:
parent
c6f8bfed90
commit
7e118bc07a
2 changed files with 23 additions and 25 deletions
|
@ -487,36 +487,34 @@ namespace Ryujinx.Input.HLE
|
|||
return value;
|
||||
}
|
||||
|
||||
public KeyboardInput? GetHLEKeyboardInput()
|
||||
public KeyboardInput? GetHLEKeyboardInput(IGamepadDriver KeyboardDriver)
|
||||
{
|
||||
if (_gamepad is IKeyboard keyboard)
|
||||
var keyboard = KeyboardDriver.GetGamepad("0") as IKeyboard;
|
||||
|
||||
KeyboardStateSnapshot keyboardState = keyboard.GetKeyboardStateSnapshot();
|
||||
|
||||
KeyboardInput hidKeyboard = new()
|
||||
{
|
||||
KeyboardStateSnapshot keyboardState = keyboard.GetKeyboardStateSnapshot();
|
||||
Modifier = 0,
|
||||
Keys = new ulong[0x4],
|
||||
};
|
||||
|
||||
KeyboardInput hidKeyboard = new()
|
||||
{
|
||||
Modifier = 0,
|
||||
Keys = new ulong[0x4],
|
||||
};
|
||||
foreach (HLEKeyboardMappingEntry entry in _keyMapping)
|
||||
{
|
||||
ulong value = keyboardState.IsPressed(entry.TargetKey) ? 1UL : 0UL;
|
||||
|
||||
foreach (HLEKeyboardMappingEntry entry in _keyMapping)
|
||||
{
|
||||
ulong value = keyboardState.IsPressed(entry.TargetKey) ? 1UL : 0UL;
|
||||
|
||||
hidKeyboard.Keys[entry.Target / 0x40] |= (value << (entry.Target % 0x40));
|
||||
}
|
||||
|
||||
foreach (HLEKeyboardMappingEntry entry in _keyModifierMapping)
|
||||
{
|
||||
int value = keyboardState.IsPressed(entry.TargetKey) ? 1 : 0;
|
||||
|
||||
hidKeyboard.Modifier |= value << entry.Target;
|
||||
}
|
||||
|
||||
return hidKeyboard;
|
||||
hidKeyboard.Keys[entry.Target / 0x40] |= (value << (entry.Target % 0x40));
|
||||
}
|
||||
|
||||
return null;
|
||||
foreach (HLEKeyboardMappingEntry entry in _keyModifierMapping)
|
||||
{
|
||||
int value = keyboardState.IsPressed(entry.TargetKey) ? 1 : 0;
|
||||
|
||||
hidKeyboard.Modifier |= value << entry.Target;
|
||||
}
|
||||
|
||||
return hidKeyboard;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace Ryujinx.Input.HLE
|
|||
|
||||
if (_enableKeyboard)
|
||||
{
|
||||
hleKeyboardInput = controller.GetHLEKeyboardInput();
|
||||
hleKeyboardInput = controller.GetHLEKeyboardInput(_keyboardDriver);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue