Skip to content

Control mappings

Murza Lein edited this page Jan 9, 2022 · 13 revisions

Genshin Impact uses Rewired as underlying input system. Rewired is using so-called "Controller maps", which are just fancy XMLs with buttons/axis definitions.
It's pretty convenient that all mappings are shown in Genshin's settings after they are added - so you can bind attack to keyboard button, for example, and then rebind it from Genshin Impact in-game settings.

How does it work?

There are a few steps in the chain between player's thought and a game action.

  1. Player presses a button on the controller
  2. Controller's button is translated to element identifier ID
  3. Action element map is being used to match that ID to the action ID
  4. Game receives action ID and does it.

Overrides

Part of the config
"_overrideControllerMapKeyList": [
    "OverrideControllerMap__d74a350e-fe8b-4e9e-bbcd-efff16d34115__2000000",
    "OverrideControllerMap__d74a350e-fe8b-4e9e-bbcd-efff16d34115__2001000",
    "OverrideControllerMap__00000000-0000-0000-0000-000000000000__0"
  ],
"_overrideControllerMapValueList": [
    <?xml version="1.0" encoding="utf-16"?>
    <JoystickMap dataVersion="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://guavaman.com/rewired http://guavaman.com/schemas/rewired/1.1/KeyboardMap.xsd"
        xmlns="http://guavaman.com/rewired"> <sourceMapId>9</sourceMapId>
        <categoryId>0</categoryId>
        <layoutId>0</layoutId>
        <name></name>
        <hardwareGuid>d74a350e-fe8b-4e9e-bbcd-efff16d34115</hardwareGuid>
        <enabled>true</enabled>
        <buttonMaps>
            <ActionElementMap>
                <actionCategoryId>0</actionCategoryId>
                <actionId>5</actionId>
                <elementType>1</elementType>
                <elementIdentifierId>13</elementIdentifierId>
                <axisRange>0</axisRange>
                ...

The _overrideControllerMapKeyList has a list of controller overrides. They look like OverrideControllerMap__{Controller ID}__{Yet unknown number}. For every value, there must be a matching controller in _overrideControllerMapValueList that contain the keybindings definitions.

Controller is defined like this:

<?xml version="1.0" encoding="utf-16"?>
<JoystickMap dataVersion="2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://guavaman.com/rewired http://guavaman.com/schemas/rewired/1.1/KeyboardMap.xsd" xmlns="http://guavaman.com/rewired">
    <sourceMapId>9</sourceMapId>
    <categoryId>0</categoryId>
    <layoutId>0</layoutId>
    <name></name>
    <hardwareGuid>d74a350e-fe8b-4e9e-bbcd-efff16d34115</hardwareGuid>
    <enabled>true</enabled>
    <buttonMaps>
        <!--List of ActionElementMap for buttons-->
    </buttonMaps>
    <axisMaps>
        <!--List of ActionElementMap for buttons-->
    </axisMaps>
</JoystickMap>

JoystickMap is used for gamepads, KeyboardMap - for keyboard, and probably MouseMap for mouse. KeyboardMap has no axis maps.

Elements breakdown:

Name Value Description
sourceMapId ? ?
categoryId 0-1? ?
layoutId 0? ?
name Empty ?
hardwareGuid UUID UUID of the device, 0's for keyboard
enabled true Status?
buttonMaps List of ActionElementMap Button mappings
axisMaps List of ActionElementMap Axis mappings, absent on keyboard

Controller IDs

Every controller has it's own ID for the game to discriminate it from the others.

Currently known IDs

Name UUID Map Name
XInput Gamepad d74a350e-fe8b-4e9e-bbcd-efff16d34115 JoystickMap
Keyboard 00000000-0000-0000-0000-000000000000 KeyboardMap
Mouse 00000000-0000-0000-0000-000000000000? MouseMap?

Element Identifiers IDs

This is the IDs of controller's buttons. Fresh ones can be found here. There are CSV files which has relationships between element identifier IDs and physical keys.

Keyboard Element Identifiers
Button Element Identifier
0 None
A 1
B 2
C 3
D 4
E 5
F 6
G 7
H 8
I 9
J 10
K 11
L 12
M 13
N 14
O 15
P 16
Q 17
R 18
S 19
T 20
U 21
V 22
W 23
X 24
Y 25
Z 26
0 27
1 28
2 29
3 30
4 31
5 32
6 33
7 34
8 35
9 36
Numpad 0 37
Numpad 1 38
Numpad 2 39
Numpad 3 40
Numpad 4 41
Numpad 5 42
Numpad 6 43
Numpad 7 44
Numpad 8 45
Numpad 9 46
Numpad . 47
Numpad / 48
Numpad * 49
Numpad - 50
Numpad + 51
Space 54
Backspace 55
Tab 56
Clear 57
Enter 58
Pause 59
ESC 60
' 66
, 71
- 72
. 73
/ 74
; 76
= 78
[ 82
\ 83
] 84
~ 87
Delete 88
Arrow Up 89
Arrow Down 90
Arrow Right 91
Arrow Left 92
Insert 93
Home 94
End 95
Page Up 96
Page Down 97
F1 98
F2 99
F3 100
F4 101
F5 102
F6 103
F7 104
F8 105
F9 106
F10 107
F11 108
F12 109
F13 110
F14 111
F15 112
NumLock 113
CapsLock 114
ScrollLock 115
Right Shift 116
Left Shift 117
Right Ctrl 118
Left Ctrl 119
Right Alt 120
Left Alt 121
Left Win 124
Right Win 125
Help 127
Print 128
XBox Gamepad Element Identifiers
Button Element Identifier
Left Stick X 0
Left Stick Y 1
Right Stick X 2
Right Stick Y 3
Left Trigger 4
Right Trigger 5
A 6
B 7
X 8
Y 9
Left Shoulder 10
Right Shoulder 11
Back 12
Start 13
Left Stick Button 14
Right Stick Button 15
D-Pad Up 16
D-Pad Right 17
D-Pad Down 18
D-Pad Left 19
Left Stick 20
Right Stick 21
Guide 22
Mouse Element Identifiers
Button Element Identifier
Mouse Horizontal 0
Mouse Vertical 1
Mouse Wheel 2
Left Mouse Button 3
Right Mouse Button 4
Middle Mouse Button 5
Mouse 4 6
Mouse 5 7
Mouse 6 8
Mouse 7 9
Mouse Wheel Horizontal 10

Action Element Map

Example element
<ActionElementMap>
    <actionCategoryId>0</actionCategoryId>
    <actionId>5</actionId>
    <elementType>1</elementType>
    <elementIdentifierId>13</elementIdentifierId>
    <axisRange>0</axisRange>
    <invert>false</invert>
    <axisContribution>0</axisContribution>
    <keyboardKeyCode>0</keyboardKeyCode>
    <modifierKey1>0</modifierKey1>
    <modifierKey2>0</modifierKey2>
    <modifierKey3>0</modifierKey3>
    <enabled>true</enabled>
</ActionElementMap>

Single key or axis mapping.

Name Value Description
actionCategoryId 0 ?, not used
actionId int Action ID
elementType 0-1 0 for axis, 1 for button
elementIdentifierId int Button code
axisRange 0 Sometimes different than 0, but appears unused
invert false Invert (for axis)
axisContribution 0 Sometimes different than 0, but appears unused
keyboardKeyCode 0 Appears unused
modifierKey1 0-3 0 - no modifier, 1 - Ctrl, 2 - Alt, 3 - Shift
modifierKey2 0-3 Same, second modifier
modifierKey3 0-3 Same, third modifier (Something like Ctrl+Alt+Shift+Z is possible)
enabled true Control enabled

Action IDs

In-game actions and their IDs.

Action ID
Side Movement 0
Forward Movement 1
Camera: Horizontal 30
Camera: Vertical 31
Camera: Zoom 54
Jump 15
Attack 16
Elemental Skill 17
Elemental Burst 20
Sprint 21
Aim Mode 27
Aim Button 28
Cancel Climb 53
Walk / Run 55
Show Cursor 56
Elemental Sight 57
Navigation 80
Gadget 87
Interaction (some modes) 88
Map 2
Character List 3
Inventory 4
Menu (Gamepad) 5
Quest List 6
Use / Talk 22
Quick Wheel 33
Chat 75
Notification Details 76
Environment Info 77
Tutorial 81
Abandon Challenge 84
Party Setup 99
Friends 132
Photo: Hide UI 86
Item Info 19
Top Menu: Left 34
Top Menu: Right 35
Menu Select 40
Auxiliary Action 41
Secondary Action 63
Menu / Back 42
Less 51
More 52
Lock Item / Mark Map 67
D-Pad Up 43
D-Pad Right 44
D-Pad Down 45
D-Pad Left 46
Adventurer Handbook 10
Co-Op 65
Wish 73
Events 82
Battle Pass 83
Pot Tasks 129
Pot Edit 130
Char 1 7
Char 2 8
Chat 3 9
Char 4 66
Char 5 78

Elemental Burst on switch is a combination of Show cursor and Char X. There is no direct mapping for it.

Clone this wiki locally