MAME controller mapping
Overview
Every arcade cabinet had its own control panel: one button, six buttons, a wheel, a trackball… So there is no controller setup that fits all MAME games.
RetroBat sets the buttons automatically, game by game, for lr-mame, mame2003_plus, MAME and GroovyMAME. This page explains how that setup is chosen and how to change it: layout for an arcade stick, fixing one game, IPAC2 or X-Arcade panel, personal profile.
The table of default buttons and the hotkeys are on the MAME page.
How RetroBat chooses the buttons
When a game starts, RetroBat looks in this order for:
your configuration of the game, in
user\inputmapping;the configuration of the game shipped with RetroBat, in
system\resources\inputmapping(more than 3,000 games);if the game is a clone without a configuration, the one of its parent game;
otherwise, the default configuration of the selected layout.
The files depend on the emulator:
MAME, GroovyMAME
One <game>.xml file per game in system\resources\inputmapping\mame
user\inputmapping\mame\<game>.xml
lr-mame
system\resources\inputmapping\libretro_mame.yml (buttons) and system\resources\inputmapping\lr-mame\<game>.cfg (MAME menu shortcuts)
user\inputmapping\libretro_mame.yml
mame2003_plus
The same libretro_mame.yml as lr-mame, and system\resources\inputmapping\libretro_mame2003_plus.yml for games whose buttons differ in this MAME version
user\inputmapping\libretro_mame2003_plus.yml
These files describe buttons with generic names and hold one section per layout. RetroBat converts them at launch for the connected controller.
Do not edit the files in the system folder: they are replaced by each update.
Controller layout
On an arcade stick, buttons are arranged in two rows. The CONTROLS > CONTROLLER LAYOUT option tells RetroBat how your panel is built, so that it can reproduce the layout of the original cabinet on it.
CONTROLLER(SNES) (default)
For gamepads
MODERN 8 BUTTONS
WEST, NORTH, R1, L1
SOUTH, EAST, R2, L2
8 BUTTONS ALTERNATIVE
WEST, NORTH, L1, L2
SOUTH, EAST, R1, R2
6 BUTTONS
WEST, NORTH, L1
SOUTH, EAST, R1
CLASSIC 8 BUTTONS
Handled as 6 BUTTONS

Per-game configurations follow these rules:
6-button game (Street Fighter II): buttons 1, 2, 3 on the top row, buttons 4, 5, 6 on the bottom row;
game with 3 buttons or fewer: top row with MODERN 8 BUTTONS and 6 BUTTONS, bottom row with 8 BUTTONS ALTERNATIVE.
This option can also be set for all arcade systems in GAME SETTINGS > CONTROLS > SPECIAL CONTROLLERS (see the Arcade Sticks page).
Games without a dedicated configuration
Button 1
WEST ![]()
WEST ![]()
WEST ![]()
Button 2
SOUTH ![]()
NORTH ![]()
NORTH ![]()
Button 3
EAST ![]()
R1
L1
Button 4
NORTH ![]()
SOUTH ![]()
SOUTH ![]()
Button 5
L1
EAST ![]()
EAST ![]()
Button 6
R1
R2
R1
Button 7
L2
L1
L2
Button 8
R2
L2
R2
Buttons 7 and 8 are only set for MAME, GroovyMAME and mame2003_plus.
8 BUTTONS ALTERNATIVE: same as 6 BUTTONS with lr-mame and mame2003_plus, same as CONTROLLER(SNES) with MAME and GroovyMAME.
Which method should I choose?
Fit the buttons to your arcade stick
CONTROLLER LAYOUT
CONTROLLER LAYOUT
Fix the buttons of one game, keeping automatic configuration
user\inputmapping\mame\<game>.xml file
user\inputmapping\libretro_mame.yml file
Set buttons in the MAME menu and keep them
CONTROLLER PROFILE: NONE
USE OWN CFG FILE
Use an IPAC2 or X-Arcade panel
CONTROLLER PROFILE: IPAC2 or X-ARCADE
—
Use your own controller file
CONTROLLER PROFILE: CUSTOM 1 to 8, or GAME SPECIFIC
—
Let MAME choose the buttons of the game
—
ENABLE PER GAME AUTO MAPPING
Set everything yourself
Turn off AUTOCONFIGURE CONTROLLERS
Turn off AUTOCONFIGURE CONTROLLERS
These options are in the advanced system options, CONTROLS submenu. For mame2003_plus, see its own section below.

MAME and GroovyMAME
Controller profile
The CONTROLS > CONTROLLER PROFILE option chooses where the buttons come from:
RETROBAT AUTO (default)
RetroBat automatic configuration, game by game.
X-ARCADE, IPAC2
Profiles shipped with RetroBat for these panels: X-Arcade.cfg and ipac2.cfg in saves\mame\ctrlr.
CUSTOM 1 to 8
Your custom1.cfg to custom8.cfg file in saves\mame\ctrlr.
GAME SPECIFIC
A file named after the game in saves\mame\ctrlr, for example wjammers.cfg for wjammers.zip.
NONE
RetroBat sets nothing: MAME uses its .cfg files.
MAME .cfg files
MAME saves its per-game settings in saves\mame\cfg: default.cfg for all games, <game>.cfg for one game. They hold the buttons set in the MAME menu, and also the cabinet switches (DIP switches).
MAME reads the controller profile first, then default.cfg, then the .cfg of the game: the last one read wins. A button set in a .cfg file therefore takes priority over the profile.
With the RETROBAT AUTO profile, RetroBat removes the buttons from default.cfg and <game>.cfg for the session, then puts them back. DIP switches are kept. Buttons changed in the MAME menu during the session are not kept; a copy of the files of the last session stays in saves\mame\cfgbackupmame64.
With the other profiles, RetroBat does not touch these files.
lr-mame and MAME share the saves\mame\cfg folder. The EMULATION > SEPARATE CFG FOLDER FROM LIBRETRO option gives MAME its own folder, saves\mame\cfg64.
Fixing the buttons of a game (XML file)
Copy the file of the game, for example
sf2.xml, fromsystem\resources\inputmapping\mametouser\inputmapping\mame.Open the copy with a text editor. Each layout has its
<layout type="...">section:default(gamepad),modern8,8alternative,6alternative. If the section of your layout does not exist, RetroBat uses thedefaultsection.In the section you need, change the controller button name in the
mappingline:

Several buttons can trigger the same action, separated by OR: JOY_right OR JOY_lsright.
Accepted names
JOY_south, JOY_east, JOY_west, JOY_north
Face buttons
JOY_l1, JOY_r1
L1 and R1
JOY_l2, JOY_r2
L2 and R2, used as buttons
JOY_l2trigger, JOY_r2trigger
L2 and R2, analog
JOY_l3, JOY_r3
Stick clicks
JOY_start, JOY_select
START and SELECT
JOY_up, JOY_down, JOY_left, JOY_right
D-pad
JOY_lsup, JOY_lsdown, JOY_lsleft, JOY_lsright
Left stick, as directions
JOY_rsup, JOY_rsdown, JOY_rsleft, JOY_rsright
Right stick, as directions
JOY_leftstickx, JOY_leftsticky, JOY_rightstickx, JOY_rightsticky
Full axis of a stick (wheel, dial, analog stick)
MOUSE_BUTTON1…, MOUSE_XAXIS, MOUSE_YAXIS
Mouse
GUN_BUTTON1…, GUN_XAXIS, GUN_YAXIS
Light gun
KEYCODE_...
Keyboard key, in MAME format (KEYCODE_ENTER, KEYCODE_P, KEYCODE_LSHIFT…)
To reverse an axis, add _reverse to its name: JOY_leftstickx_reverse.
Game without a file: create user\inputmapping\mame\<game>.xml using an existing file as a model. The type, tag, mask and defvalue attributes of each button must be those of the game in MAME: you find them in saves\mame\cfg\<game>.cfg after setting this button once in the MAME menu. The README.txt file in user\inputmapping\mame describes the format.
Creating your own controller profile
Run
mame.exefrom theemulators\mamefolder.Open General Settings, then Input Assignments, and set the buttons. The User Interface part is for the MAME menu, the Player parts are for games.

Save. MAME creates the
default.cfgfile inemulators\mame\cfg.Rename this file
custom1.cfg(up tocustom8.cfg) and move it tosaves\mame\ctrlr.In RetroBat, choose CONTROLS > CONTROLLER PROFILE: CUSTOM 1.

For a profile dedicated to one game, name the file like the romset (wjammers.cfg for wjammers.zip), put it in saves\mame\ctrlr and choose GAME SPECIFIC.
lr-mame
Fixing the buttons of a game (libretro_mame.yml)
Copy
libretro_mame.ymlfromsystem\resources\inputmappingtouser\inputmapping. Your copy then fully replaces the RetroBat file.Find the entry of the game. There is one per layout:
sf2(gamepad),sf2_modern8,sf2_8alternative,sf2_6alternative. If the entry of your layout does not exist, RetroBat uses thesf2entry, which must always be present.
Each line gives, for a button of your controller, the cabinet button to trigger.
btn_a
EAST ![]()
btn_b
SOUTH ![]()
btn_x
NORTH ![]()
btn_y
WEST ![]()
btn_l, btn_r
L1, R1
btn_l2, btn_r2
L2, R2
0
Button 1
8
Button 2
1
Button 3
9
Button 4
10
Button 5
11
Button 6
14
Button 7
15
Button 8
-1
None
In the example, EAST (btn_a: 10) triggers button 5 of the cabinet.
MAME menu
The MAME menu opens with START + SOUTH. SOUTH confirms and EAST goes back.
As buttons change from one game to another, RetroBat writes these shortcuts into saves\mame\cfg\<game>.cfg at each launch, from the files in system\resources\inputmapping\lr-mame. A copy of the previous session is kept in saves\mame\cfgbackup.
Keeping the settings made in the MAME menu
Turn on CONTROLS > USE OWN CFG FILE. Buttons set in the MAME menu are then kept in saves\mame\cfg\<game>.cfg. On first activation, the configuration of the last session is imported. The CONTROLLER LAYOUT option no longer applies to this game.
Letting MAME choose
With ENABLE PER GAME AUTO MAPPING, RetroBat no longer applies its per-game configurations: the core places the buttons.
mame2003_plus
By default, mame2003_plus reuses the per-game configurations of lr-mame and follows the CONTROLLER LAYOUT option. Games whose buttons are different in this old MAME version have their own configuration, or else the default configuration.
Use a core layout, the same for all games
CONTROLS > PLAYER 1 CONTROLLER TYPE: RETROPAD, FIGHTSTICK, 8-BUTTON or 6-BUTTON. RetroBat then no longer sets buttons game by game.
Fix the buttons of one game
user\inputmapping\libretro_mame2003_plus.yml file
Set buttons in the MAME menu
ENABLE MAME REMAPPING (on by default), then L3
In the MAME menu, the buttons to confirm and cancel depend on the game: SOUTH and WEST with the default configuration.
Fixing a game: copy libretro_mame2003_plus.yml from system\resources\inputmapping to user\inputmapping, then add or edit the entry of the game in it. The format is the one of libretro_mame.yml, with two differences:
buttons 7 and 8 are written
12and13;a
use: defaultentry marks a game that uses the default configuration.
Games missing from this file are read from libretro_mame.yml.
Folders
RetroBat per-game configurations
system\resources\inputmapping
Your per-game configurations
user\inputmapping
MAME controller profiles
saves\mame\ctrlr
MAME per-game settings (cfg)
saves\mame\cfg (or saves\mame\cfg64)
Backup copies of cfg files
saves\mame\cfgbackup (lr-mame), saves\mame\cfgbackupmame64 (MAME)
mame2003_plus settings
saves\mame\mame2003-plus
Known issues
Buttons are not in the right place on my arcade stick
Set CONTROLLER LAYOUT to match your panel.
With mame2003_plus, CONTROLLER LAYOUT has no effect
Leave PLAYER 1 CONTROLLER TYPE and PLAYER 2 CONTROLLER TYPE on AUTO.
My settings made in the MAME menu are lost
Automatic configuration replaces them. MAME: choose the NONE profile. lr-mame: turn on USE OWN CFG FILE.
My custom controller profile is ignored
A default.cfg or <game>.cfg file in saves\mame\cfg holds other buttons: delete it or remove the buttons from it.
My user\inputmapping\mame\<game>.xml file is ignored
The file must have the exact romset name, and the profile must be RETROBAT AUTO.
My fix in libretro_mame.yml is ignored
Edit the copy placed in user\inputmapping, and the entry of your layout (<game>_modern8…).
Mis à jour
Ce contenu vous a-t-il été utile ?
