Rémi Bernon : dinput: Implement HID joystick IDirectInputDevice8_GetObjectInfo.
Alexandre Julliard
julliard at winehq.org
Fri Aug 27 15:03:34 CDT 2021
Module: wine
Branch: master
Commit: ef7432d86e3d7ee1edf3c814efd4ef36dbed1020
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ef7432d86e3d7ee1edf3c814efd4ef36dbed1020
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Aug 27 12:45:27 2021 +0200
dinput: Implement HID joystick IDirectInputDevice8_GetObjectInfo.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/joystick_hid.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index d58a8f5d919..4a05afe30c7 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -536,6 +536,43 @@ static HRESULT WINAPI hid_joystick_GetDeviceState( IDirectInputDevice8W *iface,
return DI_OK;
}
+static BOOL get_object_info( struct hid_joystick *impl, struct hid_caps *caps,
+ DIDEVICEOBJECTINSTANCEW *instance, void *data )
+{
+ DIDEVICEOBJECTINSTANCEW *dest = data;
+ memcpy( dest, instance, dest->dwSize );
+ return DIENUM_STOP;
+}
+
+static HRESULT WINAPI hid_joystick_GetObjectInfo( IDirectInputDevice8W *iface, DIDEVICEOBJECTINSTANCEW *instance,
+ DWORD obj, DWORD how )
+{
+ struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
+ const DIPROPHEADER filter =
+ {
+ .dwSize = sizeof(filter),
+ .dwHeaderSize = sizeof(filter),
+ .dwHow = how,
+ .dwObj = obj
+ };
+ BOOL ret;
+
+ TRACE( "iface %p, instance %p, obj %#x, how %#x.\n", iface, instance, obj, how );
+
+ if (!instance) return E_POINTER;
+ if (instance->dwSize != sizeof(DIDEVICEOBJECTINSTANCE_DX3W) &&
+ instance->dwSize != sizeof(DIDEVICEOBJECTINSTANCEW))
+ return DIERR_INVALIDPARAM;
+
+ ret = enum_value_objects( impl, &filter, DIDFT_ALL, get_object_info, NULL );
+ if (ret != DIENUM_CONTINUE) return S_OK;
+ ret = enum_button_objects( impl, &filter, DIDFT_ALL, get_object_info, NULL );
+ if (ret != DIENUM_CONTINUE) return S_OK;
+ enum_collections_objects( impl, &filter, DIDFT_ALL, get_object_info, NULL );
+
+ return S_OK;
+}
+
static HRESULT WINAPI hid_joystick_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance )
{
struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
@@ -592,7 +629,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
IDirectInputDevice2WImpl_SetDataFormat,
IDirectInputDevice2WImpl_SetEventNotification,
IDirectInputDevice2WImpl_SetCooperativeLevel,
- IDirectInputDevice2WImpl_GetObjectInfo,
+ hid_joystick_GetObjectInfo,
hid_joystick_GetDeviceInfo,
IDirectInputDevice2WImpl_RunControlPanel,
IDirectInputDevice2WImpl_Initialize,
More information about the wine-cvs
mailing list