From 1b9e5c61a6f1d595969162ba86526bcddb0dc1f9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 26 Oct 2014 03:37:42 -0400 Subject: Add gamepad config for PS4 DualShock 4. Thanks to Matt Davis (3nT) for providing a detailed report for this gamepad. --- src/setup/joystick.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/setup') diff --git a/src/setup/joystick.c b/src/setup/joystick.c index f723fd13..49931312 100644 --- a/src/setup/joystick.c +++ b/src/setup/joystick.c @@ -156,6 +156,22 @@ static const joystick_config_t ps3_controller[] = {NULL, 0}, }; +// Playstation 4 Dual Shock 4 (DS4) +static const joystick_config_t ps4_ds4_controller[] = +{ + {"joystick_x_axis", CREATE_HAT_AXIS(0, HAT_AXIS_HORIZONTAL)}, + {"joystick_y_axis", CREATE_HAT_AXIS(0, HAT_AXIS_VERTICAL)}, + {"joyb_fire", 0}, // Square + {"joyb_speed", 1}, // X + {"joyb_use", 2}, // Circle + {"joyb_jump", 3}, // Triangle + {"joyb_strafeleft", 6}, // Bottom shoulder buttons + {"joyb_straferight", 7}, + {"joyb_prevweapon", 4}, // Top shoulder buttons + {"joyb_nextweapon", 5}, + {"joyb_menu_activate", 12}, // Playstation logo button +}; + static const joystick_config_t airflo_controller[] = { {"joystick_x_axis", CREATE_HAT_AXIS(0, HAT_AXIS_HORIZONTAL)}, @@ -332,6 +348,15 @@ static const known_joystick_t known_joysticks[] = 2, 8, 0, buffalo_classic_controller, }, + + // PS4 controller just appears as the generic-sounding "Wireless + // Controller". Hopefully the number of buttons/axes/hats should be + // enough to distinguish it from other gamepads. + { + "Wireless Controller", + 6, 14, 1, + ps4_ds4_controller, + }, }; static const known_joystick_t *GetJoystickType(int index) -- cgit v1.2.3