From dc2e2153f37739d73005adb3095e320b214a38d8 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 3 May 2019 11:53:26 +1000 Subject: [PATCH] Added dinput-joy-directX3 patchset --- ...meration-of-joysticks-with-DirectX-3.patch | 103 ++++++++++ ...-Don-t-return-unsupported-interfaces.patch | 183 ++++++++++++++++++ ...NOINTERFACE-from-IDirectInputDevice2.patch | 27 +++ ...-Dont-report-we-cannot-open-a-device.patch | 28 +++ ...05-dinput-Improve-EnumDevice-tracing.patch | 29 +++ ...IDEVICEINSTANCE_DX3-for-Mouse-GetDev.patch | 79 ++++++++ patches/dinput-joy-directX3/definition | 2 + patches/patchinstall.sh | 31 +++ 8 files changed, 482 insertions(+) create mode 100644 patches/dinput-joy-directX3/0001-dinput-Allow-Enumeration-of-joysticks-with-DirectX-3.patch create mode 100644 patches/dinput-joy-directX3/0002-dinput-Don-t-return-unsupported-interfaces.patch create mode 100644 patches/dinput-joy-directX3/0003-dinput-Return-E_NOINTERFACE-from-IDirectInputDevice2.patch create mode 100644 patches/dinput-joy-directX3/0004-dinput-Dont-report-we-cannot-open-a-device.patch create mode 100644 patches/dinput-joy-directX3/0005-dinput-Improve-EnumDevice-tracing.patch create mode 100644 patches/dinput-joy-directX3/0006-dinput-Support-DIDEVICEINSTANCE_DX3-for-Mouse-GetDev.patch create mode 100644 patches/dinput-joy-directX3/definition diff --git a/patches/dinput-joy-directX3/0001-dinput-Allow-Enumeration-of-joysticks-with-DirectX-3.patch b/patches/dinput-joy-directX3/0001-dinput-Allow-Enumeration-of-joysticks-with-DirectX-3.patch new file mode 100644 index 00000000..99173568 --- /dev/null +++ b/patches/dinput-joy-directX3/0001-dinput-Allow-Enumeration-of-joysticks-with-DirectX-3.patch @@ -0,0 +1,103 @@ +From 4ec91bab963a508a30bc1a77b785a5014d6bf264 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 1 May 2019 12:22:14 +1000 +Subject: [PATCH 1/7] 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. + +The current tests show that this is the correct behaviour, +However, + On windows (Steam version of above) uses a shim to allow joystick support. + +Signed-off-by: Alistair Leslie-Hughes +--- + 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 d661a14..22f7d3b 100644 +--- a/dlls/dinput/joystick_linux.c ++++ b/dlls/dinput/joystick_linux.c +@@ -377,7 +377,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) +@@ -406,7 +406,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 3580505..fb6b305 100644 +--- a/dlls/dinput/joystick_linuxinput.c ++++ b/dlls/dinput/joystick_linuxinput.c +@@ -412,7 +412,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; + +@@ -437,7 +437,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 4259d1a..3b7a7f0 100644 +--- a/dlls/dinput/joystick_osx.c ++++ b/dlls/dinput/joystick_osx.c +@@ -955,7 +955,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 + diff --git a/patches/dinput-joy-directX3/0002-dinput-Don-t-return-unsupported-interfaces.patch b/patches/dinput-joy-directX3/0002-dinput-Don-t-return-unsupported-interfaces.patch new file mode 100644 index 00000000..c956e621 --- /dev/null +++ b/patches/dinput-joy-directX3/0002-dinput-Don-t-return-unsupported-interfaces.patch @@ -0,0 +1,183 @@ +From 767f65c97a00ea8418f0c8309c0759a16b8b5e88 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sun, 28 Apr 2019 10:24:07 +0000 +Subject: [PATCH 2/7] dinput: Don't return unsupported interfaces. + +Supersedes 163790. + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dinput/dinput_main.c | 50 ++++++++++++++++----------------------------- + dlls/dinput/tests/dinput.c | 21 ++++--------------- + dlls/dinput8/tests/dinput.c | 28 ++++++++----------------- + 3 files changed, 30 insertions(+), 69 deletions(-) + +diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c +index 9e837bd..7bf067f 100644 +--- a/dlls/dinput/dinput_main.c ++++ b/dlls/dinput/dinput_main.c +@@ -566,53 +566,39 @@ static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, RE + if (!riid || !ppobj) + return E_POINTER; + ++ *ppobj = NULL; ++ ++#if DIRECTINPUT_VERSION == 0x0700 + if (IsEqualGUID( &IID_IUnknown, riid ) || +- IsEqualGUID( &IID_IDirectInputA, riid ) || +- IsEqualGUID( &IID_IDirectInput2A, riid ) || +- IsEqualGUID( &IID_IDirectInput7A, riid )) +- { ++ IsEqualGUID( &IID_IDirectInputA, riid ) || ++ IsEqualGUID( &IID_IDirectInput2A, riid ) || ++ IsEqualGUID( &IID_IDirectInput7A, riid )) + *ppobj = &This->IDirectInput7A_iface; +- IUnknown_AddRef( (IUnknown*)*ppobj ); +- +- return DI_OK; +- } +- +- if (IsEqualGUID( &IID_IDirectInputW, riid ) || +- IsEqualGUID( &IID_IDirectInput2W, riid ) || +- IsEqualGUID( &IID_IDirectInput7W, riid )) +- { ++ else if (IsEqualGUID( &IID_IDirectInputW, riid ) || ++ IsEqualGUID( &IID_IDirectInput2W, riid ) || ++ IsEqualGUID( &IID_IDirectInput7W, riid )) + *ppobj = &This->IDirectInput7W_iface; +- IUnknown_AddRef( (IUnknown*)*ppobj ); + +- return DI_OK; +- } +- +- if (IsEqualGUID( &IID_IDirectInput8A, riid )) +- { ++#else ++ if (IsEqualGUID( &IID_IUnknown, riid ) || ++ IsEqualGUID( &IID_IDirectInput8A, riid )) + *ppobj = &This->IDirectInput8A_iface; +- IUnknown_AddRef( (IUnknown*)*ppobj ); +- +- return DI_OK; +- } + +- if (IsEqualGUID( &IID_IDirectInput8W, riid )) +- { ++ else if (IsEqualGUID( &IID_IDirectInput8W, riid )) + *ppobj = &This->IDirectInput8W_iface; +- IUnknown_AddRef( (IUnknown*)*ppobj ); + +- return DI_OK; +- } ++#endif + + if (IsEqualGUID( &IID_IDirectInputJoyConfig8, riid )) +- { + *ppobj = &This->IDirectInputJoyConfig8_iface; +- IUnknown_AddRef( (IUnknown*)*ppobj ); + ++ if(*ppobj) ++ { ++ IUnknown_AddRef( (IUnknown*)*ppobj ); + return DI_OK; + } + +- FIXME( "Unsupported interface: %s\n", debugstr_guid(riid)); +- *ppobj = NULL; ++ WARN( "Unsupported interface: %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + +diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c +index 23b20d2..6451241 100644 +--- a/dlls/dinput/tests/dinput.c ++++ b/dlls/dinput/tests/dinput.c +@@ -272,11 +272,10 @@ static void test_QueryInterface(void) + static const struct + { + REFIID riid; +- int test_todo; + } no_interface_list[] = + { +- {&IID_IDirectInput8A, 1}, +- {&IID_IDirectInput8W, 1}, ++ {&IID_IDirectInput8A}, ++ {&IID_IDirectInput8W}, + {&IID_IDirectInputDeviceA}, + {&IID_IDirectInputDeviceW}, + {&IID_IDirectInputDevice2A}, +@@ -324,20 +323,8 @@ static void test_QueryInterface(void) + { + pUnk = (void *)0xdeadbeef; + hr = IDirectInput_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk); +- if (no_interface_list[i].test_todo) +- { +- todo_wine +- ok(hr == E_NOINTERFACE, "[%d] IDirectInput_QueryInterface returned 0x%08x\n", i, hr); +- todo_wine +- ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); +- +- if (pUnk) IUnknown_Release(pUnk); +- } +- else +- { +- ok(hr == E_NOINTERFACE, "[%d] IDirectInput_QueryInterface returned 0x%08x\n", i, hr); +- ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); +- } ++ ok(hr == E_NOINTERFACE, "[%d] IDirectInput_QueryInterface returned 0x%08x\n", i, hr); ++ ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); + } + + IDirectInput_Release(pDI); +diff --git a/dlls/dinput8/tests/dinput.c b/dlls/dinput8/tests/dinput.c +index 28b1bd5..d87f997 100644 +--- a/dlls/dinput8/tests/dinput.c ++++ b/dlls/dinput8/tests/dinput.c +@@ -225,15 +225,14 @@ static void test_QueryInterface(void) + static const struct + { + REFIID riid; +- int test_todo; + } no_interface_list[] = + { +- {&IID_IDirectInputA, 1}, +- {&IID_IDirectInputW, 1}, +- {&IID_IDirectInput2A, 1}, +- {&IID_IDirectInput2W, 1}, +- {&IID_IDirectInput7A, 1}, +- {&IID_IDirectInput7W, 1}, ++ {&IID_IDirectInputA}, ++ {&IID_IDirectInputW}, ++ {&IID_IDirectInput2A}, ++ {&IID_IDirectInput2W}, ++ {&IID_IDirectInput7A}, ++ {&IID_IDirectInput7W}, + {&IID_IDirectInputDeviceA}, + {&IID_IDirectInputDeviceW}, + {&IID_IDirectInputDevice2A}, +@@ -293,20 +292,9 @@ static void test_QueryInterface(void) + { + pUnk = (void *)0xdeadbeef; + hr = IDirectInput8_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk); +- if (no_interface_list[i].test_todo) +- { +- todo_wine +- ok(hr == E_NOINTERFACE, "[%d] IDirectInput8_QueryInterface returned 0x%08x\n", i, hr); +- todo_wine +- ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); + +- if (pUnk) IUnknown_Release(pUnk); +- } +- else +- { +- ok(hr == E_NOINTERFACE, "[%d] IDirectInput8_QueryInterface returned 0x%08x\n", i, hr); +- ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); +- } ++ ok(hr == E_NOINTERFACE, "[%d] IDirectInput8_QueryInterface returned 0x%08x\n", i, hr); ++ ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); + } + + IDirectInput8_Release(pDI); +-- +1.9.1 + diff --git a/patches/dinput-joy-directX3/0003-dinput-Return-E_NOINTERFACE-from-IDirectInputDevice2.patch b/patches/dinput-joy-directX3/0003-dinput-Return-E_NOINTERFACE-from-IDirectInputDevice2.patch new file mode 100644 index 00000000..12045fa5 --- /dev/null +++ b/patches/dinput-joy-directX3/0003-dinput-Return-E_NOINTERFACE-from-IDirectInputDevice2.patch @@ -0,0 +1,27 @@ +From 7b59e0a7d0962899762b5b7a466d16b97d771df2 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 27 Apr 2019 12:53:06 +1000 +Subject: [PATCH 3/7] dinput: Return E_NOINTERFACE from IDirectInputDevice2 + QueryInterface + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dinput/device.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c +index 63eb868..1317e91 100644 +--- a/dlls/dinput/device.c ++++ b/dlls/dinput/device.c +@@ -1257,7 +1257,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W ifa + } + + WARN("Unsupported interface!\n"); +- return E_FAIL; ++ return E_NOINTERFACE; + } + + HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj) +-- +1.9.1 + diff --git a/patches/dinput-joy-directX3/0004-dinput-Dont-report-we-cannot-open-a-device.patch b/patches/dinput-joy-directX3/0004-dinput-Dont-report-we-cannot-open-a-device.patch new file mode 100644 index 00000000..9400f50c --- /dev/null +++ b/patches/dinput-joy-directX3/0004-dinput-Dont-report-we-cannot-open-a-device.patch @@ -0,0 +1,28 @@ +From 1b1158f85ae61f348207460ce98b1977eee79b66 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 27 Apr 2019 13:10:01 +1000 +Subject: [PATCH 4/7] dinput: Dont report we cannot open a device + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dinput/joystick_linuxinput.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c +index fb6b305..7343a50 100644 +--- a/dlls/dinput/joystick_linuxinput.c ++++ b/dlls/dinput/joystick_linuxinput.c +@@ -219,10 +219,7 @@ static void find_joydevs(void) + } + + if (fd == -1) +- { +- WARN("Failed to open \"%s\": %d %s\n", buf, errno, strerror(errno)); + continue; +- } + + if (ioctl(fd, EVIOCGBIT(0, sizeof(joydev.evbits)), joydev.evbits) == -1) + { +-- +1.9.1 + diff --git a/patches/dinput-joy-directX3/0005-dinput-Improve-EnumDevice-tracing.patch b/patches/dinput-joy-directX3/0005-dinput-Improve-EnumDevice-tracing.patch new file mode 100644 index 00000000..fb2e4922 --- /dev/null +++ b/patches/dinput-joy-directX3/0005-dinput-Improve-EnumDevice-tracing.patch @@ -0,0 +1,29 @@ +From 0e363558e654e25546127effe43a07c2b2038c9b Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sat, 27 Apr 2019 13:23:46 +1000 +Subject: [PATCH 5/7] dinput: Improve EnumDevice tracing + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dinput/dinput_main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c +index 7bf067f..4b41b71 100644 +--- a/dlls/dinput/dinput_main.c ++++ b/dlls/dinput/dinput_main.c +@@ -467,9 +467,10 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices( + + for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) { + if (!dinput_devices[i]->enum_deviceA) continue; ++ ++ TRACE(" Checking device %u ('%s')\n", i, dinput_devices[i]->name); + for (j = 0, r = S_OK; SUCCEEDED(r); j++) { + devInstance.dwSize = sizeof(devInstance); +- TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name); + r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->dwVersion, j); + if (r == S_OK) + if (enum_callback_wrapper(lpCallback, &devInstance, pvRef) == DIENUM_STOP) +-- +1.9.1 + diff --git a/patches/dinput-joy-directX3/0006-dinput-Support-DIDEVICEINSTANCE_DX3-for-Mouse-GetDev.patch b/patches/dinput-joy-directX3/0006-dinput-Support-DIDEVICEINSTANCE_DX3-for-Mouse-GetDev.patch new file mode 100644 index 00000000..8fdac4da --- /dev/null +++ b/patches/dinput-joy-directX3/0006-dinput-Support-DIDEVICEINSTANCE_DX3-for-Mouse-GetDev.patch @@ -0,0 +1,79 @@ +From e5eb27de156f7d250755fb3070c419e28e9d1957 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Sun, 28 Apr 2019 12:11:56 +1000 +Subject: [PATCH 6/7] dinput: Support DIDEVICEINSTANCE_DX3 for Mouse + GetDeviceInfo + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dinput/mouse.c | 5 ----- + dlls/dinput/tests/mouse.c | 30 ++++++++++++++++++++++++++++++ + 2 files changed, 30 insertions(+), 5 deletions(-) + +diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c +index 0adba03..1e2b1d1 100644 +--- a/dlls/dinput/mouse.c ++++ b/dlls/dinput/mouse.c +@@ -765,11 +765,6 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceInfo( + SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface); + TRACE("(this=%p,%p)\n", This, pdidi); + +- if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) { +- WARN(" dinput3 not supported yet...\n"); +- return DI_OK; +- } +- + fill_mouse_dideviceinstanceA(pdidi, This->base.dinput->dwVersion); + + return DI_OK; +diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c +index c2d0226..c1a7ff7 100644 +--- a/dlls/dinput/tests/mouse.c ++++ b/dlls/dinput/tests/mouse.c +@@ -198,6 +198,35 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd) + DestroyWindow( hwnd2 ); + } + ++static void test_GetDeviceInfo(IDirectInputA *pDI) ++{ ++ HRESULT hr; ++ IDirectInputDeviceA *pMouse = NULL; ++ DIDEVICEINSTANCEA instA; ++ DIDEVICEINSTANCE_DX3A inst3A; ++ ++ hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL); ++ ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr); ++ if (FAILED(hr)) return; ++ ++ instA.dwSize = sizeof(instA); ++ hr = IDirectInputDevice_GetDeviceInfo(pMouse, &instA); ++ ok(SUCCEEDED(hr), "got %08x\n", hr); ++ ++ inst3A.dwSize = sizeof(inst3A); ++ hr = IDirectInputDevice_GetDeviceInfo(pMouse, (DIDEVICEINSTANCEA *)&inst3A); ++ ok(SUCCEEDED(hr), "got %08x\n", hr); ++ ++ ok(instA.dwSize != inst3A.dwSize, "got %d, %d \n", instA.dwSize, inst3A.dwSize); ++ ok(IsEqualGUID(&instA.guidInstance, &inst3A.guidInstance), "got %s, %s\n", ++ wine_dbgstr_guid(&instA.guidInstance), wine_dbgstr_guid(&inst3A.guidInstance) ); ++ ok(IsEqualGUID(&instA.guidProduct, &inst3A.guidProduct), "got %s, %s\n", ++ wine_dbgstr_guid(&instA.guidProduct), wine_dbgstr_guid(&inst3A.guidProduct) ); ++ ok(instA.dwDevType == inst3A.dwDevType, "got %d, %d\n", instA.dwDevType, inst3A.dwDevType); ++ ++ if (pMouse) IUnknown_Release(pMouse); ++} ++ + static void mouse_tests(void) + { + HRESULT hr; +@@ -224,6 +253,7 @@ static void mouse_tests(void) + + test_set_coop(pDI, hwnd); + test_acquire(pDI, hwnd); ++ test_GetDeviceInfo(pDI); + + DestroyWindow(hwnd); + } +-- +1.9.1 + diff --git a/patches/dinput-joy-directX3/definition b/patches/dinput-joy-directX3/definition new file mode 100644 index 00000000..4a1edf54 --- /dev/null +++ b/patches/dinput-joy-directX3/definition @@ -0,0 +1,2 @@ +Fixes: [36764] dinput: Allow DirectX version 3 to enumerate joysticks. +# Other cleanups for dinput. diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 20456411..c4c01771 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -130,6 +130,7 @@ patch_enable_all () enable_ddraw_Write_Vtable="$1" enable_ddraw_version_check="$1" enable_dinput_axis_recalc="$1" + enable_dinput_joy_directX3="$1" enable_dinput_joy_mappings="$1" enable_dinput_reconnect_joystick="$1" enable_dinput_remap_joystick="$1" @@ -523,6 +524,9 @@ patch_enable () dinput-axis-recalc) enable_dinput_axis_recalc="$2" ;; + dinput-joy-directX3) + enable_dinput_joy_directX3="$2" + ;; dinput-joy-mappings) enable_dinput_joy_mappings="$2" ;; @@ -3079,6 +3083,33 @@ if test "$enable_dinput_axis_recalc" -eq 1; then ) >> "$patchlist" fi +# Patchset dinput-joy-directX3 +# | +# | This patchset fixes the following Wine bugs: +# | * [#36764] dinput: Allow DirectX version 3 to enumerate joysticks. +# | +# | Modified files: +# | * dlls/dinput/device.c, dlls/dinput/dinput_main.c, dlls/dinput/joystick_linux.c, dlls/dinput/joystick_linuxinput.c, +# | dlls/dinput/joystick_osx.c, dlls/dinput/mouse.c, dlls/dinput/tests/dinput.c, dlls/dinput/tests/joystick.c, +# | dlls/dinput/tests/mouse.c, dlls/dinput8/tests/dinput.c +# | +if test "$enable_dinput_joy_directX3" -eq 1; then + patch_apply dinput-joy-directX3/0001-dinput-Allow-Enumeration-of-joysticks-with-DirectX-3.patch + patch_apply dinput-joy-directX3/0002-dinput-Don-t-return-unsupported-interfaces.patch + patch_apply dinput-joy-directX3/0003-dinput-Return-E_NOINTERFACE-from-IDirectInputDevice2.patch + patch_apply dinput-joy-directX3/0004-dinput-Dont-report-we-cannot-open-a-device.patch + patch_apply dinput-joy-directX3/0005-dinput-Improve-EnumDevice-tracing.patch + patch_apply dinput-joy-directX3/0006-dinput-Support-DIDEVICEINSTANCE_DX3-for-Mouse-GetDev.patch + ( + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Allow Enumeration of joysticks with DirectX 3.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Don'\''t return unsupported interfaces.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Return E_NOINTERFACE from IDirectInputDevice2 QueryInterface.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Dont report we cannot open a device.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Improve EnumDevice tracing.", 1 },'; + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dinput: Support DIDEVICEINSTANCE_DX3 for Mouse GetDeviceInfo.", 1 },'; + ) >> "$patchlist" +fi + # Patchset dinput-joy-mappings # | # | This patchset fixes the following Wine bugs: