From: Ivo Ivanov logos128@gmail.com
Fixes the Download method not sending an initial type specific HID PID report in the rare cases where all type specific params are set to 0 through the initial SetParameters call, so they aren't considered as modified.
FH5 is affected by this issue, since it initially sets the direction of its constant effect to 0, which translates to 0 magnitude in dinput. --- dlls/dinput/joystick_hid.c | 4 +++- dlls/dinput/tests/force_feedback.c | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 2065fe429eb..311e5903878 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -2993,6 +2993,7 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) case PID_USAGE_ET_SAWTOOTH_DOWN: case PID_USAGE_ET_CONSTANT_FORCE: case PID_USAGE_ET_RAMP: + if (!(impl->flags & DIEP_ENVELOPE)) break; if (!(impl->modified & DIEP_ENVELOPE)) break;
set_parameter_value( impl, impl->set_envelope_buf, set_envelope->attack_level_caps, @@ -3100,7 +3101,7 @@ static HRESULT WINAPI hid_joystick_effect_Unload( IDirectInputEffect *iface ) else hr = DIERR_INPUTLOST; }
- impl->modified = impl->flags; + impl->modified = ~0; impl->index = 0; check_empty_force_feedback_state( joystick ); } @@ -3161,6 +3162,7 @@ static HRESULT hid_joystick_create_effect( IDirectInputDevice8W *iface, IDirectI impl->params.rgdwAxes = impl->axes; impl->params.rglDirection = impl->directions; impl->params.dwTriggerButton = -1; + impl->modified = ~0; impl->status = 0;
*out = &impl->IDirectInputEffect_iface; diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c index d9ae039f681..de7d5990f34 100644 --- a/dlls/dinput/tests/force_feedback.c +++ b/dlls/dinput/tests/force_feedback.c @@ -367,7 +367,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_id = 5, .report_len = 2, .report_buf = {0x05,0x00}, - .todo = TRUE, }, /* set envelope */ { @@ -375,7 +374,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_id = 6, .report_len = 7, .report_buf = {0x06,0x00,0x00,0x00,0x00,0x00,0x00}, - .todo = TRUE, }, /* update effect */ { @@ -393,7 +391,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO .report_id = 5, .report_len = 2, .report_buf = {0x05,0x00}, - .todo = TRUE, }, /* update effect */ {