dinput: Fill the HID joystick object instance exponent and dimension.

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:22:00 +02:00 committed by Alexandre Julliard
parent 489c62f9eb
commit 4ce7ae4af1
2 changed files with 10 additions and 42 deletions

View file

@ -348,6 +348,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage );
instance.wReportId = caps->report_id;
instance.wCollectionNumber = caps->link_collection;
instance.dwDimension = caps->units;
instance.wExponent = caps->units_exp;
check_pid_effect_axis_caps( impl, &instance );
ret = enum_object( impl, &filter, flags, callback, caps, &instance, data );
if (ret != DIENUM_CONTINUE) return ret;
@ -384,6 +386,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage );
instance.wReportId = caps->report_id;
instance.wCollectionNumber = caps->link_collection;
instance.dwDimension = caps->units;
instance.wExponent = caps->units_exp;
ret = enum_object( impl, &filter, flags, callback, caps, &instance, data );
if (ret != DIENUM_CONTINUE) return ret;
button_ofs++;
@ -417,6 +421,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
instance.guidType = GUID_Unknown;
instance.wReportId = nary->report_id;
instance.wCollectionNumber = nary->link_collection;
instance.dwDimension = caps->units;
instance.wExponent = caps->units_exp;
ret = enum_object( impl, &filter, flags, callback, nary, &instance, data );
if (ret != DIENUM_CONTINUE) return ret;
button_ofs++;
@ -434,6 +440,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
instance.guidType = GUID_Unknown;
instance.wReportId = caps->report_id;
instance.wCollectionNumber = caps->link_collection;
instance.dwDimension = caps->units;
instance.wExponent = caps->units_exp;
ret = enum_object( impl, &filter, flags, callback, caps, &instance, data );
if (ret != DIENUM_CONTINUE) return ret;
@ -458,6 +466,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header,
instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage );
instance.wReportId = 0;
instance.wCollectionNumber = node->parent;
instance.dwDimension = 0;
instance.wExponent = 0;
ret = enum_object( impl, &filter, flags, callback, NULL, &instance, data );
if (ret != DIENUM_CONTINUE) return ret;
}

View file

@ -3292,18 +3292,11 @@ static BOOL CALLBACK find_test_device( const DIDEVICEINSTANCEW *devinst, void *c
return DIENUM_CONTINUE;
}
struct check_objects_todos
{
BOOL dimension;
BOOL exponent;
};
struct check_objects_params
{
UINT index;
UINT expect_count;
const DIDEVICEOBJECTINSTANCEW *expect_objs;
const struct check_objects_todos *todo_objs;
};
static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *args )
@ -3311,7 +3304,6 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar
static const DIDEVICEOBJECTINSTANCEW unexpected_obj = {0};
struct check_objects_params *params = args;
const DIDEVICEOBJECTINSTANCEW *exp = params->expect_objs + params->index;
const struct check_objects_todos *todo = params->todo_objs + params->index;
winetest_push_context( "obj[%d]", params->index );
@ -3330,9 +3322,7 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar
check_member( *obj, *exp, "%u", wDesignatorIndex );
check_member( *obj, *exp, "%#04x", wUsagePage );
check_member( *obj, *exp, "%#04x", wUsage );
todo_wine_if( todo->dimension )
check_member( *obj, *exp, "%#04x", dwDimension );
todo_wine_if( todo->exponent )
check_member( *obj, *exp, "%#04x", wExponent );
check_member( *obj, *exp, "%u", wReportId );
@ -3652,14 +3642,12 @@ static void test_simple_joystick(void)
.wUsage = HID_USAGE_GENERIC_JOYSTICK,
},
};
const struct check_objects_todos objects_todos[ARRAY_SIZE(expect_objects)] = {};
const DIEFFECTINFOW expect_effects[] = {};
struct check_objects_params check_objects_params =
{
.expect_count = ARRAY_SIZE(expect_objects),
.expect_objs = expect_objects,
.todo_objs = objects_todos,
};
struct check_effects_params check_effects_params =
{
@ -6386,35 +6374,6 @@ static void test_force_feedback_joystick( void )
.wUsage = PID_USAGE_SET_ENVELOPE_REPORT,
},
};
const struct check_objects_todos objects_todos[ARRAY_SIZE(expect_objects)] =
{
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{.dimension = TRUE, .exponent = TRUE},
{.dimension = TRUE, .exponent = TRUE},
{},
{},
{},
{},
{.dimension = TRUE, .exponent = TRUE},
{.dimension = TRUE, .exponent = TRUE},
};
const DIEFFECTINFOW expect_effects[] =
{
{
@ -6443,7 +6402,6 @@ static void test_force_feedback_joystick( void )
{
.expect_count = ARRAY_SIZE(expect_objects),
.expect_objs = expect_objects,
.todo_objs = objects_todos,
};
struct check_effects_params check_effects_params =
{