From f6decd1484c0b3a1d30ac3480cf48f8f4690f6a9 Mon Sep 17 00:00:00 2001 From: Revise0592 Date: Tue, 21 Jul 2026 21:29:59 +0100 Subject: [PATCH] Fix PS3 trigger and face-button analog axes PS3Device::process() set the L2/R2 digital button bits from gp_in.trigger_l/trigger_r but never wrote report_in_.l2_axis/r2_axis, so the analog pressure value for both triggers was always 0. Games that read trigger pressure instead of (or in addition to) the digital bit never saw a real throttle/brake input. Separately, the digital-only face-button fallback in PS3.cpp (used whenever the host controller doesn't report analog buttons, e.g. a standard XInput pad) and the analog-enabled path in DInput.cpp both had circle/cross/square axes rotated onto the wrong physical buttons, while the digital bits and PS3's own analog-enabled path were correct. Practically: pressing B (Xbox) correctly set the Circle digital bit, but wrote its pressure value into cross_axis instead of circle_axis. Tested on hardware (Pi Pico, PS3 output mode): MotorStorm and Driver: San Francisco, both previously broken (no throttle/brake, wrong face-button actions), now behave correctly. Minecraft: PS3 Edition, which already worked before this fix, is unaffected. Fixes #164, Fixes #142 Relates to #68, #127 --- .../RP2040/src/USBDevice/DeviceDriver/DInput/DInput.cpp | 6 +++--- Firmware/RP2040/src/USBDevice/DeviceDriver/PS3/PS3.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Firmware/RP2040/src/USBDevice/DeviceDriver/DInput/DInput.cpp b/Firmware/RP2040/src/USBDevice/DeviceDriver/DInput/DInput.cpp index 05073d03..73c0fdad 100644 --- a/Firmware/RP2040/src/USBDevice/DeviceDriver/DInput/DInput.cpp +++ b/Firmware/RP2040/src/USBDevice/DeviceDriver/DInput/DInput.cpp @@ -103,9 +103,9 @@ void DInputDevice::process(const uint8_t idx, Gamepad& gamepad) in_report.left_axis = gp_in.analog[Gamepad::ANALOG_OFF_LEFT]; in_report.triangle_axis = gp_in.analog[Gamepad::ANALOG_OFF_Y]; - in_report.circle_axis = gp_in.analog[Gamepad::ANALOG_OFF_X]; - in_report.cross_axis = gp_in.analog[Gamepad::ANALOG_OFF_B]; - in_report.square_axis = gp_in.analog[Gamepad::ANALOG_OFF_A]; + in_report.circle_axis = gp_in.analog[Gamepad::ANALOG_OFF_B]; + in_report.cross_axis = gp_in.analog[Gamepad::ANALOG_OFF_A]; + in_report.square_axis = gp_in.analog[Gamepad::ANALOG_OFF_X]; in_report.r1_axis = gp_in.analog[Gamepad::ANALOG_OFF_RB]; in_report.l1_axis = gp_in.analog[Gamepad::ANALOG_OFF_LB]; diff --git a/Firmware/RP2040/src/USBDevice/DeviceDriver/PS3/PS3.cpp b/Firmware/RP2040/src/USBDevice/DeviceDriver/PS3/PS3.cpp index c070b5d1..40a52c8a 100644 --- a/Firmware/RP2040/src/USBDevice/DeviceDriver/PS3/PS3.cpp +++ b/Firmware/RP2040/src/USBDevice/DeviceDriver/PS3/PS3.cpp @@ -71,6 +71,9 @@ void PS3Device::process(const uint8_t idx, Gamepad& gamepad) if (gp_in.trigger_l) report_in_.buttons[1] |= PS3::Buttons1::L2; if (gp_in.trigger_r) report_in_.buttons[1] |= PS3::Buttons1::R2; + report_in_.l2_axis = gp_in.trigger_l; + report_in_.r2_axis = gp_in.trigger_r; + report_in_.joystick_lx = Scale::int16_to_uint8(gp_in.joystick_lx); report_in_.joystick_ly = Scale::int16_to_uint8(gp_in.joystick_ly); report_in_.joystick_rx = Scale::int16_to_uint8(gp_in.joystick_rx); @@ -99,9 +102,9 @@ void PS3Device::process(const uint8_t idx, Gamepad& gamepad) report_in_.left_axis = (gp_in.dpad & Gamepad::DPAD_LEFT) ? 0xFF : 0; report_in_.triangle_axis = (gp_in.buttons & Gamepad::BUTTON_Y) ? 0xFF : 0; - report_in_.circle_axis = (gp_in.buttons & Gamepad::BUTTON_X) ? 0xFF : 0; - report_in_.cross_axis = (gp_in.buttons & Gamepad::BUTTON_B) ? 0xFF : 0; - report_in_.square_axis = (gp_in.buttons & Gamepad::BUTTON_A) ? 0xFF : 0; + report_in_.circle_axis = (gp_in.buttons & Gamepad::BUTTON_B) ? 0xFF : 0; + report_in_.cross_axis = (gp_in.buttons & Gamepad::BUTTON_A) ? 0xFF : 0; + report_in_.square_axis = (gp_in.buttons & Gamepad::BUTTON_X) ? 0xFF : 0; report_in_.r1_axis = (gp_in.buttons & Gamepad::BUTTON_RB) ? 0xFF : 0; report_in_.l1_axis = (gp_in.buttons & Gamepad::BUTTON_LB) ? 0xFF : 0;