From c8217873383a7f9b09efd84b6d448f4132953e47 Mon Sep 17 00:00:00 2001 From: Ivo Ivanov Date: Tue, 9 Aug 2022 14:49:07 +0300 Subject: [PATCH] dinput/tests: Reduce the available FFB axes to X and Y in test_windows_gaming_input. Windows.Gaming.Input on Windows always uses the X and Y axes for FFB, ignoring what is declared in the HID report descriptor, and the Axes Enable collection. Since we have the correct behavior on Wine, this allows the test to complete on both platforms without issues. --- dlls/dinput/tests/force_feedback.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index d743f959f55..b841e4bb8c7 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -4967,19 +4967,18 @@ static void test_windows_gaming_input(void) COLLECTION(1, Logical), USAGE(4, (HID_USAGE_PAGE_GENERIC << 16)|HID_USAGE_GENERIC_X), USAGE(4, (HID_USAGE_PAGE_GENERIC << 16)|HID_USAGE_GENERIC_Y), - USAGE(4, (HID_USAGE_PAGE_GENERIC << 16)|HID_USAGE_GENERIC_Z), LOGICAL_MINIMUM(1, 0), LOGICAL_MAXIMUM(1, 1), PHYSICAL_MINIMUM(1, 0), PHYSICAL_MAXIMUM(1, 1), REPORT_SIZE(1, 1), - REPORT_COUNT(1, 3), + REPORT_COUNT(1, 2), OUTPUT(1, Data|Var|Abs), END_COLLECTION, USAGE(1, PID_USAGE_DIRECTION_ENABLE), REPORT_COUNT(1, 1), OUTPUT(1, Data|Var|Abs), - REPORT_COUNT(1, 4), + REPORT_COUNT(1, 5), OUTPUT(1, Cnst|Var|Abs), USAGE(1, PID_USAGE_DURATION), @@ -5566,7 +5565,7 @@ static void test_windows_gaming_input(void) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 18, - .report_buf = {3,0x01,0x02,0x08,0x78,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, + .report_buf = {3,0x01,0x02,0x04,0x78,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, }, }; struct hid_expect expect_create_condition[] = @@ -5597,7 +5596,7 @@ static void test_windows_gaming_input(void) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 18, - .report_buf = {3,0x01,0x03,0x08,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x99,0x00,0x00,0x00}, + .report_buf = {3,0x01,0x03,0x04,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x99,0x00,0x00,0x00}, }, }; struct hid_expect expect_create_constant[] = @@ -5635,7 +5634,7 @@ static void test_windows_gaming_input(void) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 18, - .report_buf = {3,0x01,0x04,0x08,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0x7f,0x4e,0x01,0x00,0x00}, + .report_buf = {3,0x01,0x04,0x04,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0x7f,0x4e,0x01,0x00,0x00}, }, }; struct hid_expect expect_create_ramp[] = @@ -5673,7 +5672,7 @@ static void test_windows_gaming_input(void) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 18, - .report_buf = {3,0x01,0x05,0x08,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, + .report_buf = {3,0x01,0x05,0x04,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00}, }, }; struct hid_expect expect_effect_start = @@ -5864,7 +5863,7 @@ static void test_windows_gaming_input(void) supported_axes = 0xdeadbeef; hr = IForceFeedbackMotor_get_SupportedAxes( motor, &supported_axes ); ok( hr == S_OK, "get_SupportedAxes returned %#lx\n", hr ); - axes = ForceFeedbackEffectAxes_X | ForceFeedbackEffectAxes_Y | ForceFeedbackEffectAxes_Z; + axes = ForceFeedbackEffectAxes_X | ForceFeedbackEffectAxes_Y; ok( supported_axes == axes || broken( supported_axes == ForceFeedbackEffectAxes_X ), "got axes %#x\n", supported_axes ); @@ -6170,6 +6169,13 @@ static void test_windows_gaming_input(void) ok( hr == S_OK, "SetParametersWithEnvelope returned %#lx\n", hr ); IPeriodicForceEffect_Release( periodic_effect ); + /* Windows.Gaming.Input always uses the X and Y directions on Windows, + * ignoring what is declared in the Axes Enable collection at the + * Set Effects report, or even the existence of the axes in the HID + * report. It ignores the Z direction, at least on HID PID devices. + * DirectInput works properly in such cases on Windows. + */ + set_hid_expect( file, expect_create_periodic, sizeof(expect_create_periodic) ); hr = IForceFeedbackMotor_LoadEffectAsync( motor, effect, &result_async ); ok( hr == S_OK, "LoadEffectAsync returned %#lx\n", hr );