I want to remap some game-pad controls for a specific game (in this example it is Missile Command)

When I use select + X buttons on my game-pad to bring up the menu and select Port 1 Controls I get this choice:

MAME 2003 menu

On the left should be the name of an input used by the game, For example Missile Command's Fire button for Base Alpha ought to be something like Player 1 Button 2 (or abbreviated P1 Button 2) but there's nothing there that I can recognise. So how do I work out which in-game function corresponds to Auto:1 (N/A), (Key: z)?

On the right should be the name of a physical button (or other input) on the "RetroPad" that retroPie maps your actual game-controller to. For example Joy 1 Y. but there's nothing there I recognise. You can cycle through a list but it is limited to the values shown in that column. So how do I know which of Button 1 through Button 9 is my game-pad's Y button?

How do I reconfigure my controls for a game?


  • Gamepad is seen as an Xbox 360 gamepad (message saying so pops up briefly when starting game).
  • jstest command shows response for all digital and analog controls on gamepad.
  • Mame menu (tab key) for input mapping only responds to some gamepad inputs, ofthose that produce a response, many seem to be mapped to B button somehow. So cannot do any useful mapping inside MAME itself.

2 Answers 2


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.

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.


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.


According to this page, Y would be Button 4.

Stick 1 = left analog stick

Stick 2 = right analog stick

POV = dpad

Button 1 = A

Button 2 = B

Button 3 = X

Button 4 = Y

Button 5 = LB

Button 6 = RB

Button 7 = back

Button 8 = start

Button 9 = left analog stick center pushed in

Button 10 = right analog stick center pushed in

Button 11 = left trigger

Button 12 = right trigger

Button 13 = X silver guide button

  • OK, thats half the solution. In order to have the "Y" button fire a missile from Delta base, which of the items on the left of my screenshot should I assign Button 4 to? Apr 28, 2020 at 14:18
  • @RedGrittyBrick Do you know which button currently fires the missile? If so, you could just replace whatever that button is bound to. If not, then I wouldn't know how to identify it. Apr 28, 2020 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.