Rémi Bernon : dinput: Return correct errors from HID joystick IDirectInputDevice8_Poll.
Alexandre Julliard
julliard at winehq.org
Tue Sep 21 15:59:02 CDT 2021
Module: wine
Branch: master
Commit: 54b2fc355327a46709f124bfff330ae6b92887e3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=54b2fc355327a46709f124bfff330ae6b92887e3
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Sep 21 09:52:49 2021 +0200
dinput: Return correct errors from HID joystick IDirectInputDevice8_Poll.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/joystick_hid.c | 14 +++++++++++++-
dlls/dinput8/tests/hid.c | 1 -
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 45e75588aed..f7107733d26 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -704,6 +704,18 @@ static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, D
return S_OK;
}
+static HRESULT WINAPI hid_joystick_Poll( IDirectInputDevice8W *iface )
+{
+ struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
+ HRESULT hr = DI_NOEFFECT;
+
+ EnterCriticalSection( &impl->base.crit );
+ if (!impl->base.acquired) hr = DIERR_NOTACQUIRED;
+ LeaveCriticalSection( &impl->base.crit );
+
+ return hr;
+}
+
static HRESULT WINAPI hid_joystick_BuildActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format,
const WCHAR *username, DWORD flags )
{
@@ -756,7 +768,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
IDirectInputDevice2WImpl_SendForceFeedbackCommand,
IDirectInputDevice2WImpl_EnumCreatedEffectObjects,
IDirectInputDevice2WImpl_Escape,
- IDirectInputDevice2WImpl_Poll,
+ hid_joystick_Poll,
IDirectInputDevice2WImpl_SendDeviceData,
/*** IDirectInputDevice7 methods ***/
IDirectInputDevice7WImpl_EnumEffectsInFile,
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index f24acfbf70d..b4aad6b7d5a 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -4102,7 +4102,6 @@ static void test_simple_joystick(void)
ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
hr = IDirectInputDevice8_Poll( device );
- todo_wine
ok( hr == DI_NOEFFECT, "IDirectInputDevice8_Poll returned: %#x\n", hr );
hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2) + 1, &state );
More information about the wine-cvs
mailing list