MAME controller mapping
MAME emulator control mapping is very complexe because each machine it emulates had a different control layout.
RetroBat offers multiple ways to change controller mapping for MAME, as well as libretro-mame. Each method is described in this page.
MAME (standalone)
RetroBat offers multiple ways to manage MAME controller configuration, either manually, or with automatic configuration:
RetroBat standard autoconfiguration
RetroBat xml override files (per-game)
Specific configuration for special controller types
Manual Game specific configuration
Manual Custom configuration
RetroBat autoconfiguration
By default, RetroBat will try to autoconfigure controls in MAME either by using RetroBat-provided per-game configuration, or by setting a default configuration.
Autoconfiguration can change depending on the controller layout that you specify in ADVANCED SETTINGS > CONTROLS:

The default button for each layout is the following:
Controller: this profile is adapted to gamepads, where
is assigned to button 1,
is assigned to button 2,
is assigned to button 3,
is assigned to button 4, L1 to button 5, R1 to button 6, L2 to button 7 and R2 to button 8
Modern 8 buttons: this profile is the most common one for modern arcade sticks, upper 4 buttons are buttons 1 (
), 2(
), 3(R1) and 7(L1), lower 4 buttons are buttons 4(
), 5(
), 6(R2) and 8(L2)
Classic 8 buttons: upper 4 buttons are buttons 1 (
), 2(
), 3(L1) and 7(L2), lower 4 buttons are buttons 4(
), 5(
), 6(R1) and 8(R2)
6 buttons: similar to classic 8 buttons but without buttons 7 and 8
8 buttons alternative: default is the same as Controller mapping
Per-Game automatic xml overrides
RetroBat ships with adapted per-game configuration, for each of the layouts described above, for approximately 130 games, the override files shipped with RetroBat are located in the \system\resources\inputmapping\mame folder:

You can create your own file and share it with the RetroBat team, or save it in the \user\inputmapping\mame folder of your RetroBat installation if you need a variation of the profile provided by RetroBat.
The override file is a xml file, almost similar to the MAME format used for its own config files, but with generic button names, that will be converted by RetroBat based on your connected controller and selected profile:

Each file contains multiple "layout" sections, which corresponds to the available layouts in RetroBat. Based on the selected value in RetroBat controls settings, the corresponding layout from the file will be picked.
Each layout contains the specific button mappings to use for the game, for example the following line means that the button 3 of the arcade machine "altbeast", for the player 1, will be mapped to the east face button of the controller when using the default layout:

In the same file you can see that this button is mapped to the R1 button when using the modern8 layout (which corresponds to the 3rd button of the upper range of the arcade stick):

You can use the same method as described below to create your own mapping file, however you will need to change the button values with the generic ones from RetroBat:
List of generic RetroBat button values
JOY_west
JOY_north
JOY_east
JOY_south
JOY_down (dpad down)
JOY_lsdown (left stick down)
JOY_up / JOY_lsup
JOY_left / JOY_lsleft
JOY_right / JOY_lsright
JOY_r1
JOY_l1
JOY_r2trigger
JOY_l2trigger
JOY_r3
JOY_l3
JOY_leftstickx (left stick horizontal axis) / JOY_rightstickx
JOY_leftsticky (left stick vertical axis) / JOY_leftstickx
JOY_lsup / JOY_lsdown / JOY_lsleft / JOY_lsright (left stick directions)
It is also possible to add "reverse" after and axis in order to set _REVERSE in MAME config file.
Using manual specific configuration
Use the following setting in RetroBat ADVANCED SETTINGS > CONTROLS menu to enable specific configuration:

All the settings other than RetroBat Auto can be used to point MAME to use a controller config file in the \saves\mame\ctrlr\ folder of your retrobat installation.
RetroBat ships with 2 files, one for the IPAC2 controller and one for the X-Arcade TankStick controller, if you own one of these controllers, you can use these options to autoconfigure these.
The other profiles can be used to point to files that you need to create, either custom files, or per-game files (named after the game rom). Such files are not provided with RetroBat and need to be created, here is the procedure:
Creating a specific controller configuration file for MAME
STEP 1 : Preliminary explanations
MAME standalone will read the controller configuration files in the following ordre of priority (from less priority to highest priority - meaning the last file found will override what is found before):
Native controller configuration
Default.cfg file located in
\saves\mame\cfgfolderGame specific config files located in
\saves\mame\cfgfolderController configuration file located in
\saves\mame\ctrlrfolder as per selection in RetroBat options
STEP 2 : Create controller mapping file in MAME
Run mame.exe, the executable is located in the emulators\mame folder of your RetroBat installation.
Click on "General Settings":

Select "Input Assignments"

Select the controls you want to assign:
User Interface section lets you map buttons to actions in the MAME Menu
Player X Controls allows you to map in-game controls

Map controls as you would like them:

When using left and right buttons (or keys), you can select whether to add a key to the same button or whether to reset the mapping for the control.


Once the mapping done, go back and click on "Save Settings":

A file name "default.cfg" has been saved in the \emulators\mame\cfg folder.

STEP 3 : Manage the cfg file
Open the default.cfg file and check the content:

The file has an xml format, the mapping that you have performed is located in the <input> section of the file.
In the example, the keyboard key "Q" has been assigned to the action "UI_MENU" that opens the MAME menu.
Finally, copy the default.cfg file in the \saves\mame\cfg folder of your installation : this will now be the default controller configuration.
STEP 4 : Create a dedicated profile
Proceed as explained in step 1, then rename the file to one of the following values:
custom1.cfg
custom2.cfg
custom3.cfg
...
custom8.cfg
Move the file in the \saves\mame\ctrlr folder of your RetroBat installation:

You can also perform the mapping directly in the cfg file if you feel comfortable with xml document processing.
Additional information on the file structure can be found here:
STEP 5 : Select the controller profile in RetroBat
From the MAME Game view, press SELECT to open the View Options menu and select "ADVANCED SYSTEM OPTIONS"

Ensure the MAME64 emulator is set as EMULATOR and navigate to the CONTROLS submenu:

Select the "CONTROLLER PROFILE" option and choose the profile used for the file that you have created:
RetroBat provides 8 custom profiles as well as the ability to use a per_game cfg file.
When using "per_game", the name of the file must match the name of the game file (without extension), for example name the file "wjammers.cfg" for the game file "wjammers.zip" (WindJammers).

Do not hesitate to share the files you have created with the RetroBat team if you have a general profile that can be shared with other users.
Libretro-mame
RetroBat offers autoconfiguration for MAME as part of RetroArch autoconfiguration, however, as MAME arcade machines have a huge variety of control types, it is possible to generate specific per-game configuration. The following configuration methods are available for libretro-mame within RetroBat:
RetroBat standard autoconfiguration
RetroBat xml override files (per-game)
RetroBat autoconfiguration
By default, RetroBat will try to autoconfigure controls in libretro-mame either by using RetroBat-provided per-game configuration, or by using the default RetroArch RetroPad mapping.
Autoconfiguration can change depending on the controller layout that you specify in ADVANCED SETTINGS > CONTROLS:

Using the mame core override remap file
Read this chapter for more information.
RetroBat can use a core override remap YAML file for libretro-mame, the file is located in the system/resources/inputmapping folder of your RetroBat installation and is named libretro_mame.yml.
If you want to modify the file, copy it first in the user\inputmapping folder of your RetroBat installation, else it might get erased with a future RetroBat update.
The remap file is a YAML file, each container contains the RetroArch remap for a game/layout:

Last updated
Was this helpful?
