[PATCH 3/7] winebus.sys: Move is_xbox_gamepad to unixlib.c.
Rémi Bernon
rbernon at codeweavers.com
Thu Sep 16 03:17:54 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/winebus.sys/bus.h | 3 ---
dlls/winebus.sys/main.c | 38 ---------------------------------
dlls/winebus.sys/unix_private.h | 2 ++
dlls/winebus.sys/unixlib.c | 19 +++++++++++++++++
4 files changed, 21 insertions(+), 41 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h
index df53508d2c0..96503a8267f 100644
--- a/dlls/winebus.sys/bus.h
+++ b/dlls/winebus.sys/bus.h
@@ -27,7 +27,4 @@
#include "unixlib.h"
-/* General Bus Functions */
-BOOL is_xbox_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN;
-
extern HANDLE driver_key DECLSPEC_HIDDEN;
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index a80bd8a186e..f1b0430509a 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -57,31 +57,6 @@ __ASM_STDCALL_FUNC( wrap_fastcall_func1, 8,
#endif
-struct product_desc
-{
- WORD vid;
- WORD pid;
-};
-
-#define VID_MICROSOFT 0x045e
-
-static const struct product_desc XBOX_CONTROLLERS[] =
-{
- {VID_MICROSOFT, 0x0202}, /* Xbox Controller */
- {VID_MICROSOFT, 0x0285}, /* Xbox Controller S */
- {VID_MICROSOFT, 0x0289}, /* Xbox Controller S */
- {VID_MICROSOFT, 0x028e}, /* Xbox360 Controller */
- {VID_MICROSOFT, 0x028f}, /* Xbox360 Wireless Controller */
- {VID_MICROSOFT, 0x02d1}, /* Xbox One Controller */
- {VID_MICROSOFT, 0x02dd}, /* Xbox One Controller (Covert Forces/Firmware 2015) */
- {VID_MICROSOFT, 0x02e0}, /* Xbox One X Controller */
- {VID_MICROSOFT, 0x02e3}, /* Xbox One Elite Controller */
- {VID_MICROSOFT, 0x02e6}, /* Wireless XBox Controller Dongle */
- {VID_MICROSOFT, 0x02ea}, /* Xbox One S Controller */
- {VID_MICROSOFT, 0x02fd}, /* Xbox One S Controller (Firmware 2017) */
- {VID_MICROSOFT, 0x0719}, /* Xbox 360 Wireless Adapter */
-};
-
static DRIVER_OBJECT *driver_obj;
static DEVICE_OBJECT *mouse_obj;
@@ -1021,19 +996,6 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
return status;
}
-BOOL is_xbox_gamepad(WORD vid, WORD pid)
-{
- int i;
-
- if (vid != VID_MICROSOFT)
- return FALSE;
-
- for (i = 0; i < ARRAY_SIZE(XBOX_CONTROLLERS); i++)
- if (pid == XBOX_CONTROLLERS[i].pid) return TRUE;
-
- return FALSE;
-}
-
static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *pdo)
{
NTSTATUS ret;
diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h
index f2af846473a..cdc2be9b318 100644
--- a/dlls/winebus.sys/unix_private.h
+++ b/dlls/winebus.sys/unix_private.h
@@ -89,4 +89,6 @@ extern BOOL hid_descriptor_add_axes(struct hid_descriptor *desc, BYTE count, USA
extern BOOL hid_descriptor_add_haptics(struct hid_descriptor *desc) DECLSPEC_HIDDEN;
+BOOL is_xbox_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN;
+
#endif /* __WINEBUS_UNIX_PRIVATE_H */
diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c
index b6fcdf18ffe..57e81d3cba8 100644
--- a/dlls/winebus.sys/unixlib.c
+++ b/dlls/winebus.sys/unixlib.c
@@ -34,6 +34,25 @@
WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
+BOOL is_xbox_gamepad(WORD vid, WORD pid)
+{
+ if (vid != 0x045e) return FALSE;
+ if (pid == 0x0202) return TRUE; /* Xbox Controller */
+ if (pid == 0x0285) return TRUE; /* Xbox Controller S */
+ if (pid == 0x0289) return TRUE; /* Xbox Controller S */
+ if (pid == 0x028e) return TRUE; /* Xbox360 Controller */
+ if (pid == 0x028f) return TRUE; /* Xbox360 Wireless Controller */
+ if (pid == 0x02d1) return TRUE; /* Xbox One Controller */
+ if (pid == 0x02dd) return TRUE; /* Xbox One Controller (Covert Forces/Firmware 2015) */
+ if (pid == 0x02e0) return TRUE; /* Xbox One X Controller */
+ if (pid == 0x02e3) return TRUE; /* Xbox One Elite Controller */
+ if (pid == 0x02e6) return TRUE; /* Wireless XBox Controller Dongle */
+ if (pid == 0x02ea) return TRUE; /* Xbox One S Controller */
+ if (pid == 0x02fd) return TRUE; /* Xbox One S Controller (Firmware 2017) */
+ if (pid == 0x0719) return TRUE; /* Xbox 360 Wireless Adapter */
+ return FALSE;
+}
+
struct mouse_device
{
struct unix_device unix_device;
--
2.33.0
More information about the wine-devel
mailing list