Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/dinput/dinput_private.h | 1 + dlls/dinput/joystick.c | 6 ++++++ dlls/dinput/joystick_linux.c | 6 +----- dlls/dinput/joystick_linuxinput.c | 6 +----- dlls/dinput/joystick_osx.c | 12 ++---------- 5 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index acda6c8..c97a493 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -81,6 +81,7 @@ extern void _copy_diactionformatWtoA(LPDIACTIONFORMATA, LPDIACTIONFORMATW) DECLS extern HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) DECLSPEC_HIDDEN;
extern WCHAR* get_mapping_path(const WCHAR *device, const WCHAR *username) DECLSPEC_HIDDEN; +extern DWORD get_device_type(DWORD version) DECLSPEC_HIDDEN;
#define IS_DIPROP(x) (((ULONG_PTR)(x) >> 16) == 0)
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 0ec1ceb..9240ba3 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -76,6 +76,12 @@ DWORD typeFromGUID(REFGUID guid) } }
+DWORD get_device_type(DWORD version) +{ + return version >= 0x0800 ? DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8) : + DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8); +} + static void _dump_DIEFFECT_flags(DWORD dwFlags) { if (TRACE_ON(dinput)) { diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index f93fc2f..fb1b878 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -322,11 +322,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver lpddi->guidInstance = DInput_Wine_Joystick_GUID; lpddi->guidInstance.Data3 = id; lpddi->guidProduct = joystick_devices[id].guid_product; - /* we only support traditional joysticks for now */ - if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8); + lpddi->dwDevType = get_device_type(version);
/* Assume the joystick as HID if it is attached to USB bus and has a valid VID/PID */ if (joystick_devices[id].bus_type == BUS_USB && diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index cea669b..c93d255 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -353,11 +353,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver lpddi->guidInstance = joydevs[id].guid; lpddi->guidProduct = joydevs[id].guid_product; lpddi->guidFFDriver = GUID_NULL; - - if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8); + lpddi->dwDevType = get_device_type(version);
/* Assume the joystick as HID if it is attached to USB bus and has a valid VID/PID */ if (joydevs[id].bus_type == BUS_USB && diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index daef1a1..cb88b2f 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -967,11 +967,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS lpddi->guidInstance.Data3 = id; lpddi->guidProduct = DInput_Wine_OsX_Joystick_GUID; lpddi->guidProduct.Data1 = make_vid_pid(device); - /* we only support traditional joysticks for now */ - if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8); + lpddi->dwDevType = get_device_type(version); lpddi->dwDevType |= DIDEVTYPE_HID; lpddi->wUsagePage = 0x01; /* Desktop */ lpddi->wUsage = 0x05; /* Game Pad */ @@ -1014,11 +1010,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS lpddi->guidInstance.Data3 = id; lpddi->guidProduct = DInput_Wine_OsX_Joystick_GUID; lpddi->guidProduct.Data1 = make_vid_pid(device); - /* we only support traditional joysticks for now */ - if (version >= 0x0800) - lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + lpddi->dwDevType = get_device_type(version); sprintf(friendly, "Joystick %d", id); MultiByteToWideChar(CP_ACP, 0, friendly, -1, lpddi->tszInstanceName, MAX_PATH); /* get the device name */
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Mon, May 06, 2019 at 01:58:55AM +0000, Alistair Leslie-Hughes wrote:
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/dinput/dinput_private.h | 1 + dlls/dinput/joystick.c | 6 ++++++ dlls/dinput/joystick_linux.c | 6 +----- dlls/dinput/joystick_linuxinput.c | 6 +----- dlls/dinput/joystick_osx.c | 12 ++---------- 5 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index acda6c8..c97a493 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -81,6 +81,7 @@ extern void _copy_diactionformatWtoA(LPDIACTIONFORMATA, LPDIACTIONFORMATW) DECLS extern HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) DECLSPEC_HIDDEN;
extern WCHAR* get_mapping_path(const WCHAR *device, const WCHAR *username) DECLSPEC_HIDDEN; +extern DWORD get_device_type(DWORD version) DECLSPEC_HIDDEN;
#define IS_DIPROP(x) (((ULONG_PTR)(x) >> 16) == 0)
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 0ec1ceb..9240ba3 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -76,6 +76,12 @@ DWORD typeFromGUID(REFGUID guid) } }
+DWORD get_device_type(DWORD version) +{
- return version >= 0x0800 ? DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8) :
DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8);
+}
static void _dump_DIEFFECT_flags(DWORD dwFlags) { if (TRACE_ON(dinput)) { diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index f93fc2f..fb1b878 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -322,11 +322,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver lpddi->guidInstance = DInput_Wine_Joystick_GUID; lpddi->guidInstance.Data3 = id; lpddi->guidProduct = joystick_devices[id].guid_product;
- /* we only support traditional joysticks for now */
- if (version >= 0x0800)
lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
- else
lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8);
lpddi->dwDevType = get_device_type(version);
/* Assume the joystick as HID if it is attached to USB bus and has a valid VID/PID */ if (joystick_devices[id].bus_type == BUS_USB &&
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index cea669b..c93d255 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -353,11 +353,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver lpddi->guidInstance = joydevs[id].guid; lpddi->guidProduct = joydevs[id].guid_product; lpddi->guidFFDriver = GUID_NULL;
- if (version >= 0x0800)
lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
- else
lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8);
lpddi->dwDevType = get_device_type(version);
/* Assume the joystick as HID if it is attached to USB bus and has a valid VID/PID */ if (joydevs[id].bus_type == BUS_USB &&
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index daef1a1..cb88b2f 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -967,11 +967,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS lpddi->guidInstance.Data3 = id; lpddi->guidProduct = DInput_Wine_OsX_Joystick_GUID; lpddi->guidProduct.Data1 = make_vid_pid(device);
/* we only support traditional joysticks for now */
if (version >= 0x0800)
lpddi->dwDevType = DI8DEVTYPE_GAMEPAD | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
else
lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_GAMEPAD << 8);
lpddi->dwDevType = get_device_type(version); lpddi->dwDevType |= DIDEVTYPE_HID; lpddi->wUsagePage = 0x01; /* Desktop */ lpddi->wUsage = 0x05; /* Game Pad */
@@ -1014,11 +1010,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS lpddi->guidInstance.Data3 = id; lpddi->guidProduct = DInput_Wine_OsX_Joystick_GUID; lpddi->guidProduct.Data1 = make_vid_pid(device);
/* we only support traditional joysticks for now */
if (version >= 0x0800)
lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8);
else
lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8);
lpddi->dwDevType = get_device_type(version); sprintf(friendly, "Joystick %d", id); MultiByteToWideChar(CP_ACP, 0, friendly, -1, lpddi->tszInstanceName, MAX_PATH); /* get the device name */
-- 1.9.1