Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions dlls/winebus.sys/bus_udev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
{
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion dlls/winebus.sys/unix_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
29 changes: 28 additions & 1 deletion dlls/winebus.sys/unixlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions include/msvcrt/corecrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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__)
Expand All @@ -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 <stdarg.h>
Expand Down
23 changes: 14 additions & 9 deletions include/windef.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extern "C" {
# endif
#endif

#if !defined(_MSC_VER) && !defined(__MINGW32__)
#ifndef _MSC_VER
# undef __stdcall
# ifdef __i386__
# ifdef __GNUC__
Expand All @@ -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__)
Expand All @@ -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__)
Expand Down