From b90bb4318d89eebed58707d0089c8237ee4e83fb Mon Sep 17 00:00:00 2001 From: denizk0461 Date: Fri, 9 May 2025 16:28:50 +0200 Subject: [PATCH] Added D-Pad support --- ps2-arduino.ino | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ps2-arduino.ino b/ps2-arduino.ino index b9c5fec..8c4b626 100644 --- a/ps2-arduino.ino +++ b/ps2-arduino.ino @@ -169,6 +169,40 @@ void loop() { XInput.release(BUTTON_R3); } + // D-Pad + // D-Left + if (ps2x.ButtonPressed(PSB_PAD_LEFT)) { + XInput.press(DPAD_LEFT); + } + + if (ps2x.ButtonReleased(PSB_PAD_LEFT)) { + XInput.release(DPAD_LEFT); + } + // D-Right + if (ps2x.ButtonPressed(PSB_PAD_RIGHT)) { + XInput.press(DPAD_RIGHT); + } + + if (ps2x.ButtonReleased(PSB_PAD_RIGHT)) { + XInput.release(DPAD_RIGHT); + } + // D-Up + if (ps2x.ButtonPressed(PSB_PAD_UP)) { + XInput.press(DPAD_UP); + } + + if (ps2x.ButtonReleased(PSB_PAD_UP)) { + XInput.release(DPAD_UP); + } + // D-Down + if (ps2x.ButtonPressed(PSB_PAD_DOWN)) { + XInput.press(DPAD_DOWN); + } + + if (ps2x.ButtonReleased(PSB_PAD_DOWN)) { + XInput.release(DPAD_DOWN); + } + // Left stick XInput.setJoystick(JOY_LEFT, ps2x.Analog(PSS_LX), 255 - ps2x.Analog(PSS_LY));