-
Notifications
You must be signed in to change notification settings - Fork 13
4. Keyboards
The controller patcher provides support for USB keyboard. Buttons and sticks of the gamepad can be emulated. In order be write a config file for a keyboard, it must contains the following line as first line (case insensitive):
[Keyboard]
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]
Keyboards can have many different layouts, the predefines values you can are base on an english one. You have to options to provide the key you want the button to be mapped on.
- Using a pre-defined string
- Using the actual value of that button. A list of values can found e.g. here!
If you choose to go the easy way and use one of the predefined values, here is a list of all implemented ones.
KEYBOARD_SHIFT
KEYBOARD_A
KEYBOARD_B
KEYBOARD_C
KEYBOARD_D
KEYBOARD_E
KEYBOARD_F
KEYBOARD_G
KEYBOARD_H
KEYBOARD_I
KEYBOARD_J
KEYBOARD_K
KEYBOARD_L
KEYBOARD_M
KEYBOARD_N
KEYBOARD_O
KEYBOARD_P
KEYBOARD_Q
KEYBOARD_R
KEYBOARD_S
KEYBOARD_T
KEYBOARD_U
KEYBOARD_V
KEYBOARD_W
KEYBOARD_X
KEYBOARD_Y
KEYBOARD_Z
KEYBOARD_F1
KEYBOARD_F2
KEYBOARD_F3
KEYBOARD_F4
KEYBOARD_F5
KEYBOARD_F6
KEYBOARD_F7
KEYBOARD_F8
KEYBOARD_F9
KEYBOARD_F10
KEYBOARD_F11
KEYBOARD_F12
KEYBOARD_1
KEYBOARD_2
KEYBOARD_3
KEYBOARD_4
KEYBOARD_5
KEYBOARD_6
KEYBOARD_7
KEYBOARD_8
KEYBOARD_9
KEYBOARD_0
KEYBOARD_RETURN
KEYBOARD_ESCAPE
KEYBOARD_DELETE
KEYBOARD_TAB
KEYBOARD_SPACEBAR
KEYBOARD_CAPSLOCK
KEYBOARD_PRINTSCREEN
KEYBOARD_SCROLLLOCK
KEYBOARD_PAUSE
KEYBOARD_INSERT
KEYBOARD_HOME
KEYBOARD_PAGEUP
KEYBOARD_PAGEDOWN
KEYBOARD_DELETEFORWARD
KEYBOARD_LEFT_CONTROL
KEYBOARD_LEFT_ALT
KEYBOARD_RIGHT_CONTROL
KEYBOARD_RIGHT_SHIFT
KEYBOARD_RIGHT_ALT
KEYBOARD_END
//Arrowkeys
KEYBOARD_LEFT
KEYBOARD_RIGHT
KEYBOARD_DOWN
KEYBOARD_UP
//Keypad
KEYBOARD_KEYPAD_1
KEYBOARD_KEYPAD_2
KEYBOARD_KEYPAD_3
KEYBOARD_KEYPAD_4
KEYBOARD_KEYPAD_5
KEYBOARD_KEYPAD_6
KEYBOARD_KEYPAD_7
KEYBOARD_KEYPAD_8
KEYBOARD_KEYPAD_9
KEYBOARD_KEYPAD_0
KEYBOARD_KEYPAD_NUMLOCK
KEYBOARD_KEYPAD_MINUS
KEYBOARD_KEYPAD_PLUS
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
To emulate an stick, you have to assign a key to these values.
//Left stick
VPAD_L_STICK_UP
VPAD_L_STICK_DOWN
VPAD_L_STICK_LEFT
VPAD_L_STICK_RIGHT
//Right stick
VPAD_R_STICK_UP
VPAD_R_STICK_DOWN
VPAD_R_STICK_LEFT
VPAD_R_STICK_RIGHT
Gamepad A = Keyboard E
Gamepad B = Keyboard Q
Gamepad X = Keyboard Spacebar
Gamepad Y = Keyboard R
Gamepad DPAD = Keyboard Arrowkeys
Gamepad left stick = Keyboard WSAD
Gamepad right stick = Keyboard keypad (8,2,4,6)
Gamepad Plus = Keyboard Return
Gamepad Minus = Keyboard keypad minus
Gamepad L = Keyboard V
Gamepad R = Keyboard B
Gamepad ZL = Keyboard Shift
Gamepad ZR = Keyboard N
Gamepad Left stick press = Keyboard F
Gamepad right stick press = Keyboard TAB
Here some examples:
Keeping the default button layout, just map "Gamepad A" now on "Keyboard P"
[keyboard]
VPAD_BUTTON_A=KEYBOARD_P
Ignoring the default configuration. Setting the left stick on the arrow keys, "Gamepad Y" to "Keyboard Shift", "Gamepad B" to "Keyboard Spacebar". This could be for example used for mario jump and runs. (R/ZR missing though)
[keyboard]
[IgnoreDefault]
//Setting buttons
VPAD_BUTTON_B = KEYBOARD_SPACEBAR
VPAD_BUTTON_Y = KEYBOARD_SHIFT
//Setting left stick
VPAD_L_STICK_UP = KEYBOARD_KEYPAD_W
VPAD_L_STICK_DOWN = KEYBOARD_KEYPAD_S
VPAD_L_STICK_RIGHT = KEYBOARD_KEYPAD_A
VPAD_L_STICK_LEFT = KEYBOARD_KEYPAD_D