fix up gyro-to-analog
This commit is contained in:
parent
dde8b0f152
commit
79fe2cf9dd
1 changed files with 6 additions and 6 deletions
12
virt_ds5.c
12
virt_ds5.c
|
|
@ -1468,16 +1468,16 @@ void virt_dualsense_compose(virt_dualsense_t *const gamepad, gamepad_status_t *c
|
|||
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 (in_device_status->join_left_analog_and_gyroscope) {
|
||||
const int64_t contrib_x = (int64_t)127 + ((int64_t)g_x / (int64_t)4);
|
||||
const int64_t contrib_y = (int64_t)127 + ((int64_t)g_y / (int64_t)4);
|
||||
const int64_t contrib_x = (int64_t)127 + ((int64_t)g_y / (int64_t)4);
|
||||
const int64_t contrib_y = (int64_t)127 + ((int64_t)g_x / (int64_t)4);
|
||||
|
||||
out_shifted_buf[1] = min_max_clamp((int64_t)out_shifted_buf[1] + contrib_x, 0, 255);
|
||||
out_shifted_buf[2] = min_max_clamp((int64_t)out_shifted_buf[2] + contrib_y, 0, 255);
|
||||
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[2] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[4] - (int64_t)127) + contrib_y), 0, 255);
|
||||
}
|
||||
|
||||
if (in_device_status->join_right_analog_and_gyroscope) {
|
||||
const int64_t contrib_x = (int64_t)g_x / (int64_t)4;
|
||||
const int64_t contrib_y = (int64_t)g_y / (int64_t)4;
|
||||
const int64_t contrib_x = (int64_t)g_y / (int64_t)4;
|
||||
const int64_t contrib_y = (int64_t)g_x / (int64_t)4;
|
||||
|
||||
out_shifted_buf[3] = min_max_clamp((int64_t)127 + (((int64_t)out_shifted_buf[3] - (int64_t)127) + contrib_x), 0, 255);
|
||||
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