Commit ab4bed67 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Support up to 6 effect conditions.

As we support up to 6 force feedback axes and directions, the number of condition should match. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f486811d
...@@ -188,7 +188,7 @@ struct hid_joystick_effect ...@@ -188,7 +188,7 @@ struct hid_joystick_effect
LONG directions[6]; LONG directions[6];
DICONSTANTFORCE constant_force; DICONSTANTFORCE constant_force;
DIRAMPFORCE ramp_force; DIRAMPFORCE ramp_force;
DICONDITION condition[2]; DICONDITION condition[6];
DIENVELOPE envelope; DIENVELOPE envelope;
DIPERIODIC periodic; DIPERIODIC periodic;
DIEFFECT params; DIEFFECT params;
...@@ -1878,6 +1878,9 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface, ...@@ -1878,6 +1878,9 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface,
joystick->preparsed, impl->effect_update_buf, report_len ); joystick->preparsed, impl->effect_update_buf, report_len );
if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG; if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG;
impl->type_specific_buf[0][0] = 0;
impl->type_specific_buf[1][0] = 0;
switch (type) switch (type)
{ {
case PID_USAGE_ET_SQUARE: case PID_USAGE_ET_SQUARE:
...@@ -1899,9 +1902,6 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface, ...@@ -1899,9 +1902,6 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface,
status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_condition.id, joystick->preparsed, status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_condition.id, joystick->preparsed,
impl->type_specific_buf[0], report_len ); impl->type_specific_buf[0], report_len );
if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG; if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG;
status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_condition.id, joystick->preparsed,
impl->type_specific_buf[1], report_len );
if (status != HIDP_STATUS_SUCCESS) return DIERR_DEVICENOTREG;
break; break;
case PID_USAGE_ET_CONSTANT_FORCE: case PID_USAGE_ET_CONSTANT_FORCE:
status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_constant_force.id, joystick->preparsed, status = HidP_InitializeReportForID( HidP_Output, joystick->pid_set_constant_force.id, joystick->preparsed,
...@@ -1921,8 +1921,6 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface, ...@@ -1921,8 +1921,6 @@ static HRESULT WINAPI hid_joystick_effect_Initialize( IDirectInputEffect *iface,
break; break;
case PID_USAGE_ET_CUSTOM_FORCE_DATA: case PID_USAGE_ET_CUSTOM_FORCE_DATA:
FIXME( "effect type %#x not implemented!\n", type ); FIXME( "effect type %#x not implemented!\n", type );
impl->type_specific_buf[0][0] = 0;
impl->type_specific_buf[1][0] = 0;
break; break;
} }
...@@ -2626,22 +2624,22 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface ) ...@@ -2626,22 +2624,22 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface )
case PID_USAGE_ET_DAMPER: case PID_USAGE_ET_DAMPER:
case PID_USAGE_ET_INERTIA: case PID_USAGE_ET_INERTIA:
case PID_USAGE_ET_FRICTION: case PID_USAGE_ET_FRICTION:
for (i = 0; i < min( 2, impl->params.cbTypeSpecificParams / sizeof(DICONDITION) ); ++i) for (i = 0; i < impl->params.cbTypeSpecificParams / sizeof(DICONDITION); ++i)
{ {
set_parameter_value( impl, impl->type_specific_buf[i], set_condition->center_point_offset_caps, set_parameter_value( impl, impl->type_specific_buf[0], set_condition->center_point_offset_caps,
impl->condition[i].lOffset ); impl->condition[i].lOffset );
set_parameter_value( impl, impl->type_specific_buf[i], set_condition->positive_coefficient_caps, set_parameter_value( impl, impl->type_specific_buf[0], set_condition->positive_coefficient_caps,
impl->condition[i].lPositiveCoefficient ); impl->condition[i].lPositiveCoefficient );
set_parameter_value( impl, impl->type_specific_buf[i], set_condition->negative_coefficient_caps, set_parameter_value( impl, impl->type_specific_buf[0], set_condition->negative_coefficient_caps,
impl->condition[i].lNegativeCoefficient ); impl->condition[i].lNegativeCoefficient );
set_parameter_value( impl, impl->type_specific_buf[i], set_condition->positive_saturation_caps, set_parameter_value( impl, impl->type_specific_buf[0], set_condition->positive_saturation_caps,
impl->condition[i].dwPositiveSaturation ); impl->condition[i].dwPositiveSaturation );
set_parameter_value( impl, impl->type_specific_buf[i], set_condition->negative_saturation_caps, set_parameter_value( impl, impl->type_specific_buf[0], set_condition->negative_saturation_caps,
impl->condition[i].dwNegativeSaturation ); impl->condition[i].dwNegativeSaturation );
set_parameter_value( impl, impl->type_specific_buf[i], set_condition->dead_band_caps, set_parameter_value( impl, impl->type_specific_buf[0], set_condition->dead_band_caps,
impl->condition[i].lDeadBand ); impl->condition[i].lDeadBand );
if (WriteFile( device, impl->type_specific_buf[i], report_len, NULL, NULL )) hr = DI_OK; if (WriteFile( device, impl->type_specific_buf[0], report_len, NULL, NULL )) hr = DI_OK;
else hr = DIERR_INPUTLOST; else hr = DIERR_INPUTLOST;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment