I got indexes wrong... ofc.
This commit is contained in:
parent
6572e07bcb
commit
479b671733
1 changed files with 12 additions and 12 deletions
24
virt_ds5.c
24
virt_ds5.c
|
|
@ -1449,19 +1449,19 @@ void virt_dualsense_compose(virt_dualsense_t *const gamepad, gamepad_status_t *c
|
|||
const int64_t joint_y = (int64_t)in_device_status->joystick_positions[0][1] + (int64_t)g_y;
|
||||
|
||||
if (joint_x <= (int64_t)(-32768)) {
|
||||
out_shifted_buf[0] = 0x00;
|
||||
out_shifted_buf[1] = 0x00;
|
||||
} else if (joint_x >= (int64_t)(+32767)) {
|
||||
out_shifted_buf[0] = 0xFF;
|
||||
out_shifted_buf[1] = 0xFF;
|
||||
} else {
|
||||
out_shifted_buf[0] = ((uint64_t)(joint_x + (int64_t)32768) >> (uint64_t)8);
|
||||
out_shifted_buf[1] = ((uint64_t)(joint_x + (int64_t)32768) >> (uint64_t)8);
|
||||
}
|
||||
|
||||
if (joint_y <= (int64_t)(-32768)) {
|
||||
out_shifted_buf[1] = 0x00;
|
||||
out_shifted_buf[2] = 0x00;
|
||||
} else if (joint_y >= (int64_t)(+32767)) {
|
||||
out_shifted_buf[1] = 0xFF;
|
||||
out_shifted_buf[2] = 0xFF;
|
||||
} else {
|
||||
out_shifted_buf[1] = ((uint64_t)(joint_y + (int64_t)32768) >> (uint64_t)8);
|
||||
out_shifted_buf[2] = ((uint64_t)(joint_y + (int64_t)32768) >> (uint64_t)8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1470,19 +1470,19 @@ void virt_dualsense_compose(virt_dualsense_t *const gamepad, gamepad_status_t *c
|
|||
const int64_t joint_y = /*(int64_t)in_device_status->joystick_positions[1][1]*/ + (int64_t)g_y;
|
||||
|
||||
if (joint_x <= (int64_t)(-32768)) {
|
||||
out_shifted_buf[2] = 0x00;
|
||||
out_shifted_buf[3] = 0x00;
|
||||
} else if (joint_x >= (int64_t)(+32767)) {
|
||||
out_shifted_buf[2] = 0xFF;
|
||||
out_shifted_buf[3] = 0xFF;
|
||||
} else {
|
||||
out_shifted_buf[2] = ((uint64_t)(joint_x + (int64_t)32768) >> (uint64_t)8);
|
||||
out_shifted_buf[3] = ((uint64_t)(joint_x + (int64_t)32768) >> (uint64_t)8);
|
||||
}
|
||||
|
||||
if (joint_y <= (int64_t)(-32768)) {
|
||||
out_shifted_buf[3] = 0x00;
|
||||
out_shifted_buf[4] = 0x00;
|
||||
} else if (joint_y >= (int64_t)(+32767)) {
|
||||
out_shifted_buf[3] = 0xFF;
|
||||
out_shifted_buf[4] = 0xFF;
|
||||
} else {
|
||||
out_shifted_buf[3] = ((uint64_t)(joint_y + (int64_t)32768) >> (uint64_t)8);
|
||||
out_shifted_buf[4] = ((uint64_t)(joint_y + (int64_t)32768) >> (uint64_t)8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue