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:
MaxLastBreath 2024-04-25 23:20:04 +03:00
commit 7e118bc07a
2 changed files with 23 additions and 25 deletions

View file

@ -487,10 +487,10 @@ namespace Ryujinx.Input.HLE
return value; 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(); KeyboardStateSnapshot keyboardState = keyboard.GetKeyboardStateSnapshot();
KeyboardInput hidKeyboard = new() KeyboardInput hidKeyboard = new()
@ -514,9 +514,7 @@ namespace Ryujinx.Input.HLE
} }
return hidKeyboard; return hidKeyboard;
}
return null;
} }

View file

@ -234,7 +234,7 @@ namespace Ryujinx.Input.HLE
if (_enableKeyboard) if (_enableKeyboard)
{ {
hleKeyboardInput = controller.GetHLEKeyboardInput(); hleKeyboardInput = controller.GetHLEKeyboardInput(_keyboardDriver);
} }
} }
else else