diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index d3c4b7059682..5da979c6c5a5 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -1622,6 +1622,7 @@ static void udev_add_device(struct udev_device *dev, int fd) const char *subsystem; const char *devnode; int bus = 0; + int axes = -1, buttons = -1; if (!(devnode = udev_device_get_devnode(dev))) { @@ -1644,6 +1645,9 @@ static void udev_add_device(struct udev_device *dev, int fd) close(fd); return; } + + axes = count_abs_axis(fd); + buttons = count_buttons(fd, NULL); #endif get_device_subsystem_info(dev, "hid", &desc, &bus); @@ -1697,7 +1701,7 @@ static void udev_add_device(struct udev_device *dev, int fd) memcpy(desc.serialnumber, zeros, sizeof(zeros)); } - if (!is_hidraw_enabled(desc.vid, desc.pid)) + if (!is_hidraw_enabled(desc.vid, desc.pid, axes, buttons)) { TRACE("hidraw %s: deferring %s to a different backend\n", debugstr_a(devnode), debugstr_device_desc(&desc)); close(fd); @@ -1712,12 +1716,7 @@ static void udev_add_device(struct udev_device *dev, int fd) } #ifdef HAS_PROPER_INPUT_HEADER else - { - int axes=0, buttons=0; - axes = count_abs_axis(fd); - buttons = count_buttons(fd, NULL); desc.is_gamepad = (axes == 6 && buttons >= 14); - } #endif TRACE("dev %p, node %s, desc %s.\n", dev, debugstr_a(devnode), debugstr_device_desc(&desc)); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 87c3d4ad626e..4e2b943e9790 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -271,6 +271,6 @@ BOOL is_wine_blacklisted(WORD vid, WORD pid) DECLSPEC_HIDDEN; BOOL is_dualshock4_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN; BOOL is_dualsense_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN; BOOL is_logitech_g920(WORD vid, WORD pid) DECLSPEC_HIDDEN; -BOOL is_hidraw_enabled(WORD vid, WORD pid) DECLSPEC_HIDDEN; +BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) DECLSPEC_HIDDEN; #endif /* __WINEBUS_UNIX_PRIVATE_H */ diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index d4adc78f6ec1..1e08f4a1eadf 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -105,7 +105,32 @@ static BOOL is_fanatec_pedals(WORD vid, WORD pid) return FALSE; } -BOOL is_hidraw_enabled(WORD vid, WORD pid) +static BOOL is_vkb_controller(WORD vid, WORD pid, INT buttons) +{ + if (vid != 0x231D) return FALSE; + + /* comes with 128 buttons in the default configuration */ + if (buttons == 128) return TRUE; + + /* if customized, less than 128 buttons may be shown, decide by PID */ + if (pid == 0x0200) return TRUE; /* VKBsim Gladiator EVO Right Grip */ + if (pid == 0x0201) return TRUE; /* VKBsim Gladiator EVO Left Grip */ + return FALSE; +} + +static BOOL is_virpil_controller(WORD vid, WORD pid, INT buttons) +{ + if (vid != 0x3344) return FALSE; + + /* comes with 31 buttons in the default configuration, or 128 max */ + if ((buttons == 31) || (buttons == 128)) return TRUE; + + /* if customized, arbitrary amount of buttons may be shown, decide by PID */ + if (pid == 0x412f) return TRUE; /* Virpil Constellation ALPHA-R */ + return FALSE; +} + +BOOL is_hidraw_enabled(WORD vid, WORD pid, INT axes, INT buttons) { const char *enabled = getenv("PROTON_ENABLE_HIDRAW"); char needle[16]; @@ -115,6 +140,8 @@ BOOL is_hidraw_enabled(WORD vid, WORD pid) if (is_thrustmaster_hotas(vid, pid)) return TRUE; if (is_simucube_wheel(vid, pid)) return TRUE; if (is_fanatec_pedals(vid, pid)) return TRUE; + if (is_vkb_controller(vid, pid, buttons)) return TRUE; + if (is_virpil_controller(vid, pid, buttons)) return TRUE; sprintf(needle, "0x%04x/0x%04x", vid, pid); if (enabled) return strcasestr(enabled, needle) != NULL; diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 4ddea3edb1e3..aba9bc9422e7 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -82,7 +82,7 @@ #define __has_attribute(x) 0 #endif -#if !defined(_MSC_VER) && !defined(__MINGW32__) +#ifndef _MSC_VER # undef __stdcall # ifdef __i386__ # ifdef __GNUC__ @@ -100,13 +100,16 @@ # else # define __stdcall __attribute__((ms_abi)) # endif -# elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__CYGWIN__) +# elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__) # define __stdcall __attribute__((pcs("aapcs-vfp"))) # elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi) # define __stdcall __attribute__((ms_abi)) # else /* __i386__ */ # define __stdcall # endif /* __i386__ */ +#endif /* __stdcall */ + +#ifndef _MSC_VER # undef __cdecl # if defined(__i386__) && defined(__GNUC__) # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__) @@ -117,7 +120,7 @@ # else # define __cdecl __stdcall # endif -#endif /* _MSC_VER || __MINGW32__ */ +#endif #if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__) # include diff --git a/include/windef.h b/include/windef.h index 827e9f92a268..cb7eb1179c88 100644 --- a/include/windef.h +++ b/include/windef.h @@ -54,7 +54,7 @@ extern "C" { # endif #endif -#if !defined(_MSC_VER) && !defined(__MINGW32__) +#ifndef _MSC_VER # undef __stdcall # ifdef __i386__ # ifdef __GNUC__ @@ -72,13 +72,16 @@ extern "C" { # else # define __stdcall __attribute__((ms_abi)) # endif -# elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__CYGWIN__) +# elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__) # define __stdcall __attribute__((pcs("aapcs-vfp"))) # elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi) # define __stdcall __attribute__((ms_abi)) # else /* __i386__ */ # define __stdcall # endif /* __i386__ */ +#endif /* __stdcall */ + +#ifndef _MSC_VER # undef __cdecl # if defined(__i386__) && defined(__GNUC__) # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__) @@ -89,13 +92,15 @@ extern "C" { # else # define __cdecl __stdcall # endif -# ifndef __fastcall -# define __fastcall __stdcall -# endif -# ifndef __thiscall -# define __thiscall __stdcall -# endif -#endif /* _MSC_VER || __MINGW32__ */ +#endif + +#if !defined(_MSC_VER) && !defined(__fastcall) +# define __fastcall __stdcall +#endif + +#if (!defined(_MSC_VER) || !defined(__clang__)) && !defined(__thiscall) +# define __thiscall __stdcall +#endif #ifndef __ms_va_list # if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__)