In short
There are ways to make sense of this RetroArch dialog but it may be easier to instead use the emulator's control mapping - in my case MAME's.
I found MAME's menu
- has meaningful names (not meaningless numbers)
- allows you to assign a value by pressing the controller button you want to use (not by selecting one meaningless number for another meaningless number)
See below for much more detail:
RetroArch RGUI Menu, Port 1 Controls
From what I have read, the meaning of the text in the left column is
Auto
- this line came from a gamepad auto-configuration file.
1
- an indication of a specific control on the physical device.
(N/A)
- an indication that a label for this control is not in the config files.
(Key: z)
- an alternative input using a keyboard.
RetroArch Gamepad Configuration Files
In directory /opt/retropie/configs/all/retroarch-joypads
I found a file for each of the different gamepads I had tried with the Raspberry Pi I was using. Presumably these were created by EmulationStation for RetroArch when I used the EmulationStation "CONFIGURE INPUT" option in the EmulationStation "MAIN MENU".
I edited the appropriate one, it had contents such as
input_l_btn = "6"
input_left_btn = "h0left"
after each such line I added a label line such as
input_l_btn_label = "L1"
input_left_btn_label = "Dpad-left"
after saving the file I used cd
and emulationstation
commands to restart EmulationStation, then went back into the game and brought up RetroArch's RGUI menu, then selected Controls
and Port 1 Controls
.
The left column now looks a lot more meaningful.
(Thinking about this later, Since the numbers on the right are assigned when you press each controller button in turn on EmulationStation's Configure Input
menu option, so you can infer what they mean once the left side is clear)
Button Numbers
I needed to find out what is meant by "Button 6" on the right hand side. I found the easiest way is to quit EmulationStation to a command line and run jstest /dev/input/js0
. It shows a line of Analogue control numbers and Button numbers with a value for each (numeric or on/off). Something like
Analogue 0:-32767 1:0 2:-32767 ... Button 0:off 1:off 2:off ...
You can then press each button on your gamepad and see which value changes. By doing this I could see that pressing R1 changes 7:off
to 7:on
. So R1 (right shoulder button) is button 7.
I noted down the number and value corresponding to each control on my gamepad. These numbers are what is shown on the right of the retroArch (RGUI) "Port 1 Controls" dialogue shown above (and in the question).
8BitDo N30 Pro 2 | jstest
-----------------------|-----------------
Dpad up | analog 7 -ve
Dpad down | analog 7 +ve
Dpad left | analog 6 -ve
Dpad right | analog 6 +ve
select | button 10
start | button 11
Y | button 4
X | button 3
B | button 1
A | button 0
L1 (left shoulder) | button 6
R1 (right shoulder) | button 7
L2 (left trigger) | button 8
R2 (right trigger) | button 9
L3 (left thumb) | button 13
R3 (right thumb) | button 14
left-stick left/right | analog 0
left-stick up/down | analog 1
right-stick left/right | analog 2
right-stick up/down | analog 3
star | -
home | button 2
(Thinking about this later, I suspect this isn't helpful, it tells me the button numbers for my physical controller, not for the virtual "Retropad")
This should make it possible to swap or reassign controls in retroArch - but I found a method that was easier for me.
MAME2003 Input menu
By using the R2 button on my gamepad (or Tab key on keyboard) I could Bring up MAME's menu and choose Input (this game)
P1 Button 3 SPACE or JOYPAD1-X
P1 Button 2 LALT or JOYPAD1-Y
P1 Button 1 LCTRL or JOYPAD1-B
because MAME only shows a line for each control used in this specific game, it is easy to deduce that the left-hand side labels on the above three lines are for Missile Command's three "Fire" buttons for Omega, Delta and Alpha bases respectively.
Then you can use the Dpad to highlight a line, press the gamepad's A button to assign a new value and then press the appropriate control on the gamepad to assign that gamepad control to the game-function on the left.
For me this proved to be the easiest way to reassign buttons for a specific arcade game.
Summary
The job of mapping your gamepad's controls to actions is a specific game is made more complex by the series of many translations involved
Physical Linux ----RetroArch----- ----------MAME---------- Actual
Gamepad jstest Device RetroPad Controller Game Game
(Y) 4:on Auto: 0 Button 4 JOYPAD1-Y P1 Button 2 Fire delta
Obviously somewhere MAME has a config file that translates "Button 4" back into the more meaningful "JOYPAD1-Y". This means it is easier to ignore the RetroArch control assignment dialogs and instead use MAME's menus to make changes. Then I never have to wonder what "Button 4" means or what "Auto: 0" means.
Problems arise when RetroArch hides certain gamepad-controls from MAME and prevent you being able to use MAME to assign those gamepad-controls to game functions.