dinput: Add DIDFT_FFEFFECTTRIGGER flag on trigger buttons.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-10-06 10:21:59 +02:00 committed by Alexandre Julliard
parent 1285bbfa43
commit 489c62f9eb
2 changed files with 10 additions and 7 deletions

View File

@ -285,7 +285,7 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
DWORD collection = 0, object = 0, axis = 0, button = 0, pov = 0, value_ofs = 0, button_ofs = 0, i, j; DWORD collection = 0, object = 0, axis = 0, button = 0, pov = 0, value_ofs = 0, button_ofs = 0, i, j;
struct hid_preparsed_data *preparsed = (struct hid_preparsed_data *)impl->preparsed; struct hid_preparsed_data *preparsed = (struct hid_preparsed_data *)impl->preparsed;
DIDEVICEOBJECTINSTANCEW instance = {.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW)}; DIDEVICEOBJECTINSTANCEW instance = {.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW)};
struct hid_value_caps *caps, *caps_end, *nary, *nary_end; struct hid_value_caps *caps, *caps_end, *nary, *nary_end, *effect_caps;
DIDATAFORMAT *format = impl->base.data_format.wine_df; DIDATAFORMAT *format = impl->base.data_format.wine_df;
int *offsets = impl->base.data_format.offsets; int *offsets = impl->base.data_format.offsets;
struct hid_collection_node *node, *node_end; struct hid_collection_node *node, *node_end;
@ -356,6 +356,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
} }
} }
effect_caps = impl->pid_effect_update.trigger_button_caps;
for (caps = HID_INPUT_VALUE_CAPS( preparsed ), caps_end = caps + preparsed->input_caps_count; for (caps = HID_INPUT_VALUE_CAPS( preparsed ), caps_end = caps + preparsed->input_caps_count;
caps != caps_end; ++caps) caps != caps_end; ++caps)
{ {
@ -372,6 +374,11 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
instance.dwOfs = button_ofs; instance.dwOfs = button_ofs;
instance.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( button++ ); instance.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( button++ );
instance.dwFlags = 0; instance.dwFlags = 0;
if (effect_caps && effect_caps->logical_min <= j && effect_caps->logical_max >= j)
{
instance.dwType |= DIDFT_FFEFFECTTRIGGER;
instance.dwFlags |= DIDOI_FFEFFECTTRIGGER;
}
instance.wUsagePage = caps->usage_page; instance.wUsagePage = caps->usage_page;
instance.wUsage = j; instance.wUsage = j;
instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage ); instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage );

View File

@ -3294,8 +3294,6 @@ static BOOL CALLBACK find_test_device( const DIDEVICEINSTANCEW *devinst, void *c
struct check_objects_todos struct check_objects_todos
{ {
BOOL type;
BOOL flags;
BOOL dimension; BOOL dimension;
BOOL exponent; BOOL exponent;
}; };
@ -3323,9 +3321,7 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar
check_member( *obj, *exp, "%u", dwSize ); check_member( *obj, *exp, "%u", dwSize );
check_member_guid( *obj, *exp, guidType ); check_member_guid( *obj, *exp, guidType );
check_member( *obj, *exp, "%#x", dwOfs ); check_member( *obj, *exp, "%#x", dwOfs );
todo_wine_if( todo->type )
check_member( *obj, *exp, "%#x", dwType ); check_member( *obj, *exp, "%#x", dwType );
todo_wine_if( todo->flags )
check_member( *obj, *exp, "%#x", dwFlags ); check_member( *obj, *exp, "%#x", dwFlags );
if (!localized) todo_wine check_member_wstr( *obj, *exp, tszName ); if (!localized) todo_wine check_member_wstr( *obj, *exp, tszName );
check_member( *obj, *exp, "%u", dwFFMaxForce ); check_member( *obj, *exp, "%u", dwFFMaxForce );
@ -6395,8 +6391,8 @@ static void test_force_feedback_joystick( void )
{}, {},
{}, {},
{}, {},
{.type = TRUE, .flags = TRUE}, {},
{.type = TRUE, .flags = TRUE}, {},
{}, {},
{}, {},
{}, {},