[PATCH] dinput: Allow Enumeration of joysticks with DirectX 3.
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Thu May 9 22:46:11 CDT 2019
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.
Whe 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 <leslie_alistair at hotmail.com>
---
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 5c4a353..2480bc2 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 3ab0483..3c27f0d 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 5ddfcbb..540d16b 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 631ea57..c07e821 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 "
--
1.9.1
More information about the wine-devel
mailing list