0
0
Fork 0

Fix phantom configured Controllers (#3720)

Enable guest controller only when a valid host controller is mapped.
This commit is contained in:
mageven 2022-10-17 00:04:42 +05:30 committed by GitHub
parent 2df16ded9b
commit 49eadbc209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,7 +51,16 @@ namespace Ryujinx.Input.HLE
{ {
lock (_lock) lock (_lock)
{ {
_device.Hid.RefreshInputConfig(_inputConfig); List<InputConfig> validInputs = new List<InputConfig>();
foreach (var inputConfigEntry in _inputConfig)
{
if (_controllers[(int)inputConfigEntry.PlayerIndex] != null)
{
validInputs.Add(inputConfigEntry);
}
}
_device.Hid.RefreshInputConfig(validInputs);
} }
} }
@ -103,6 +112,8 @@ namespace Ryujinx.Input.HLE
_controllers[i] = null; _controllers[i] = null;
} }
List<InputConfig> validInputs = new List<InputConfig>();
foreach (InputConfig inputConfigEntry in inputConfig) foreach (InputConfig inputConfigEntry in inputConfig)
{ {
NpadController controller = new NpadController(_cemuHookClient); NpadController controller = new NpadController(_cemuHookClient);
@ -116,6 +127,7 @@ namespace Ryujinx.Input.HLE
else else
{ {
_controllers[(int)inputConfigEntry.PlayerIndex] = controller; _controllers[(int)inputConfigEntry.PlayerIndex] = controller;
validInputs.Add(inputConfigEntry);
} }
} }
@ -123,7 +135,7 @@ namespace Ryujinx.Input.HLE
_enableKeyboard = enableKeyboard; _enableKeyboard = enableKeyboard;
_enableMouse = enableMouse; _enableMouse = enableMouse;
_device.Hid.RefreshInputConfig(inputConfig); _device.Hid.RefreshInputConfig(validInputs);
} }
} }