winebus.sys: Add support for PID effect gain.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0a4b2bbd55
commit
4860e52924
|
@ -647,7 +647,7 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
|
|||
effect.periodic.direction.dir[0] = direction;
|
||||
effect.periodic.direction.dir[1] = params->direction[1];
|
||||
effect.periodic.period = params->periodic.period;
|
||||
effect.periodic.magnitude = params->periodic.magnitude;
|
||||
effect.periodic.magnitude = (params->periodic.magnitude * params->gain_percent) / 100;
|
||||
effect.periodic.offset = params->periodic.offset;
|
||||
effect.periodic.phase = params->periodic.phase;
|
||||
effect.periodic.attack_length = params->envelope.attack_time;
|
||||
|
@ -695,7 +695,7 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
|
|||
effect.constant.direction.type = SDL_HAPTIC_SPHERICAL;
|
||||
effect.constant.direction.dir[0] = direction;
|
||||
effect.constant.direction.dir[1] = params->direction[1];
|
||||
effect.constant.level = params->constant_force.magnitude;
|
||||
effect.constant.level = (params->constant_force.magnitude * params->gain_percent) / 100;
|
||||
effect.constant.attack_length = params->envelope.attack_time;
|
||||
effect.constant.attack_level = params->envelope.attack_level;
|
||||
effect.constant.fade_length = params->envelope.fade_time;
|
||||
|
@ -712,8 +712,8 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
|
|||
effect.ramp.direction.type = SDL_HAPTIC_SPHERICAL;
|
||||
effect.ramp.direction.dir[0] = params->direction[0];
|
||||
effect.ramp.direction.dir[1] = params->direction[1];
|
||||
effect.ramp.start = params->ramp_force.ramp_start;
|
||||
effect.ramp.end = params->ramp_force.ramp_end;
|
||||
effect.ramp.start = (params->ramp_force.ramp_start * params->gain_percent) / 100;
|
||||
effect.ramp.end = (params->ramp_force.ramp_end * params->gain_percent) / 100;
|
||||
effect.ramp.attack_length = params->envelope.attack_time;
|
||||
effect.ramp.attack_level = params->envelope.attack_level;
|
||||
effect.ramp.fade_length = params->envelope.fade_time;
|
||||
|
|
|
@ -1138,7 +1138,7 @@ static NTSTATUS lnxev_device_physical_effect_update(struct unix_device *iface, B
|
|||
case PID_USAGE_ET_SAWTOOTH_UP:
|
||||
case PID_USAGE_ET_SAWTOOTH_DOWN:
|
||||
effect.u.periodic.period = params->periodic.period;
|
||||
effect.u.periodic.magnitude = params->periodic.magnitude;
|
||||
effect.u.periodic.magnitude = (params->periodic.magnitude * params->gain_percent) / 100;
|
||||
effect.u.periodic.offset = params->periodic.offset;
|
||||
effect.u.periodic.phase = params->periodic.phase * 0x800 / 1125;
|
||||
effect.u.periodic.envelope.attack_length = params->envelope.attack_time;
|
||||
|
@ -1172,7 +1172,7 @@ static NTSTATUS lnxev_device_physical_effect_update(struct unix_device *iface, B
|
|||
break;
|
||||
|
||||
case PID_USAGE_ET_CONSTANT_FORCE:
|
||||
effect.u.constant.level = params->constant_force.magnitude;
|
||||
effect.u.constant.level = (params->constant_force.magnitude * params->gain_percent) / 100;
|
||||
effect.u.constant.envelope.attack_length = params->envelope.attack_time;
|
||||
effect.u.constant.envelope.attack_level = params->envelope.attack_level;
|
||||
effect.u.constant.envelope.fade_length = params->envelope.fade_time;
|
||||
|
@ -1180,8 +1180,8 @@ static NTSTATUS lnxev_device_physical_effect_update(struct unix_device *iface, B
|
|||
break;
|
||||
|
||||
case PID_USAGE_ET_RAMP:
|
||||
effect.u.ramp.start_level = params->ramp_force.ramp_start;
|
||||
effect.u.ramp.end_level = params->ramp_force.ramp_end;
|
||||
effect.u.ramp.start_level = (params->ramp_force.ramp_start * params->gain_percent) / 100;
|
||||
effect.u.ramp.end_level = (params->ramp_force.ramp_end * params->gain_percent) / 100;
|
||||
effect.u.ramp.envelope.attack_length = params->envelope.attack_time;
|
||||
effect.u.ramp.envelope.attack_level = params->envelope.attack_level;
|
||||
effect.u.ramp.envelope.fade_length = params->envelope.fade_time;
|
||||
|
|
|
@ -487,6 +487,7 @@ struct pid_effect_update
|
|||
UINT16 trigger_repeat_interval;
|
||||
UINT16 sample_period;
|
||||
UINT16 start_delay;
|
||||
BYTE gain_percent;
|
||||
BYTE trigger_button;
|
||||
BYTE enable_bits;
|
||||
UINT16 direction[2];
|
||||
|
@ -909,6 +910,13 @@ BOOL hid_device_add_physical(struct unix_device *iface, USAGE *usages, USHORT co
|
|||
UNIT_EXPONENT(1, 0),
|
||||
UNIT(1, 0), /* None */
|
||||
|
||||
USAGE(1, PID_USAGE_GAIN),
|
||||
LOGICAL_MINIMUM(1, 0),
|
||||
LOGICAL_MAXIMUM(1, 100),
|
||||
REPORT_SIZE(1, 8),
|
||||
REPORT_COUNT(1, 1),
|
||||
OUTPUT(1, Data|Var|Abs|Null),
|
||||
|
||||
USAGE(1, PID_USAGE_TRIGGER_BUTTON),
|
||||
LOGICAL_MINIMUM(1, 0),
|
||||
LOGICAL_MAXIMUM(2, state->button_count),
|
||||
|
@ -1181,6 +1189,7 @@ static void hid_device_set_output_report(struct unix_device *iface, HID_XFER_PAC
|
|||
params->trigger_repeat_interval = report->trigger_repeat_interval;
|
||||
params->sample_period = report->sample_period;
|
||||
params->start_delay = report->start_delay;
|
||||
params->gain_percent = report->gain_percent;
|
||||
params->trigger_button = report->trigger_button == 0xff ? 0 : report->trigger_button;
|
||||
params->axis_enabled[0] = (report->enable_bits & 1) != 0;
|
||||
params->axis_enabled[1] = (report->enable_bits & 2) != 0;
|
||||
|
|
|
@ -78,6 +78,7 @@ struct effect_params
|
|||
BOOL axis_enabled[2];
|
||||
BOOL direction_enabled;
|
||||
UINT16 direction[2];
|
||||
BYTE gain_percent;
|
||||
BYTE condition_count;
|
||||
/* only for periodic, constant or ramp forces */
|
||||
struct effect_envelope envelope;
|
||||
|
|
Loading…
Reference in New Issue