fix gyro-to-analogs
This commit is contained in:
parent
f4a4efd201
commit
34ba98d12d
2 changed files with 12 additions and 12 deletions
12
virt_ds4.c
12
virt_ds4.c
|
|
@ -821,22 +821,22 @@ void virt_dualshock_compose(virt_dualshock_t *const gamepad, gamepad_status_t *c
|
|||
(in_device_status->r1 ? 0x02 : 0x00) |
|
||||
(in_device_status->l1 ? 0x01 : 0x00);
|
||||
|
||||
if (contrib_y > gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (contrib_y >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (absolute_value(contrib_x) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[1] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[3] - (int64_t)127) + contrib_x), 0, 255);
|
||||
out_shifted_buf[1] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[1] - (int64_t)127) + contrib_x), 0, 255);
|
||||
}
|
||||
|
||||
if (absolute_value(contrib_y) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[2] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[4] - (int64_t)127) + contrib_y), 0, 255);
|
||||
if (absolute_value(contrib_y) >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[2] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[2] - (int64_t)127) + contrib_y), 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_device_status->join_right_analog_and_gyroscope) {
|
||||
if (absolute_value(contrib_x) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (absolute_value(contrib_x) >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[3] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[3] - (int64_t)127) + contrib_x), 0, 255);
|
||||
}
|
||||
|
||||
if (absolute_value(contrib_y) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (absolute_value(contrib_y) >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[4] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[4] - (int64_t)127) + contrib_y), 0, 255);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
virt_ds5.c
12
virt_ds5.c
|
|
@ -1477,22 +1477,22 @@ void virt_dualsense_compose(virt_dualsense_t *const gamepad, gamepad_status_t *c
|
|||
out_shifted_buf[3] = ((uint64_t)((int64_t)in_device_status->joystick_positions[1][0] + (int64_t)32768) >> (uint64_t)8); // R stick, X axis
|
||||
out_shifted_buf[4] = ((uint64_t)((int64_t)in_device_status->joystick_positions[1][1] + (int64_t)32768) >> (uint64_t)8); // R stick, Y axis
|
||||
|
||||
if (contrib_y > gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (contrib_y >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (absolute_value(contrib_x) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[1] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[3] - (int64_t)127) + contrib_x), 0, 255);
|
||||
out_shifted_buf[1] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[1] - (int64_t)127) + contrib_x), 0, 255);
|
||||
}
|
||||
|
||||
if (absolute_value(contrib_y) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[2] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[4] - (int64_t)127) + contrib_y), 0, 255);
|
||||
if (absolute_value(contrib_y) >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[2] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[2] - (int64_t)127) + contrib_y), 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_device_status->join_right_analog_and_gyroscope) {
|
||||
if (absolute_value(contrib_x) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (absolute_value(contrib_x) >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[3] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[3] - (int64_t)127) + contrib_x), 0, 255);
|
||||
}
|
||||
|
||||
if (absolute_value(contrib_y) > gamepad->gyro_to_analog_activation_treshold) {
|
||||
if (absolute_value(contrib_y) >= gamepad->gyro_to_analog_activation_treshold) {
|
||||
out_shifted_buf[4] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[4] - (int64_t)127) + contrib_y), 0, 255);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue