dinput: Clamp FFB effect report value to the field range.

If application sends out-of-range values for FFB effects, they become -1, which is undesireable, when -1 is in the physical range of the field and being sent to the device. This patch fixes it, clamping values to the field range. Clamping was earlier implemented here in 6.19. Windows does this clamping silently, and doesn't fail SetParameters call when values is out of range.

Affected application is Assetto Corsa EVO, which with default settings sends out ConstantForce magnitude under/over documented [-10000, 10000]. Link to the discussion with some investigation on Steam.

In this submission scaling and clamping were moved to the separate scale_and_clamp_value function, which is now called every time from set_parameter_value. To avoid regression with sending -1 for the infinite duration effects, separate function set_parameter_value_no_scaling created. Gain values in hid_joystick_send_device_gain are also scaled and clamped.

Merge request reports

Loading