From 3eb081561d5ae39018d1d78c26d330ba05255996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 10 Oct 2024 09:42:56 +0800 Subject: [PATCH] Gamepad: report joystick too --- src/detection/gamepad/gamepad_bsd.c | 5 +++-- src/detection/gamepad/gamepad_windows.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/detection/gamepad/gamepad_bsd.c b/src/detection/gamepad/gamepad_bsd.c index 340ff1165..5bcc100b8 100644 --- a/src/detection/gamepad/gamepad_bsd.c +++ b/src/detection/gamepad/gamepad_bsd.c @@ -31,8 +31,9 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) if (HID_PAGE(hItem.usage) != 1) continue; switch (HID_USAGE(hItem.usage)) { - case 1: // FreeBSD returns 1 for my Pro Controller for some reason - case 5: + case 1: // Pointer. FreeBSD returns 1 for my Pro Controller for some reason + case 4: // Joystick + case 5: // Gamepad break; default: continue; diff --git a/src/detection/gamepad/gamepad_windows.c b/src/detection/gamepad/gamepad_windows.c index e6e1be3f0..f9652a0e6 100644 --- a/src/detection/gamepad/gamepad_windows.c +++ b/src/detection/gamepad/gamepad_windows.c @@ -87,7 +87,7 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) if (GetRawInputDeviceInfoW(hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) == (UINT) -1) continue; - if (rdi.hid.usUsagePage != 1 || rdi.hid.usUsage != 5) // Gamepad + if (rdi.hid.usUsagePage != 1 || (rdi.hid.usUsage != 4/*Joystick*/ && rdi.hid.usUsage != 5/*Gamepad*/)) continue; WCHAR devName[MAX_PATH] = L"";