Skip to content

Commit 7c85abc

Browse files
authored
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
2 parents a7f03d0 + 54606e3 commit 7c85abc

File tree

1 file changed

+95
-29
lines changed

1 file changed

+95
-29
lines changed

docs/guides/controller-autoconfiguration.md

Lines changed: 95 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
# Joypad Auto Configuration
22

3-
## How does matching work?
3+
## How does RetroArch match controllers?
44

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.
66

7-
The matching algorithm considers three criteria:
7+
The matching algorithm considers several key factors:
88

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.
1213

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.
1415

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.
1621

1722
## Why is it needed?
1823

@@ -158,28 +163,44 @@ Here's how to set up a default-off configuration:
158163

159164
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.
160165

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:
173+
174+
**Settings > Input > RetroPad Binds > Port 1 Binds > Device Index**
175+
176+
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+
162180

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
164182

165-
#### Understanding controller names
183+
When you save a controller profile, the Device Index serves two important purposes:
166184

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".
168186

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.
171192

172193
Importantly, this name remains consistent across various controller drivers, such as udev, sdl2, and linuxraw, as specified in **Settings > Drivers > Controller**.
173194

174-
#### Variability of controller names
195+
#### Variability of the Device Index
175196

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.
177198

178199
#### Example: Nintendo Switch Pro Controller on GNU/Linux
179200

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
181202

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 |
183204
|----------------------|-------------------------------------------|-------------------------------------------|----------------------------------------------|
184205
| 5.15 | Pro Controller | No | Pro Controller |
185206
| 5.19 | Nintendo Switch Pro Controller | Yes | |
@@ -190,7 +211,7 @@ The following table illustrates how the controller name for the Nintendo Switch
190211

191212
###### Pro Controller (default-off).cfg
192213
```
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)
194215
# "(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.
195216
input_device = "Pro Controller"
196217
# 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"
227248

228249
The second part is the mapping itself, where each button is assigned to a button of the RetroPad (the joypad abstraction of RetroArch).
229250

251+
Example
230252
```
231253
input_b_btn = "0"
232254
input_y_btn = "2"
@@ -255,26 +277,70 @@ input_r_y_minus_axis = "-4"
255277
input_menu_toggle_btn = "8"
256278
```
257279

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 |
289+
|------------------|----------------------------------|----------------|---------------------|--------------|
290+
| PlayStation 1 | Sony Dual Analog Controller | April 1997 | Yes | No |
291+
| PlayStation 1 | Sony DualShock | November 1997 | Yes | No |
292+
| PlayStation 2 | DualShock 2 | 2000 | Yes | Yes |
293+
| PlayStation 3 | Sixaxis | 2006 | Yes | Yes |
294+
| PlayStation 3 | DualShock 3 | 2008 | Yes | Yes |
295+
| PlayStation 4 | DualShock 4 | 2013 | Yes | Yes |
296+
| PlayStation 5 | DualSense | 2020 | Yes | Yes |
259297

260-
* 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
262299
* Axis definitions use `+` and `-` to indicate positive or negative direction (e.g., full press vs. no press).
263300
* 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.
264301

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)
266332

267333
* These are defined by variable names ending with `_btn` (e.g., `input_a_btn`, `input_start_btn`).
268334
* 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.
269335
* RetroArch interprets these IDs (usually 1 for pressed, 0 for not pressed) to determine the button state.
270336

271-
##### D-Pad directions (special digital inputs)
337+
###### D-Pad directions (special digital inputs)
272338

273339
* D-pad directions use variable values beginning with `h0` (e.g., `input_up_btn = "h0up"`).
274340
* Four `h0` variables exist (`h0up`, `h0down`, `h0left`, `h0right`) for each direction on the D-pad.
275341
* Note: The value `h1` is used by a single controller (Nintendo_Wii_Remote_Classic_Controller.cfg).
276342

277-
### Input descriptors
343+
#### Input descriptors
278344

279345
The third part are *input descriptors* used by RetroArch to display the labels of the buttons as they are written on your joypad.
280346

@@ -307,9 +373,9 @@ input_r_y_minus_axis_label = "Right Analog Y- (up)"
307373
input_menu_toggle_btn_label = "Guide"
308374
```
309375

310-
#### Sony PlayStation controllers
376+
#### Example: Controllers for Sony PlayStation 2 and later
311377

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:
313379
```
314380
input_b_btn_label = "Cross"
315381
input_y_btn_label = "Square"
@@ -323,8 +389,8 @@ input_a_btn_label = "Circle"
323389
input_x_btn_label = "Triangle"
324390
input_l_btn_label = "L1"
325391
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"
328394
input_l3_btn_label = "L3"
329395
input_r3_btn_label = "R3"
330396
input_l_x_plus_axis_label = "Left Analog X+ (right)"

0 commit comments

Comments
 (0)