Skip to content

5.f Controller | Configurate a Switch Pro Controller

Maschell edited this page Apr 23, 2017 · 2 revisions

Overview

The controller patcher engine has built in support for Switch Pro Controller.

Default button mapping

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

Gamepad A                   =   Switch Pro A Button
Gamepad B                   =   Switch Pro B Button
Gamepad X                   =   Switch Pro X Button
Gamepad Y                   =   Switch Pro Y Button

Gamepad DPAD                =   Switch Pro DPAD
Gamepad left stick          =   Switch Pro left stick
Gamepad right stick         =   Switch Pro right stick

Gamepad Plus                =   Switch Pro PLUS
Gamepad Minus               =   Switch Pro MINUS
Gamepad Home                =   Switch Pro Home

Gamepad L                   =   Switch Pro L
Gamepad R                   =   Switch Pro R

Gamepad ZL                  =   Switch Pro ZL
Gamepad ZR                  =   Switch Pro ZR

Gamepad Left stick press    =   Switch Pro Left Stick Press
Gamepad right stick press   =   Switch Pro RightStick Press

Configfile

Identify line

The vid of the XInput is "0x57e", the pid "0x2009". The identify is this:

[vid=0x57e,pid=0x2009]

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 XInput Buttons:

//Buttons
Switch Pro A            =   SWITCH_PRO_BUTTON_A
Switch Pro B            =   SWITCH_PRO_BUTTON_B
Switch Pro X            =   SWITCH_PRO_BUTTON_X
Switch Pro Y            =   SWITCH_PRO_BUTTON_Y
Switch Pro Plus         =   SWITCH_PRO_BUTTON_PLUS
Switch Pro Minus        =   SWITCH_PRO_BUTTON_MINUS
Switch Pro Home         =   SWITCH_PRO_BUTTON_HOME

//DPAD
Switch Pro DPAD N       =   SWITCH_PRO_BUTTON_DPAD_N
Switch Pro DPAD NE      =   SWITCH_PRO_BUTTON_DPAD_NE
Switch Pro DPAD E       =   SWITCH_PRO_BUTTON_DPAD_E
Switch Pro DPAD SE      =   SWITCH_PRO_BUTTON_DPAD_SE
Switch Pro DPAD S       =   SWITCH_PRO_BUTTON_DPAD_S
Switch Pro DPAD SW      =   SWITCH_PRO_BUTTON_DPAD_SW
Switch Pro DPAD W       =   SWITCH_PRO_BUTTON_DPAD_W
Switch Pro DPAD NW      =   SWITCH_PRO_BUTTON_DPAD_NW
Switch Pro DPAD Neutral =   SWITCH_PRO_BUTTON_DPAD_NEUTRAL

//Trigger
Switch Pro L            =   SWITCH_PRO_BUTTON_L
Switch Pro ZL           =   SWITCH_PRO_BUTTON_ZL
Switch Pro L3           =   SWITCH_PRO_BUTTON_STICK_L

Switch Pro R            =   SWITCH_PRO_BUTTON_R
Switch Pro RZ           =   SWITCH_PRO_BUTTON_ZR
Switch Pro R3           =   SWITCH_PRO_BUTTON_STICK_R

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               =   SWITCH_PRO_DPAD_MODE

Setting the Sticks

The gamepad has two sticks with axis that can be mapped to the XInput 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 Switch Pro Controller has predefines values that can be used.

Switch Pro left stick, X Axis  =   SWITCH_PRO_STICK_L_X
Switch Pro left stick, Y Axis  =   SWITCH_PRO_STICK_L_Y
Switch Pro right stick, X Axis =   SWITCH_PRO_STICK_R_X
Switch Pro right stick, Y Axis =   SWITCH_PRO_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 Switch Pro controller sticks:

Switch Pro left stick, X Axis     =       Neutral: 0x80, Min: 0x28, Max: 0xDF, Deadzone: 0x01, inverted: no
Switch Pro left stick, Y Axis     =       Neutral: 0x80, Min: 0x16, Max: 0xD7, Deadzone: 0x06, inverted: yes
Switch Pro right stick, X Axis    =       Neutral: 0x80, Min: 0x29, Max: 0xE2, Deadzone: 0x04, inverted: no
Switch Pro right stick, Y Axis    =       Neutral: 0x80, Min: 0x22, Max: 0xE4, Deadzone: 0x08, 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=0x57e,pid=0x2009]
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=0x57e,pid=0x2009]
VPAD_R_STICK_Y_INVERT      =   no

Example 3

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

[vid=0x57e,pid=0x2009]
[IgnoreDefault] //Ignoring the built in default values
VPAD_BUTTON_A               = SWITCH_PRO_BUTTON_A
VPAD_BUTTON_B               = SWITCH_PRO_BUTTON_B
VPAD_BUTTON_X               = SWITCH_PRO_BUTTON_X
VPAD_BUTTON_Y               = SWITCH_PRO_BUTTON_Y

VPAD_BUTTON_PLUS            = SWITCH_PRO_BUTTON_PLUS
VPAD_BUTTON_MINUS           = SWITCH_PRO_BUTTON_MINUS
VPAD_BUTTON_HOME            = SWITCH_PRO_BUTTON_HOME

VPAD_BUTTON_L               = SWITCH_PRO_BUTTON_L
VPAD_BUTTON_R               = SWITCH_PRO_BUTTON_R

VPAD_BUTTON_STICK_L         = SWITCH_PRO_BUTTON_STICK_L
VPAD_BUTTON_STICK_R         = SWITCH_PRO_BUTTON_STICK_R

VPAD_BUTTON_ZL              = SWITCH_PRO_BUTTON_ZL
VPAD_BUTTON_ZR              = SWITCH_PRO_BUTTON_ZR

DPAD_MODE                   = SWITCH_PRO_DPAD_MODE
VPAD_BUTTON_DPAD_N          = SWITCH_PRO_BUTTON_DPAD_N
VPAD_BUTTON_DPAD_NE         = SWITCH_PRO_BUTTON_DPAD_NE
VPAD_BUTTON_DPAD_E          = SWITCH_PRO_BUTTON_DPAD_E
VPAD_BUTTON_DPAD_SE         = SWITCH_PRO_BUTTON_DPAD_SE
VPAD_BUTTON_DPAD_S          = SWITCH_PRO_BUTTON_DPAD_S
VPAD_BUTTON_DPAD_SW         = SWITCH_PRO_BUTTON_DPAD_SW
VPAD_BUTTON_DPAD_W          = SWITCH_PRO_BUTTON_DPAD_W
VPAD_BUTTON_DPAD_NW         = SWITCH_PRO_BUTTON_DPAD_NW
VPAD_BUTTON_DPAD_Neutral    = SWITCH_PRO_BUTTON_DPAD_NEUTRAL

VPAD_L_STICK_X              = SWITCH_PRO_STICK_L_X
VPAD_L_STICK_Y              = SWITCH_PRO_STICK_L_Y
VPAD_R_STICK_X              = SWITCH_PRO_STICK_R_X
VPAD_R_STICK_Y              = SWITCH_PRO_STICK_R_Y
//This device is no adapter that can't have more than 1 pads.
PAD_COUNT                   =   0x01