RyuKen/src/Ryujinx.Input
riperiperi 90455a05e6
Input: Improve controller identification (#6029)
* Input: Improve controller identification

Controllers were identified before by a combination of their _global_ index in the list of controllers and their GUID. The problem is, disconnecting and reconnecting a controller can change its global index; the controller can appear at the end. This would give it another ID, and the controller would need to be reconfigured.

This happened to me a lot with a switch pro controller and a USB game controller, it was essentially random which appeared first. Now, it consistently detects them.

This PR changes the controller identification to be a combination of an index of controllers with the same GUID (generally 0), and its GUID. It also reworks managing the list of controllers to properly consider instance IDs.

This also changes the NpadManager to attempt to reuse old controllers when refreshing input configuration, which can prevent input from going dead for seconds whenever a controller connects or disconnects (and the switch pro controller just entirely dying).

Testing with different controller types, OS and Avalonia is welcome. Remember that the target is connecting a ton of controllers, and pulling/reconnecting them.

* Remove double empty line
2024-01-22 17:02:44 -03:00
..
Assigner Revert "Ava UI: Input Menu Refactor (#4998)" 2023-10-21 15:19:21 +02:00
HLE Input: Improve controller identification (#6029) 2024-01-22 17:02:44 -03:00
Motion editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
GamepadButtonInputId.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
GamepadFeaturesFlag.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
GamepadStateSnapshot.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
IGamepad.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
IGamepadDriver.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
IKeyboard.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
IMouse.cs [Ryujinx.Input] Address dotnet-format issues (#5384) 2023-06-28 18:23:00 +02:00
Key.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
KeyboardStateSnapshot.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
MotionInputId.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00
MouseButton.cs [Ryujinx.Input] Address dotnet-format issues (#5384) 2023-06-28 18:23:00 +02:00
MouseStateSnapshot.cs [Ryujinx.Input] Address dotnet-format issues (#5384) 2023-06-28 18:23:00 +02:00
Ryujinx.Input.csproj Migrate to .NET 8 (#5887) 2023-11-15 17:41:31 +01:00
StickInputId.cs editorconfig: Set default encoding to UTF-8 (#5793) 2023-12-04 14:17:13 +01:00