Skip to content

Commit

Permalink
Proper L2/R2 and L3/R3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
xerpi committed Apr 2, 2017
1 parent b947e50 commit 8434bda
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,20 @@ static void set_input_emulation(struct ds4_input_report *ds4)
if (ds4->dpad == 5 || ds4->dpad == 6 || ds4->dpad == 7)
buttons |= SCE_CTRL_LEFT;

if (ds4->l1 || ds4->l2)
buttons |= (SCE_CTRL_L1 | SCE_CTRL_LTRIGGER);
if (ds4->r1 || ds4->r2)
buttons |= (SCE_CTRL_R1 | SCE_CTRL_RTRIGGER);
if (ds4->l1)
buttons |= SCE_CTRL_L1;
if (ds4->r1)
buttons |= SCE_CTRL_R1;

if (ds4->l2)
buttons |= SCE_CTRL_LTRIGGER;
if (ds4->r2)
buttons |= SCE_CTRL_RTRIGGER;

if (ds4->l3)
buttons |= SCE_CTRL_L3;
if (ds4->r3)
buttons |= SCE_CTRL_R3;

if (ds4->share)
buttons |= SCE_CTRL_SELECT;
Expand All @@ -250,7 +260,7 @@ static void set_input_emulation(struct ds4_input_report *ds4)
js_moved = 1;
}

ksceCtrlSetButtonEmulation(0, 0, buttons, buttons | 0x10000000, 32);
ksceCtrlSetButtonEmulation(0, 0, buttons, buttons, 32);

ksceCtrlSetAnalogEmulation(0, 0, ds4->left_x, ds4->left_y,
ds4->right_x, ds4->right_y, ds4->left_x, ds4->left_y,
Expand Down

0 comments on commit 8434bda

Please sign in to comment.