[PATCH v2 08/10] dinput: Implement HID joystick IDirectInputDevice8_GetObjectInfo.
Rémi Bernon
rbernon at codeweavers.com
Fri Aug 27 05:45:27 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
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,
--
2.33.0
More information about the wine-devel
mailing list