From 7d0b6c2bda51501564940e3aaad29d1bb86d7828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9viste?= Date: Sat, 31 Aug 2024 10:36:38 +0200 Subject: [PATCH] Add support for Thrustmaster Hotas X axis order --- dlls/winebus.sys/bus_sdl.c | 17 ++++++++++++++++- dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 7 ++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 1c438eafc6a..812b6b1b22f 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -255,6 +255,14 @@ static const USAGE_AND_PAGE g920_absolute_usages[] = {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_Z}, /* brake */ {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_RZ}, /* clutch */ }; +static const USAGE_AND_PAGE hotas_x_absolute_usages[] = +{ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_X}, + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_Y}, + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_Z}, /* throttle */ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_RZ}, /* yaw */ + {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_SLIDER}, /* throttle rocker */ +}; static const USAGE_AND_PAGE absolute_axis_usages[] = { {.UsagePage = HID_USAGE_PAGE_GENERIC, .Usage = HID_USAGE_GENERIC_X}, @@ -281,11 +289,18 @@ static const USAGE_AND_PAGE relative_axis_usages[] = static int get_absolute_usages(struct sdl_device *impl, const USAGE_AND_PAGE **absolute_usages) { - if (is_logitech_g920(pSDL_JoystickGetVendor(impl->sdl_joystick), pSDL_JoystickGetProduct(impl->sdl_joystick))) + int vid = pSDL_JoystickGetVendor(impl->sdl_joystick); + int pid = pSDL_JoystickGetProduct(impl->sdl_joystick); + if (is_logitech_g920(vid, pid)) { *absolute_usages = g920_absolute_usages; return ARRAY_SIZE(g920_absolute_usages); } + if (is_thrustmaster_hotas_x(vid, pid)) + { + *absolute_usages = hotas_x_absolute_usages; + return ARRAY_SIZE(hotas_x_absolute_usages); + } *absolute_usages = absolute_axis_usages; return ARRAY_SIZE(absolute_axis_usages); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index a70c5fc8a95..9411464a9aa 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -271,6 +271,7 @@ BOOL is_wine_blacklisted(WORD vid, WORD pid); BOOL is_dualshock4_gamepad(WORD vid, WORD pid); BOOL is_dualsense_gamepad(WORD vid, WORD pid); BOOL is_logitech_g920(WORD vid, WORD pid); +BOOL is_thrustmaster_hotas_x(WORD vid, WORD pid); BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons); #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index c3407e39b3f..3175d7faaa7 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -84,9 +84,14 @@ BOOL is_logitech_g920(WORD vid, WORD pid) return vid == 0x046D && pid == 0xC262; } +BOOL is_thrustmaster_hotas_x(WORD vid, WORD pid) +{ + return vid == 0x044F && pid == 0xB108; +} + static BOOL is_thrustmaster_hotas(WORD vid, WORD pid) { - return vid == 0x044F && (pid == 0xB679 || pid == 0xB687 || pid == 0xB10A); + return vid == 0x044F && (pid == 0xB679 || pid == 0xB687 || pid == 0xB10A || pid == 0xB108); } static BOOL is_simucube_wheel(WORD vid, WORD pid)