winebus.sys: Move is_xbox_gamepad to unixlib.c.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-16 10:17:54 +02:00 committed by Alexandre Julliard
parent 2a2fc11d8c
commit 7032b41747
4 changed files with 21 additions and 41 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;