[PATCH v3 4/4] winebus.sys: Stop enforcing input and IG suffix on gamepads.
Rémi Bernon
rbernon at codeweavers.com
Mon Aug 30 04:06:17 CDT 2021
The &IG_00 suffix is now automatically added by winexinput.sys.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/winebus.sys/bus_iohid.c | 5 +----
dlls/winebus.sys/bus_sdl.c | 5 +----
dlls/winebus.sys/bus_udev.c | 2 --
dlls/winebus.sys/main.c | 18 ++++--------------
4 files changed, 6 insertions(+), 24 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c
index eb5eddd60fa..9b842dc81a5 100644
--- a/dlls/winebus.sys/bus_iohid.c
+++ b/dlls/winebus.sys/bus_iohid.c
@@ -299,7 +299,6 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
CFStringRef str = NULL;
WCHAR serial_string[256];
BOOL is_gamepad = FALSE;
- WORD input = -1;
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);
}
}
- if (is_gamepad)
- input = 0;
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private))))
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);
if (!device) HeapFree(GetProcessHeap(), 0, private);
else
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index 61d1240e05d..8259531779b 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -744,7 +744,6 @@ static void try_add_device(unsigned int index)
WCHAR serial[34] = {0};
char guid_str[34];
BOOL is_xbox_gamepad;
- WORD input = -1;
SDL_Joystick* joystick;
SDL_JoystickID id;
@@ -795,12 +794,10 @@ static void try_add_device(unsigned int index)
button_count = pSDL_JoystickNumButtons(joystick);
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;
- 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);
if (!device) HeapFree(GetProcessHeap(), 0, private);
else
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index bd70a66f2cd..8d631fb928e 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -1131,8 +1131,6 @@ static void try_add_device(struct udev_device *dev)
is_gamepad = (axes == 6 && buttons >= 14);
}
#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",
debugstr_a(devnode), vid, pid, version, input, debugstr_w(serial));
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index e58bf873eac..28bbb5ff7a9 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -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 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)
{
@@ -202,25 +200,17 @@ static WCHAR *get_instance_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',
'&','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;
DWORD len = strlenW(ext->busid) + 34;
- WCHAR *dst;
+ WCHAR *dst, *tmp;
if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR))))
{
- if (ext->input == (WORD)-1)
- {
- 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);
- }
+ tmp = dst + sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
+ if (ext->input != (WORD)-1) sprintfW(tmp, input_formatW, ext->input);
}
return dst;
--
2.33.0
More information about the wine-devel
mailing list