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.
This commit is contained in:
parent
4770cfa920
commit
c1cbdd45dc
1 changed files with 13 additions and 10 deletions
|
@ -140,6 +140,8 @@ namespace Ryujinx.Input.HLE
|
||||||
List<GamepadInput> hleInputStates = new List<GamepadInput>();
|
List<GamepadInput> hleInputStates = new List<GamepadInput>();
|
||||||
List<SixAxisInput> hleMotionStates = new List<SixAxisInput>(NpadDevices.MaxControllers);
|
List<SixAxisInput> hleMotionStates = new List<SixAxisInput>(NpadDevices.MaxControllers);
|
||||||
|
|
||||||
|
KeyboardInput? hleKeyboardInput = null;
|
||||||
|
|
||||||
foreach (InputConfig inputConfig in _inputConfig)
|
foreach (InputConfig inputConfig in _inputConfig)
|
||||||
{
|
{
|
||||||
GamepadInput inputState = default;
|
GamepadInput inputState = default;
|
||||||
|
@ -160,6 +162,11 @@ namespace Ryujinx.Input.HLE
|
||||||
inputState.Buttons |= hleHid.UpdateStickButtons(inputState.LStick, inputState.RStick);
|
inputState.Buttons |= hleHid.UpdateStickButtons(inputState.LStick, inputState.RStick);
|
||||||
|
|
||||||
motionState = controller.GetHLEMotionState();
|
motionState = controller.GetHLEMotionState();
|
||||||
|
|
||||||
|
if (ConfigurationState.Instance.Hid.EnableKeyboard)
|
||||||
|
{
|
||||||
|
hleKeyboardInput = controller.GetHLEKeyboardInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -172,20 +179,16 @@ namespace Ryujinx.Input.HLE
|
||||||
|
|
||||||
hleInputStates.Add(inputState);
|
hleInputStates.Add(inputState);
|
||||||
hleMotionStates.Add(motionState);
|
hleMotionStates.Add(motionState);
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigurationState.Instance.Hid.EnableKeyboard)
|
hleHid.Npads.Update(hleInputStates);
|
||||||
{
|
hleHid.Npads.UpdateSixAxis(hleMotionStates);
|
||||||
KeyboardInput? hleKeyboardInput = controller.GetHLEKeyboardInput();
|
|
||||||
|
|
||||||
if (hleKeyboardInput.HasValue)
|
if (hleKeyboardInput.HasValue)
|
||||||
{
|
{
|
||||||
hleHid.Keyboard.Update(hleKeyboardInput.Value);
|
hleHid.Keyboard.Update(hleKeyboardInput.Value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hleHid.Npads.Update(hleInputStates);
|
|
||||||
hleHid.Npads.UpdateSixAxis(hleMotionStates);
|
|
||||||
tamperMachine.UpdateInput(hleInputStates);
|
tamperMachine.UpdateInput(hleInputStates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue