From a95f76094e9563230b131cfdea39f906678d8ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 22 Nov 2021 11:05:46 +0100 Subject: [PATCH] dinput: Send -1 for infinite durations in HID reports. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52061 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/dinput/joystick_hid.c | 3 ++- dlls/dinput8/tests/hid.c | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 3d90e721fb6..5ecf54e2281 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -2728,7 +2728,8 @@ static void set_parameter_value_us( struct hid_joystick_effect *impl, char *repo LONG exp; if (!caps) return; exp = caps->units_exp; - if (caps->units != 0x1003) WARN( "unknown time unit caps %x\n", caps->units ); + if (value == INFINITE) value = caps->physical_min - 1; + else if (caps->units != 0x1003) WARN( "unknown time unit caps %x\n", caps->units ); else if (exp < -6) while (exp++ < -6) value *= 10; else if (exp > -6) while (exp-- > -6) value /= 10; set_parameter_value( impl, report_buf, caps, value ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 884a0100abe..26a5406fa57 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5650,15 +5650,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_id = 3, .report_len = 11, .report_buf = {0x03,0x01,0x02,0x08,0xff,0xff,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, - .todo = TRUE, - }, - /* update effect */ - { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 3, - .report_len = 11, - .report_buf = {0x03,0x01,0x02,0x08,0x00,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, - .wine_only = TRUE, .todo = TRUE, }, }; struct hid_expect expect_set_envelope[] = @@ -5683,7 +5674,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 11, - .report_buf = {0x03,0x01,0x02,0x08,0x00,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, + .report_buf = {0x03,0x01,0x02,0x08,0xff,0xff,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, .wine_only = TRUE, .todo = TRUE, }, };