aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-04-21 01:47:49 +0200
committerGitHub <noreply@github.com>2021-04-21 01:47:49 +0200
commitc1cbdd45dc38c58f1208696018b4612b236f38dc (patch)
tree88b798111fb3f347b6733e571da059bb09edae12
parent4770cfa920b606b1496ca9348c3dd69b476dbbbf (diff)
Miria: Do not try to query keyboard input when controller isn't set (#2231)
This fix a possible crash with raw keyboard input since Miria. I took the liberty to move the the keyboard update to avoid possible duplicate update if we end up having two keyboards in use.
-rw-r--r--Ryujinx.Input/HLE/NpadManager.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/Ryujinx.Input/HLE/NpadManager.cs b/Ryujinx.Input/HLE/NpadManager.cs
index fdb87f9b..033a7ac5 100644
--- a/Ryujinx.Input/HLE/NpadManager.cs
+++ b/Ryujinx.Input/HLE/NpadManager.cs
@@ -140,6 +140,8 @@ namespace Ryujinx.Input.HLE
List<GamepadInput> hleInputStates = new List<GamepadInput>();
List<SixAxisInput> hleMotionStates = new List<SixAxisInput>(NpadDevices.MaxControllers);
+ KeyboardInput? hleKeyboardInput = null;
+
foreach (InputConfig inputConfig in _inputConfig)
{
GamepadInput inputState = default;
@@ -160,6 +162,11 @@ namespace Ryujinx.Input.HLE
inputState.Buttons |= hleHid.UpdateStickButtons(inputState.LStick, inputState.RStick);
motionState = controller.GetHLEMotionState();
+
+ if (ConfigurationState.Instance.Hid.EnableKeyboard)
+ {
+ hleKeyboardInput = controller.GetHLEKeyboardInput();
+ }
}
else
{
@@ -172,20 +179,16 @@ namespace Ryujinx.Input.HLE
hleInputStates.Add(inputState);
hleMotionStates.Add(motionState);
-
- if (ConfigurationState.Instance.Hid.EnableKeyboard)
- {
- KeyboardInput? hleKeyboardInput = controller.GetHLEKeyboardInput();
-
- if (hleKeyboardInput.HasValue)
- {
- hleHid.Keyboard.Update(hleKeyboardInput.Value);
- }
- }
}
hleHid.Npads.Update(hleInputStates);
hleHid.Npads.UpdateSixAxis(hleMotionStates);
+
+ if (hleKeyboardInput.HasValue)
+ {
+ hleHid.Keyboard.Update(hleKeyboardInput.Value);
+ }
+
tamperMachine.UpdateInput(hleInputStates);
}
}