-
Notifications
You must be signed in to change notification settings - Fork 0
RetroArch controller auto config
RetroArch Official doc for automatic controller mapping: https://www.retroarch.com/index.php?page=controller-autoconfig
Here we'll use the "HORI Racing Wheel Apex for PS4/3/PC" as an example.
-
Copy the
retroarch.cfg
file in this repo to your retroarch folder to overwrite the existing one.There are some slight adjustments made in this .cfg, such as allowing all players to control the menu; do not save config at exit; and display advanced settings, etc. But most importantly, it sets all button/axis mappings to
null
. This is to avoid any interference with the autoconfig that we'll be doing here. -
Launch RetroArch
-
Disconnect all controllers, and connect a keyboard.
This is to make it simple so that the newly connected controller is mapped to port 1.
The keyboard is needed so you can still maneuver around the menu before the controller is fully mapped.
If it's not possible to disconnect all existing controllers, don't worry, just pay attention in the next step to see which port the new controller is mapped to.
-
Plug in the new controller to be mapped.
A pop up message appears saying "<controller name> (un)configured in port #1".
In my case, when plugging in the HORI Apex wheel, it says "HORI Fighting Commander PS4-044 PC configured in port #1".
If you are curious why that particular device shows up, please read on. Otherwise skip to step 4.
So why it's recognized as a "HORI Fighting Commander"? As explained in the official doc linked above, when a controller is plugged in, RetroArch looks through each file in the directory
autoconfig/udev
(udev
as we are using theudev
input driver) for the closest match. It scores each .cfg file there by three things: the device name, the vendor id, and the product id. If no exact match is found, it picks the one with the highest score.In case of the HORI Apex wheel, the Linux system returns the following info:
- device name: Generic X-Box pad
- vendor id: 3853
- product id: 164
So after checking each existing .cfg file there, RetroArch picked one with the following content:
- device name: Generic X-Box pad
- vendor id: 3853
- product id: 134
- display name: HORI Fighting Commander PS4-044 PC
It's a close match but not exact. And as it finds a matching .cfg, it shows "... configured in port...". Otherwise it would show "...unconfigured in port...".
-
Bring up the RetroArch quickmenu (CTRL+F1), go back up one level (backspace) and go into
Settings/Input/Port 1 Binds
.If you have other existing controllers connected, pay attention in step 3 which port the newly connected controller is mapped to. For example, if the popup says "...unconfigured in port #2", then go into
Settings/Input/Port 2 Binds
to find it. -
Now scroll down to the section of current button mappings, and actually map each button/axis as needed.
-
After that, scroll up to find the
Save auto config
item, and click on it. A popup message says "autoconfig file saved". -
IMPORTANT On the same page, find the item that says
Bind Default All
, and click on it.This is to avoid accidentally saving the settings to the global
retroarch.cfg
file. -
Exit RetroArch. Plug the USB drive to a PC to check the newly saved autoconfig file.
-
On the PC, navigate to
retroarch/autoconfig/udev
folder, find the last modified file. It's named by the system-generated device name. In my case, the file saved in step 6 is namedGeneric X-Box pad.cfg
. -
You can rename the file to your liking, e.g., "HORI_Apex_Wheel.cfg". RetroArch does not care the file name, only the file content matter.
-
Edit the .cfg file in a text editor. Initially it might look like the following:
input_driver = "udev"
input_device = "Generic X-Box pad"
input_vendor_id = "3853"
input_product_id = "164"
input_b_btn = "0"
input_y_btn = "2"
input_select_btn = "6"
input_start_btn = "7"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_a_btn = "1"
input_x_btn = "3"
input_l_btn = "4"
input_r_btn = "5"
input_l2_axis = "+2"
input_r2_axis = "+5"
input_l3_btn = "9"
input_r3_btn = "10"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
You can do the following to make it more user friendly:
- Add a
input_device_display_name = "My Preferred Display Name"
- Add empty lines and comments (lines started with
#
) - If in the previous mapping session you messed up something, like accidently started mapping a control then realized there's no corresponding physical control to map to, but there was no way to map it to "nothing", now you can delete that line.
- Add a "label" section. So instead of showing "1", "3" etc. in the menu, it'll show "Circle", "Square" etc. The previous .cfg file after adding labels (and display name/comments) looks like the following. Note the 1-to-1 correspondence between the
input_xxxx
and itsinput_xxxx_label
.
input_driver = "udev"
input_device = "Generic X-Box pad"
input_device_display_name = "HORI Racing Wheel Apex"
input_vendor_id = "3853"
input_product_id = "164"
# PS button is 8
input_b_btn = "0"
input_y_btn = "2"
input_select_btn = "6"
input_start_btn = "7"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_a_btn = "1"
input_x_btn = "3"
input_l_btn = "4"
input_r_btn = "5"
input_l2_axis = "+2"
input_r2_axis = "+5"
input_l3_btn = "9"
input_r3_btn = "10"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
input_b_btn_label = "Cross"
input_y_btn_label = "Square"
input_select_btn_label = "Share"
input_start_btn_label = "Options"
input_up_btn_label = "DPad Up"
input_down_btn_label = "DPad Down"
input_left_btn_label = "DPad Left"
input_right_btn_label = "DPad Right"
input_a_btn_label = "Circle"
input_x_btn_label = "Triangle"
input_l_btn_label = "L1"
input_r_btn_label = "R1"
input_l2_axis_label = "L2"
input_r2_axis_label = "R2"
input_l3_btn_label = "L3"
input_r3_btn_label = "R3"
input_l_x_plus_axis_label = "Turn Right"
input_l_x_minus_axis_label = "Turn Left"
Done! Now whenever the wheel is present, it'll show up as the "HORI Racing Wheel Apex" with all controls auto configured. Which port it's mapped to depends on whether there're other controllers present at that moment. But the ports are easily switchable. For example, if the wheel is initially mapped to port #2 and you want it on port #1, simply go into Settings/Input/Port 1 Binds, and switch "Device Index" to the wheel (by pressing left/right), and all controls associated with the wheel are then switched along. You can even set a controller to control multiple ports, for some special use cases.