[SDL3] Adding input and FFB support for Logitech G29(PS3) on hidapi (#11598)

These changes enable the Logitech G29 wheel to run on hidapi with both SDL_Joystick and SDL_Haptic interfaces.

While it is already possible to use the wheel on Linux in WINE + SDL2 thanks to the in-tree evdev driver as well as new-lg4ff, these set of changes allow the G29 to be used with WINE under MacOS and FreeBSD

These wheels should also be supported, but I can only test them from G29's compat modes: G27, G25, DFGT, DFP, DFEX

Haptic and led support are ported from https://github.com/berarma/new-lg4ff
This commit is contained in:
Katharine Chui
2025-03-17 22:24:39 +08:00
committed by GitHub
parent d66483dfcc
commit 35c03774f3
17 changed files with 2887 additions and 18 deletions

View File

@@ -2633,7 +2633,11 @@ bool SDL_IsGamepad(SDL_JoystickID instance_id)
if (SDL_FindInHashTable(s_gamepadInstanceIDs, (void *)(uintptr_t)instance_id, &value)) {
result = (bool)(uintptr_t)value;
} else {
if (SDL_PrivateGetGamepadMapping(instance_id, true) != NULL) {
SDL_JoystickType js_type = SDL_GetJoystickTypeForID(instance_id);
if (js_type != SDL_JOYSTICK_TYPE_GAMEPAD && js_type != SDL_JOYSTICK_TYPE_UNKNOWN) {
// avoid creating HIDAPI mapping if SDL_Joystick knows it is not a game pad
result = false;
} else if (SDL_PrivateGetGamepadMapping(instance_id, true) != NULL) {
result = true;
} else {
result = false;