diff options
author | Simon Howard | 2014-10-26 03:37:42 -0400 |
---|---|---|
committer | Simon Howard | 2014-10-26 03:37:42 -0400 |
commit | 1b9e5c61a6f1d595969162ba86526bcddb0dc1f9 (patch) | |
tree | 819d2797643ee5ee7a206a0357f2ec20a7bf3729 | |
parent | d91383ee4057a2fc6fc2fb80144abb34273a6d7f (diff) | |
download | chocolate-doom-1b9e5c61a6f1d595969162ba86526bcddb0dc1f9.tar.gz chocolate-doom-1b9e5c61a6f1d595969162ba86526bcddb0dc1f9.tar.bz2 chocolate-doom-1b9e5c61a6f1d595969162ba86526bcddb0dc1f9.zip |
Add gamepad config for PS4 DualShock 4.
Thanks to Matt Davis (3nT) for providing a detailed report for this
gamepad.
-rw-r--r-- | src/setup/joystick.c | 25 |
1 files changed, 25 insertions, 0 deletions
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) |