Module: wine Branch: master Commit: 42082d4d3946a3911fe7b6f811b5001a5cb15f01 URL: https://gitlab.winehq.org/wine/wine/-/commit/42082d4d3946a3911fe7b6f811b5001...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Dec 21 12:31:49 2022 +0100
dinput: Avoid sending envelope report if it has been removed.
---
dlls/dinput/joystick_hid.c | 11 ++++++++++- dlls/dinput/tests/force_feedback.c | 40 -------------------------------------- 2 files changed, 10 insertions(+), 41 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 41fd0e24963..2ec218ffc09 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -2641,7 +2641,9 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa impl->params.cbTypeSpecificParams = params->cbTypeSpecificParams; }
- if ((flags & DIEP_ENVELOPE) && params->lpEnvelope) + if (!(flags & DIEP_ENVELOPE)) + TRACE( "Keeping previous effect envelope\n" ); + else if (params->lpEnvelope) { if (params->lpEnvelope->dwSize != sizeof(DIENVELOPE)) return DIERR_INVALIDPARAM; impl->params.lpEnvelope = &impl->envelope; @@ -2649,6 +2651,13 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa impl->modified |= DIEP_ENVELOPE; memcpy( impl->params.lpEnvelope, params->lpEnvelope, sizeof(DIENVELOPE) ); } + else + { + flags &= ~DIEP_ENVELOPE; + impl->flags &= ~DIEP_ENVELOPE; + impl->modified &= ~DIEP_ENVELOPE; + impl->params.lpEnvelope = NULL; + }
if (flags & DIEP_DURATION) { diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index 1e68748a07d..f6157a84df7 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -458,14 +458,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_len = 2, .report_buf = {0x05,0x19}, }, - /* set envelope (wine) */ - { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 6, - .report_len = 7, - .report_buf = {0x06,0x19,0x4c,0x01,0x00,0x04,0x00}, - .todo = TRUE, .wine_only = TRUE, - }, /* update effect */ { .code = IOCTL_HID_WRITE_REPORT, @@ -5683,14 +5675,6 @@ static void test_windows_gaming_input(void) .report_len = 10, .report_buf = {7,0x01,0x10,0x27,0x00,0x00,0x70,0xff,0xe8,0x03}, }, - /* set envelope (wine) */ - { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 8, - .report_len = 8, - .report_buf = {8,0x01,0x00,0x00,0x00,0x00,0x00,0x00}, - .todo = TRUE, .wine_only = TRUE, - }, /* update effect */ { .code = IOCTL_HID_WRITE_REPORT, @@ -5822,14 +5806,6 @@ static void test_windows_gaming_input(void) .report_len = 4, .report_buf = {9,0x01,0x18,0xfc}, }, - /* set envelope (wine) */ - { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 8, - .report_len = 8, - .report_buf = {8,0x01,0x00,0x00,0x00,0x00,0x00,0x00}, - .todo = TRUE, .wine_only = TRUE, - }, /* update effect (wine) */ { .code = IOCTL_HID_WRITE_REPORT, @@ -5908,14 +5884,6 @@ static void test_windows_gaming_input(void) .report_len = 6, .report_buf = {10,0x01,0xe8,0x03,0xa0,0x0f}, }, - /* set envelope (wine) */ - { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 8, - .report_len = 8, - .report_buf = {8,0x01,0x00,0x00,0x00,0x00,0x00,0x00}, - .todo = TRUE, .wine_only = TRUE, - }, /* update effect (wine) */ { .code = IOCTL_HID_WRITE_REPORT, @@ -5956,14 +5924,6 @@ static void test_windows_gaming_input(void) .report_len = 6, .report_buf = {10,0x01,0x18,0xfc,0x60,0xf0}, }, - /* set envelope (wine) */ - { - .code = IOCTL_HID_WRITE_REPORT, - .report_id = 8, - .report_len = 8, - .report_buf = {8,0x01,0x00,0x00,0x00,0x00,0x00,0x00}, - .todo = TRUE, .wine_only = TRUE, - }, /* update effect (wine) */ { .code = IOCTL_HID_WRITE_REPORT,