mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 19:49:50 +00:00
dinput: Implement HID joystick IDirectInputDevice8_EnumObjects.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ef7432d86e
commit
1117f9f072
1 changed files with 44 additions and 1 deletions
|
@ -427,6 +427,49 @@ static HRESULT WINAPI hid_joystick_GetCapabilities( IDirectInputDevice8W *iface,
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
struct enum_objects_params
|
||||
{
|
||||
LPDIENUMDEVICEOBJECTSCALLBACKW callback;
|
||||
void *context;
|
||||
};
|
||||
|
||||
static BOOL enum_objects_callback( struct hid_joystick *impl, struct hid_caps *caps,
|
||||
DIDEVICEOBJECTINSTANCEW *instance, void *data )
|
||||
{
|
||||
struct enum_objects_params *params = data;
|
||||
return params->callback( instance, params->context );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI hid_joystick_EnumObjects( IDirectInputDevice8W *iface, LPDIENUMDEVICEOBJECTSCALLBACKW callback,
|
||||
void *context, DWORD flags )
|
||||
{
|
||||
static const DIPROPHEADER filter =
|
||||
{
|
||||
.dwSize = sizeof(filter),
|
||||
.dwHeaderSize = sizeof(filter),
|
||||
.dwHow = DIPH_DEVICE,
|
||||
};
|
||||
struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
|
||||
struct enum_objects_params params =
|
||||
{
|
||||
.callback = callback,
|
||||
.context = context,
|
||||
};
|
||||
BOOL ret;
|
||||
|
||||
TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags );
|
||||
|
||||
if (!callback) return DIERR_INVALIDPARAM;
|
||||
|
||||
ret = enum_value_objects( impl, &filter, flags, enum_objects_callback, ¶ms );
|
||||
if (ret != DIENUM_CONTINUE) return S_OK;
|
||||
ret = enum_button_objects( impl, &filter, flags, enum_objects_callback, ¶ms );
|
||||
if (ret != DIENUM_CONTINUE) return S_OK;
|
||||
enum_collections_objects( impl, &filter, flags, enum_objects_callback, ¶ms );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static BOOL get_property_prop_range( struct hid_joystick *impl, struct hid_caps *caps,
|
||||
DIDEVICEOBJECTINSTANCEW *instance, void *data )
|
||||
{
|
||||
|
@ -619,7 +662,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl =
|
|||
hid_joystick_Release,
|
||||
/*** IDirectInputDevice methods ***/
|
||||
hid_joystick_GetCapabilities,
|
||||
IDirectInputDevice2WImpl_EnumObjects,
|
||||
hid_joystick_EnumObjects,
|
||||
hid_joystick_GetProperty,
|
||||
hid_joystick_SetProperty,
|
||||
IDirectInputDevice2WImpl_Acquire,
|
||||
|
|
Loading…
Reference in a new issue