From 49eadbc209fa27271eb6110b85776fdfd54a445c Mon Sep 17 00:00:00 2001 From: mageven <62494521+mageven@users.noreply.github.com> Date: Mon, 17 Oct 2022 00:04:42 +0530 Subject: [PATCH] Fix phantom configured Controllers (#3720) Enable guest controller only when a valid host controller is mapped. --- Ryujinx.Input/HLE/NpadManager.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Input/HLE/NpadManager.cs b/Ryujinx.Input/HLE/NpadManager.cs index b2269d5c..34e05687 100644 --- a/Ryujinx.Input/HLE/NpadManager.cs +++ b/Ryujinx.Input/HLE/NpadManager.cs @@ -51,7 +51,16 @@ namespace Ryujinx.Input.HLE { lock (_lock) { - _device.Hid.RefreshInputConfig(_inputConfig); + List validInputs = new List(); + 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; } + List validInputs = new List(); + foreach (InputConfig inputConfigEntry in inputConfig) { NpadController controller = new NpadController(_cemuHookClient); @@ -116,6 +127,7 @@ namespace Ryujinx.Input.HLE else { _controllers[(int)inputConfigEntry.PlayerIndex] = controller; + validInputs.Add(inputConfigEntry); } } @@ -123,7 +135,7 @@ namespace Ryujinx.Input.HLE _enableKeyboard = enableKeyboard; _enableMouse = enableMouse; - _device.Hid.RefreshInputConfig(inputConfig); + _device.Hid.RefreshInputConfig(validInputs); } }