winebus.sys: Stop enforcing input and IG suffix on gamepads.

The &IG_00 suffix is now automatically added by winexinput.sys.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-01 07:47:28 +02:00 committed by Alexandre Julliard
parent 61e217c40a
commit d22ece4c58
4 changed files with 6 additions and 24 deletions

View File

@ -299,7 +299,6 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
CFStringRef str = NULL; CFStringRef str = NULL;
WCHAR serial_string[256]; WCHAR serial_string[256];
BOOL is_gamepad = FALSE; BOOL is_gamepad = FALSE;
WORD input = -1;
TRACE("OS/X IOHID Device Added %p\n", IOHIDDevice); TRACE("OS/X IOHID Device Added %p\n", IOHIDDevice);
@ -361,13 +360,11 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
is_gamepad = (axes == 6 && buttons >= 14); is_gamepad = (axes == 6 && buttons >= 14);
} }
} }
if (is_gamepad)
input = 0;
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private))))
return; return;
device = bus_create_hid_device(busidW, vid, pid, input, version, uid, str ? serial_string : NULL, device = bus_create_hid_device(busidW, vid, pid, -1, version, uid, str ? serial_string : NULL,
is_gamepad, &iohid_vtbl, &private->unix_device); is_gamepad, &iohid_vtbl, &private->unix_device);
if (!device) HeapFree(GetProcessHeap(), 0, private); if (!device) HeapFree(GetProcessHeap(), 0, private);
else else

View File

@ -744,7 +744,6 @@ static void try_add_device(unsigned int index)
WCHAR serial[34] = {0}; WCHAR serial[34] = {0};
char guid_str[34]; char guid_str[34];
BOOL is_xbox_gamepad; BOOL is_xbox_gamepad;
WORD input = -1;
SDL_Joystick* joystick; SDL_Joystick* joystick;
SDL_JoystickID id; SDL_JoystickID id;
@ -795,12 +794,10 @@ static void try_add_device(unsigned int index)
button_count = pSDL_JoystickNumButtons(joystick); button_count = pSDL_JoystickNumButtons(joystick);
is_xbox_gamepad = (axis_count == 6 && button_count >= 14); is_xbox_gamepad = (axis_count == 6 && button_count >= 14);
} }
if (is_xbox_gamepad)
input = 0;
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*private)))) return; if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*private)))) return;
device = bus_create_hid_device(sdl_busidW, vid, pid, input, version, index, serial, is_xbox_gamepad, device = bus_create_hid_device(sdl_busidW, vid, pid, -1, version, index, serial, is_xbox_gamepad,
&sdl_vtbl, &private->unix_device); &sdl_vtbl, &private->unix_device);
if (!device) HeapFree(GetProcessHeap(), 0, private); if (!device) HeapFree(GetProcessHeap(), 0, private);
else else

View File

@ -1131,8 +1131,6 @@ static void try_add_device(struct udev_device *dev)
is_gamepad = (axes == 6 && buttons >= 14); is_gamepad = (axes == 6 && buttons >= 14);
} }
#endif #endif
if (input == (WORD)-1 && is_gamepad)
input = 0;
TRACE("Found udev device %s (vid %04x, pid %04x, version %04x, input %d, serial %s)\n", TRACE("Found udev device %s (vid %04x, pid %04x, version %04x, input %d, serial %s)\n",
debugstr_a(devnode), vid, pid, version, input, debugstr_w(serial)); debugstr_a(devnode), vid, pid, version, input, debugstr_w(serial));

View File

@ -149,8 +149,6 @@ static CRITICAL_SECTION device_list_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
static struct list device_list = LIST_INIT(device_list); static struct list device_list = LIST_INIT(device_list);
static const WCHAR zero_serialW[]= {'0','0','0','0',0}; static const WCHAR zero_serialW[]= {'0','0','0','0',0};
static const WCHAR miW[] = {'M','I',0};
static const WCHAR igW[] = {'I','G',0};
static NTSTATUS winebus_call(unsigned int code, void *args) static NTSTATUS winebus_call(unsigned int code, void *args)
{ {
@ -202,25 +200,17 @@ static WCHAR *get_instance_id(DEVICE_OBJECT *device)
static WCHAR *get_device_id(DEVICE_OBJECT *device) static WCHAR *get_device_id(DEVICE_OBJECT *device)
{ {
static const WCHAR input_formatW[] = {'&','M','I','_','%','0','2','u',0};
static const WCHAR formatW[] = {'%','s','\\','v','i','d','_','%','0','4','x', static const WCHAR formatW[] = {'%','s','\\','v','i','d','_','%','0','4','x',
'&','p','i','d','_','%','0','4','x',0}; '&','p','i','d','_','%','0','4','x',0};
static const WCHAR format_inputW[] = {'%','s','\\','v','i','d','_','%','0','4','x',
'&','p','i','d','_','%','0','4','x','&','%','s','_','%','0','2','i',0};
struct device_extension *ext = (struct device_extension *)device->DeviceExtension; struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
DWORD len = strlenW(ext->busid) + 34; DWORD len = strlenW(ext->busid) + 34;
WCHAR *dst; WCHAR *dst, *tmp;
if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR)))) if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR))))
{ {
if (ext->input == (WORD)-1) tmp = dst + sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
{ if (ext->input != (WORD)-1) sprintfW(tmp, input_formatW, ext->input);
sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
}
else
{
sprintfW(dst, format_inputW, ext->busid, ext->vid, ext->pid,
ext->is_gamepad ? igW : miW, ext->input);
}
} }
return dst; return dst;