diff options
Diffstat (limited to 'src/setup')
-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) |