Skip to content

5.c Controller | Configurate the Dualshock 4 controller

Maschell edited this page Apr 23, 2017 · 10 revisions

Overview

The controller patcher engine has built in support for the offical Dualshock 4 controller for the Playstation 4. They need to connect it via USB. Caution, the new model of the Dualshock 4 Controller is not supported via USB. Use the Network Client.

Default button mapping

When you provide no config file, the following button mapping will be used:

Gamepad A                   =   DS4 circle button
Gamepad B                   =   DS4 cross button
Gamepad X                   =   DS4 triangle button
Gamepad Y                   =   DS4 square button

Gamepad DPAD                =   DS4 Dpad
Gamepad left stick          =   DS4 left stick
Gamepad right stick         =   DS4 right stick

Gamepad Plus                =   DS4 Share button
Gamepad Minus               =   DS4 Options button

Gamepad L                   =   DS4 L1
Gamepad R                   =   DS4 R1

Gamepad ZL                  =   DS4 L2 button
Gamepad ZR                  =   DS4 R2 button

Gamepad Left stick press    =   DS4 L3 (left stick press)
Gamepad right stick press   =   DS4 R3 (right stick press)

Configfile

Identify line

The vid of the dualshock 4 is "0x054c", the pid "0x05c4". The identify is this:

[vid=0x054c,pid=0x05c4]

Ignoring default values

You can either complety overwrite the default configuration or just modifying parts of it. When you put the following as the **second **line in the config, the default values will be ignored.

[IgnoreDefault]

Configuration

Setting the buttons

Like metioned earlier in this wiki, the built in controller have an "easy" way to map the buttons and sticks. The following buttons and trigger can be mapped:

Buttons:
A                   =   VPAD_BUTTON_A
B                   =   VPAD_BUTTON_B
X                   =   VPAD_BUTTON_X
Y                   =   VPAD_BUTTON_Y
Plus                =   VPAD_BUTTON_PLUS
Minus               =   VPAD_BUTTON_MINUS
Home                =   VPAD_BUTTON_HOME
Sync                =   VPAD_BUTTON_SYNC
TV                  =   VPAD_BUTTON_TV

DPAD:
DPAD left           =   VPAD_BUTTON_LEFT
DPAD left           =   VPAD_BUTTON_RIGHT
DPAD left           =   VPAD_BUTTON_UP
DPAD left           =   VPAD_BUTTON_DOWN

Trigger:
ZR                  =   VPAD_BUTTON_ZR
ZL                  =   VPAD_BUTTON_ZL
L                   =   VPAD_BUTTON_L
R                   =   VPAD_BUTTON_R

Sticks:
Stick press left    =   VPAD_BUTTON_STICK_L
Stick press right   =   VPAD_BUTTON_STICK_R

These can be mapped to the following DS4 Buttons:

//Buttons
DS4 Cross            =   DS4_BUTTON_CROSS
DS4 Circle           =   DS4_BUTTON_CIRCLE
DS4 Square           =   DS4_BUTTON_SQUARE
DS4 Triangle         =   DS4_BUTTON_TRIANGLE
DS4 Start            =   DS4_BUTTON_START
DS4 Select           =   DS4_BUTTON_SELECT
DS4 Guide button     =   DS4_BUTTON_GUIDE
DS4 Touchpad click   =   DS4_BUTTON_T_PAD_CLICK

//DPAD
DS4 DPAD N           =   DS4_BUTTON_DPAD_N
DS4 DPAD NE          =   DS4_BUTTON_DPAD_NE
DS4 DPAD E           =   DS4_BUTTON_DPAD_E
DS4 DPAD SE          =   DS4_BUTTON_DPAD_SE
DS4 DPAD S           =   DS4_BUTTON_DPAD_S
DS4 DPAD SW          =   DS4_BUTTON_DPAD_SW
DS4 DPAD W           =   DS4_BUTTON_DPAD_W
DS4 DPAD NW          =   DS4_BUTTON_DPAD_NW

//Trigger
DS4 L1               =   DS4_BUTTON_L1
DS4 L2               =   DS4_BUTTON_L2
DS4 L3               =   DS4_BUTTON_L3

DS4 R1               =   DS4_BUTTON_R1
DS4 R2               =   DS4_BUTTON_R2
DS4 R3               =   DS4_BUTTON_R3

Setting the DPAD

In order to able to use the DPAD in config, the dpad mode needs to be set. The a predefined value that can be used.

DPAD_MODE        =   DS4_DPAD_MODE

Setting the Sticks

The gamepad has two sticks with axis that can be mapped to the dualshock controller:

Gamepad left stick, X Axis      =   VPAD_BUTTON_L_STICK_X
Gamepad left stick, Y Axis      =   VPAD_BUTTON_L_STICK_Y
Gamepad right stick, X Axis     =   VPAD_BUTTON_R_STICK_X
Gamepad right stick, Y Axis     =   VPAD_BUTTON_R_STICK_Y

The dualshock controller has predefines values that can be used.

Dualshock 4 left stick, X Axis  =   DS4_STICK_L_X
Dualshock 4 left stick, Y Axis  =   DS4_STICK_L_Y
Dualshock 4 right stick, X Axis =   DS4_STICK_R_X
Dualshock 4 right stick, Y Axis =   DS4_STICK_R_Y

Default Stick Values

Each axis of each stick has his own neutral/min/max value,deadzone and can be inverted. These are the default values for the DS4 controller sticks:

Dualshock 4 left stick, X Axis     =       Neutral: 0x80, Min: 0x00, Max: 0xFF, Deadzone: 0x06, inverted: no
Dualshock 4 left stick, Y Axis     =       Neutral: 0x80, Min: 0x00, Max: 0xFF, Deadzone: 0x05, inverted: yes
Dualshock 4 right stick, X Axis    =       Neutral: 0x80, Min: 0x00, Max: 0xFF, Deadzone: 0x07, inverted: no
Dualshock 4 right stick, Y Axis    =       Neutral: 0x80, Min: 0x00, Max: 0xFF, Deadzone: 0x09, inverted: yes

Adjusting Stick values

Each value (exept the neutral postision) can be adjusting through the config file. NOTE: When you use the VPAD_BUTTON_L_STICK_X, VPAD_BUTTON_L_STICK_Y, VPAD_BUTTON_R_STICK_X, VPAD_BUTTON_R_STICK_Y to change/set the sticks, use the following options only AFTER them.


To change the value for the min/max value use a line simliar like this:

VPAD_L_STICK_X_MINMAX        =   0x01,0xFE

In this example you would change the values of left stick X axis. The min value is set to 0x01, the max value to 0xFE. This works similar for other gamepad sticks/axis


To change the value for the deadzone use a line simliar like this:

VPAD_L_STICK_X_DEADZONE      =   0x07

In this example you would change the deadzone of left stick X axis. The deadzone is set to 0x09.


To change the value for the deadzone use a line simliar like this:

VPAD_L_STICK_X_INVERT       =   true

In this example you would invert the left stick X axis. When you don't want to invert it, you can set the value to "no" or "false".


Examples

Example 1

Keeping the default settings, just adjust the deadzones of left stick.

[vid=0x054c,pid=0x05c4]
VPAD_L_STICK_X_DEADZONE      =   0x10
VPAD_L_STICK_Y_DEADZONE      =   0x11

Example 2

Keeping the default settings, just don't invert the Y axis of right stick.

[vid=0x054c,pid=0x05c4]
VPAD_R_STICK_Y_INVERT      =   no

Example 3

Overwriting the default setting. Loading the default setting completly from the config

[vid=0x054c,pid=0x05c4]
[IgnoreDefault] //Ignoring the built in default values

//Settings buttons 
VPAD_BUTTON_A                   =   DS4_BUTTON_CIRCLE
VPAD_BUTTON_B                   =   DS4_BUTTON_CROSS
VPAD_BUTTON_X                   =   DS4_BUTTON_TRIANGLE
VPAD_BUTTON_Y                   =   DS4_BUTTON_SQUARE
VPAD_BUTTON_MINUS               =   DS4_BUTTON_SELECT
VPAD_BUTTON_PLUS                =   DS4_BUTTON_START

VPAD_BUTTON_STICK_L             =   DS4_BUTTON_L3
VPAD_BUTTON_STICK_R             =   DS4_BUTTON_R3

//Setting dpad
DPAD_MODE                       =   DS4_DPAD_MODE
VPAD_BUTTON_LEFT                =   DS4_BUTTON_LEFT
VPAD_BUTTON_RIGHT               =   DS4_BUTTON_RIGHT
VPAD_BUTTON_UP                  =   DS4_BUTTON_UP
VPAD_BUTTON_DOWN                =   DS4_BUTTON_DOWN

//Setting the sticks
VPAD_L_STICK_X           =   DS4_STICK_L_X
VPAD_L_STICK_Y           =   DS4_STICK_L_Y
VPAD_R_STICK_X           =   DS4_STICK_R_X
VPAD_R_STICK_Y           =   DS4_STICK_R_Y

//Setting the trigger
VPAD_BUTTON_L                   =   DS4_BUTTON_L1
VPAD_BUTTON_ZL                  =   DS4_BUTTON_L2
VPAD_BUTTON_R                   =   DS4_BUTTON_R1
VPAD_BUTTON_ZR                  =   DS4_BUTTON_R2
//This device is no adapter that can't have more than 1 pads.
PAD_COUNT                       =   0x01