From fe4db5309e3754a96873d959736b5c9099a5ef38 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 10 May 2019 03:46:11 +0000 Subject: [PATCH] dinput: Allow enumeration of joysticks with DirectX 3. Star Wars: Rogue 3D requests a DirectX 3.0 version 0108:trace:dinput:DirectInputCreateEx (0x400000,0300,{9a4cb684-236d-11d3-8e9d-00c04f6844ae},0x7acfa0,(nil)) and then tries to interate over all Joysticks. When using modern windows, the current tests show that this is the correct behaviour. However, it's possible to use a shim to allow older games, like the one above, to interate over joysticks. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/dinput/joystick_linux.c | 4 ++-- dlls/dinput/joystick_linuxinput.c | 4 ++-- dlls/dinput/joystick_osx.c | 4 ++-- dlls/dinput/tests/joystick.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 5c4a35323d9..2480bc2b764 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -415,7 +415,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS } if ((dwDevType == 0) || - ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version >= 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) { /* check whether we have a joystick */ if ((fd = open(joystick_devices[id].device, O_RDONLY)) == -1) @@ -444,7 +444,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS } if ((dwDevType == 0) || - ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version >= 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) { /* check whether we have a joystick */ if ((fd = open(joystick_devices[id].device, O_RDONLY)) == -1) diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 3ab04835eb2..3c27f0d70b5 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -418,7 +418,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS } if (!((dwDevType == 0) || - ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version >= 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800)))) return S_FALSE; @@ -443,7 +443,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS } if (!((dwDevType == 0) || - ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version >= 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800)))) return S_FALSE; diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c index 5ddfcbb91f6..540d16b2da8 100644 --- a/dlls/dinput/joystick_osx.c +++ b/dlls/dinput/joystick_osx.c @@ -954,7 +954,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS device = get_device_ref(id); if ((dwDevType == 0) || - ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version >= 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) { if (dwFlags & DIEDFL_FORCEFEEDBACK) { @@ -1002,7 +1002,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS device = get_device_ref(id); if ((dwDevType == 0) || - ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version >= 0x0300 && version < 0x0800)) || (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) { if (dwFlags & DIEDFL_FORCEFEEDBACK) { diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index 631ea57ece6..c07e821fb09 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -321,7 +321,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) DIPROPDWORD dip_gain_set, dip_gain_get; struct effect_enum effect_data; - ok(data->version > 0x0300, "Joysticks not supported in version 0x%04x\n", data->version); + ok(data->version >= 0x0300, "Joysticks not supported in version 0x%04x\n", data->version); hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidInstance, NULL, NULL); ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "