From 836e61b7c3bfc0724b40c9d79ed75b8e84cf6209 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 25 Jul 2021 18:54:39 -0500 Subject: [PATCH] Remove gamepad from host when removed from client --- src/input/evdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/input/evdev.c b/src/input/evdev.c index 9f8c444..a0fd6e6 100644 --- a/src/input/evdev.c +++ b/src/input/evdev.c @@ -142,10 +142,12 @@ static bool evdev_init_parms(struct input_device *dev, struct input_abs_parms *p static void evdev_remove(int devindex) { numDevices--; - printf("Input device removed: %s (player %d)\n", libevdev_get_name(devices[devindex].dev), devices[devindex].controllerId); + printf("Input device removed: %s (player %d)\n", libevdev_get_name(devices[devindex].dev), devices[devindex].controllerId + 1); - if (devices[devindex].controllerId >= 0) + if (devices[devindex].controllerId >= 0) { assignedControllerIds &= ~(1 << devices[devindex].controllerId); + LiSendMultiControllerEvent(devices[devindex].controllerId, assignedControllerIds, 0, 0, 0, 0, 0, 0, 0); + } if (devindex != numDevices && numDevices > 0) memcpy(&devices[devindex], &devices[numDevices], sizeof(struct input_device));