Skip to content

Commit

Permalink
[ADAPTER] Fix issues in wired PS module
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Sep 14, 2024
1 parent 072b091 commit aae7331
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions main/adapter/wired/ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void ps_meta_init(struct wired_ctrl *ctrl_data) {
ctrl_data[i].desc = ps_kb_desc;
goto exit_axes_loop;
case DEV_MOUSE:
if (i >= PS_JOYSTICK_AXES_CNT) {
if (j >= PS_JOYSTICK_AXES_CNT) {
goto exit_axes_loop;
}
ctrl_data[i].mask = ps_mouse_mask;
Expand Down Expand Up @@ -280,13 +280,15 @@ static void ps_ctrl_from_generic(struct wired_ctrl *ctrl_data, struct wired_data
map_tmp.axes[ps_axes_idx[i]] = (uint8_t)(ctrl_data->axes[i].value + ctrl_data->axes[i].meta->neutral);
}

if (i >= PS_JOYSTICK_AXES_CNT && map_tmp.axes[ps_axes_idx[i]]) {
map_tmp.buttons &= ~ps_btns_mask[btn_id];;
wired_data->cnt_mask[btn_id] = ctrl_data->btns[0].cnt_mask[btn_id];
}
else {
map_tmp.buttons |= ps_btns_mask[btn_id];
wired_data->cnt_mask[btn_id] = 0;
if (i >= PS_JOYSTICK_AXES_CNT) {
if (map_tmp.axes[ps_axes_idx[i]]) {
map_tmp.buttons &= ~ps_btns_mask[btn_id];;
wired_data->cnt_mask[btn_id] = ctrl_data->btns[0].cnt_mask[btn_id];
}
else {
map_tmp.buttons |= ps_btns_mask[btn_id];
wired_data->cnt_mask[btn_id] = 0;
}
}
}
wired_data->cnt_mask[btn_id] = ctrl_data->axes[i].cnt_mask;
Expand Down

0 comments on commit aae7331

Please sign in to comment.