You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #969 from davidhedlund/patch-11
Update controller-autoconfiguration.md: Updated the axis labels for analog L2 and R2 inputs. Replaced "controller name" with "Device Index". Described that linxraw does not provide Vendor ID (VID) and Product ID (PID) info
Copy file name to clipboardExpand all lines: docs/guides/controller-autoconfiguration.md
+95-29Lines changed: 95 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,23 @@
1
1
# Joypad Auto Configuration
2
2
3
-
## How does matching work?
3
+
## How does RetroArch match controllers?
4
4
5
-
RetroArch is shipped with a set of configuration files for the most common joypads. When you plug a joypad for the first time, we try to find a matching profile in our set.
5
+
When you connect a new controller to RetroArch, the system attempts to automatically configure it by matching it to known profiles. This matching process is crucial for ensuring that your controller works correctly with various games and emulators.
6
6
7
-
The matching algorithm considers three criteria:
7
+
The matching algorithm considers several key factors:
8
8
9
-
- Device name
10
-
- Vendor ID
11
-
- Product ID
9
+
-**Controller driver (input_driver)**: The software interface used to communicate with the controller. To use a specific driver, RetroArch must be configured accordingly by navigating to **Settings -> Drivers -> Controller**.
10
+
-**Device Index (input_device)**: The name of the controller as recognized by the system. The **Device Index** can be identified by navigating to **Settings -> Input -> RetroPad Binds -> Port 1 Controls**.
11
+
-**Vendor ID (input_vendor_id)**: A unique identifier assigned to the controller's manufacturer.
12
+
-**Product ID (input_product_id)**: A specific identifier for the particular controller model.
12
13
13
-
We compute a matching score for each configuration file based on these three factors. The profile with the highest score is chosen to configure the pad.
14
+
RetroArch evaluates each of these factors against its database of controller profiles. It then calculates a matching score for each profile, with the highest-scoring profile being selected to configure the controller.
14
15
15
-
**Note**: The **Vendor ID** and **Product ID** pair is often abbreviated as **vid:pid**.
16
+
RetroArch automatically utilizes the linuxraw driver, which operates differently than other drivers by providing only a device name instead of Vendor ID (VID) and Product ID (PID) information. This means that controller matching with the linuxraw driver depends primarily on the device name (Device Index), accessed through the JSIOCGNAME ioctl command, rather than the typical vid:pid identifiers.
17
+
18
+
It's worth noting that the Vendor ID and Product ID pair is often abbreviated as "vid:pid" in technical discussions.
19
+
20
+
This matching system allows RetroArch to support a wide range of controllers while minimizing the need for manual configuration in most cases.
16
21
17
22
## Why is it needed?
18
23
@@ -158,28 +163,44 @@ Here's how to set up a default-off configuration:
158
163
159
164
This approach allows users to manually enable the configuration when needed, preventing automatic application that could interfere with common devices, and helps ensure a smoother experience for users while still providing the necessary configuration options for those who require them.
160
165
161
-
### Controller name scheme
166
+
### Device Index scheme for autoconfig files
167
+
168
+
In RetroArch, the management of controller configurations is essential for ensuring proper functionality across various systems. This guide outlines how the Device Index are generated and how they can vary based on the Linux kernel version in GNU/Linux distributions.
169
+
170
+
#### Understanding the Device Index
171
+
172
+
RetroArch identifies physical controllers through a system called the Device Index. You can locate this identifier by navigating to:
The Device Index plays a crucial role when saving a controller profile. To save a profile, follow this path:
177
+
178
+
**Settings > Input > RetroPad Binds > Port 1 Controls > Save Controller Profile**
179
+
162
180
163
-
In RetroArch, the management of controller configurations is essential for ensuring proper functionality across various systems. This guide outlines how controller names are generated and how they can vary based on the Linux kernel version in GNU/Linux distributions.
181
+
### Dual function of the Device Index
164
182
165
-
#### Understanding controller names
183
+
When you save a controller profile, the Device Index serves two important purposes:
166
184
167
-
When you save a controller profile (**Settings > Input > RetroPad Binds > Port 1 Controls > Save Controller Profile**), RetroArch generates a controller name (e.g., "Foo"). This name serves two purposes:
185
+
1.**Configuration File Naming**: It becomes an integral part of the configuration file's name. For example, if the Device Index is "Foo", the configuration file might be named "udev/Foo.cfg".
168
186
169
-
1. It becomes part of the configuration file name (e.g., "udev/Foo.cfg").
170
-
2. It's used as the value for the `input_device` variable within the configuration file (e.g., `input_device = "Foo"`).
187
+
2.**Input Device Identification**: Within the configuration file itself, the Device Index is used as the value for the `input_device` variable. Following our example, you would see a line like this in the file:
188
+
189
+
`input_device = "Foo"`
190
+
191
+
This dual functionality ensures that RetroArch can correctly identify and apply the appropriate settings for each unique controller.
171
192
172
193
Importantly, this name remains consistent across various controller drivers, such as udev, sdl2, and linuxraw, as specified in **Settings > Drivers > Controller**.
173
194
174
-
#### Variability of controller names
195
+
#### Variability of the Device Index
175
196
176
-
The controller name may change depending on the version of the system, particularly the Linux kernel version. To ensure compatibility, we utilize the most recent controller name that is supported by the system.
197
+
The Device Index may change depending on the version of the system, particularly the Linux kernel version. To ensure compatibility, we utilize the most recent Device Index that is supported by the system.
177
198
178
199
#### Example: Nintendo Switch Pro Controller on GNU/Linux
179
200
180
-
The following table illustrates how the controller name for the Nintendo Switch Pro Controller varies across different Linux kernel versions, along with its HID support and corresponding autoconfig file names. As a side-note, the notation "(default-off)" indicates that the configuration is disabled by default to avoid
201
+
The following table illustrates how the Device Index for the Nintendo Switch Pro Controller varies across different Linux kernel versions, along with its HID support and corresponding autoconfig file names. As a side-note, the notation "(default-off)" indicates that the configuration is disabled by default to avoid
181
202
182
-
| Linux Kernel Version |Controller Name in RetroArch | Nintendo Switch Pro Controller HID Support | Selected controller name for the autoconfiguration file |
203
+
| Linux Kernel Version |Device Index in RetroArch | Nintendo Switch Pro Controller HID Support | Selected Device Index for the autoconfiguration file |
@@ -190,7 +211,7 @@ The following table illustrates how the controller name for the Nintendo Switch
190
211
191
212
###### Pro Controller (default-off).cfg
192
213
```
193
-
# This file uses the legacy controller name "Pro Controller" (generated by RetroArch on Linux 5.15)
214
+
# This file uses the legacy Device Index "Pro Controller" (generated by RetroArch on Linux 5.15)
194
215
# "(default-off)" was added to the file name to indicate that the autoconfig file is not active by default. See comments for input_vendor_id and input_product_id.
195
216
input_device = "Pro Controller"
196
217
# Due to the uncommon nature of this device, the autoconfig file is not active by default. This precaution is taken to avoid potential conflicts with the widely-used Nintendo Switch Pro Controller (nintendo-hid version) file. Button layouts are not compatible. To activate this configuration:
@@ -227,6 +248,7 @@ input_product_id = "3570"
227
248
228
249
The second part is the mapping itself, where each button is assigned to a button of the RetroPad (the joypad abstraction of RetroArch).
229
250
251
+
Example
230
252
```
231
253
input_b_btn = "0"
232
254
input_y_btn = "2"
@@ -255,26 +277,70 @@ input_r_y_minus_axis = "-4"
255
277
input_menu_toggle_btn = "8"
256
278
```
257
279
258
-
#### Axes (analog inputs)
280
+
Note: These variable values are examples and should not be directly copied to your configuration file.
281
+
282
+
#### Overview
283
+
284
+
##### Axes (analog inputs)
285
+
* They represent analog inputs from the controller, like joystick position (e.g., left joystick X-axis, right joystick Y-axis) or trigger pressure (e.g., L2 trigger, R2 trigger).
286
+
* Variable names (for both mappings and labels) includes `_axis` define these (e.g., `input_l_x_plus_axis_label`, `input_r2_axis`).
287
+
288
+
| Console | Controller | Release Date | Analog Thumb Sticks | L2/R2 Analog |
* Variable names ending with `_axis` define these (e.g., `input_l_x_axis`, `input_r2_axis`).
261
-
* They represent analog inputs from the controller, like joystick position (e.g., left joystick X-axis, right joystick Y-axis) or trigger pressure (e.g., left trigger, right trigger).
298
+
###### Mapping variables
262
299
* Axis definitions use `+` and `-` to indicate positive or negative direction (e.g., full press vs. no press).
263
300
* The current RetroArch configurations have axis values that ranges from `0` to `10`. However, if RetroArch does not limit the values to `10`, underlying controller hardware could offer an even wider range.
264
301
265
-
#### Buttons (digital inputs)
302
+
Mapping variables with analog L2/R2 triggers:
303
+
```
304
+
input_l2_axis = "+2"
305
+
input_r2_axis = "+5"
306
+
```
307
+
308
+
Note: These variable values are examples and should not be directly copied to your configuration file.
309
+
310
+
###### Label variables
311
+
The term "Analog" is included in the variable values for the analog inputs to clearly indicate that these inputs are analog in nature.
312
+
313
+
Labels for analog thumb sticks:
314
+
```
315
+
input_l_x_plus_axis_label = "Left Analog X+ (right)"
316
+
input_l_x_minus_axis_label = "Left Analog X- (left)"
317
+
input_l_y_plus_axis_label = "Left Analog Y+ (down)"
318
+
input_l_y_minus_axis_label = "Left Analog Y- (up)"
319
+
input_r_x_plus_axis_label = "Right Analog X+ (right)"
320
+
input_r_x_minus_axis_label = "Right Analog X- (left)"
321
+
input_r_y_plus_axis_label = "Right Analog Y+ (down)"
322
+
input_r_y_minus_axis_label = "Right Analog Y- (up)"
323
+
```
324
+
325
+
Labels for analog L2/R2 triggers:
326
+
```
327
+
input_l2_axis_label = "L2 Analog"
328
+
input_r2_axis_label = "R2 Analog"
329
+
```
330
+
331
+
##### Buttons (digital inputs)
266
332
267
333
* These are defined by variable names ending with `_btn` (e.g., `input_a_btn`, `input_start_btn`).
268
334
* The current RetroArch configurations have button values that ranges from `0` to `203`. However, if RetroArch does not limit the values to `203`, underlying controller hardware could offer an even wider range.
269
335
* RetroArch interprets these IDs (usually 1 for pressed, 0 for not pressed) to determine the button state.
270
336
271
-
##### D-Pad directions (special digital inputs)
337
+
######D-Pad directions (special digital inputs)
272
338
273
339
* D-pad directions use variable values beginning with `h0` (e.g., `input_up_btn = "h0up"`).
274
340
* Four `h0` variables exist (`h0up`, `h0down`, `h0left`, `h0right`) for each direction on the D-pad.
275
341
* Note: The value `h1` is used by a single controller (Nintendo_Wii_Remote_Classic_Controller.cfg).
276
342
277
-
### Input descriptors
343
+
####Input descriptors
278
344
279
345
The third part are *input descriptors* used by RetroArch to display the labels of the buttons as they are written on your joypad.
280
346
@@ -307,9 +373,9 @@ input_r_y_minus_axis_label = "Right Analog Y- (up)"
307
373
input_menu_toggle_btn_label = "Guide"
308
374
```
309
375
310
-
#### Sony PlayStation controllers
376
+
#### Example: Controllers for Sony PlayStation 2 and later
311
377
312
-
So if you are using a Sony PlayStation controllers, RetroArch will refer to the buttons as Cross, Circle, Square and Triangle:
378
+
Labels for PlayStation controllers starting from PS2. Note that analog L2/R2 triggers (`input_l2_axis_label = "L2 Analog"`, and `input_r2_axis_label = "R2 Analog"`) are featured:
313
379
```
314
380
input_b_btn_label = "Cross"
315
381
input_y_btn_label = "Square"
@@ -323,8 +389,8 @@ input_a_btn_label = "Circle"
323
389
input_x_btn_label = "Triangle"
324
390
input_l_btn_label = "L1"
325
391
input_r_btn_label = "R1"
326
-
input_l2_axis_label = "L2"
327
-
input_r2_axis_label = "R2"
392
+
input_l2_axis_label = "L2 Analog"
393
+
input_r2_axis_label = "R2 Analog"
328
394
input_l3_btn_label = "L3"
329
395
input_r3_btn_label = "R3"
330
396
input_l_x_plus_axis_label = "Left Analog X+ (right)"
0 commit comments