Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move PS4 TP/Share switch check to getPS4Report #336

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/gamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ void Gamepad::setup()
mapButtonA1 = new GamepadButtonMapping(convertPin(pinMappings.pinButtonA1), GAMEPAD_MASK_A1);
mapButtonA2 = new GamepadButtonMapping(convertPin(pinMappings.pinButtonA2), GAMEPAD_MASK_A2);

uint16_t maskS1 = options.inputMode == INPUT_MODE_PS4
&& options.switchTpShareForDs4 ? GAMEPAD_MASK_A2 : GAMEPAD_MASK_S1;
mapButtonS1 = new GamepadButtonMapping(pinMappings.pinButtonS1, maskS1);

uint16_t maskA2 = options.inputMode == INPUT_MODE_PS4
&& options.switchTpShareForDs4 ? GAMEPAD_MASK_S1 : GAMEPAD_MASK_A2;
mapButtonA2 = new GamepadButtonMapping(pinMappings.pinButtonA2, maskA2);

gamepadMappings = new GamepadButtonMapping *[GAMEPAD_DIGITAL_INPUT_COUNT]
{
mapDpadUp, mapDpadDown, mapDpadLeft, mapDpadRight,
Expand Down Expand Up @@ -511,12 +503,12 @@ PS4Report *Gamepad::getPS4Report()
ps4Report.button_r1 = pressedR1();
ps4Report.button_l2 = pressedL2();
ps4Report.button_r2 = pressedR2();
ps4Report.button_select = pressedS1();
ps4Report.button_select = options.switchTpShareForDs4 ? pressedA2() : pressedS1();
ps4Report.button_start = pressedS2();
ps4Report.button_l3 = pressedL3();
ps4Report.button_r3 = pressedR3();
ps4Report.button_home = pressedA1();
ps4Report.button_touchpad = pressedA2();
ps4Report.button_touchpad = options.switchTpShareForDs4 ? pressedS1() : pressedA2();

// report counter is 6 bits, but we circle 0-255
ps4Report.report_counter = last_report_counter++;
Expand Down