MAME Android controller diagnostics / 2026-07-27

Fix MAME controller order changing on Android

Determine whether an Android MAME port exposes full MAME controller files and stable device IDs before trying to keep Joy 1 and Joy 2 fixed across reconnects.

10 minute diagnostic guideFull MAME controller configuration concepts; Android ports and MAME-derived cores may omit them

Fix MAME controller order changing on Android

First prove whether the Android port exposes MAME's Input Devices menu, controller configuration path, and `-ctrlr` support. In a full MAME build, copy each device ID and use `mapdevice` entries in a selected controller configuration file to map them to `JOYCODE_1`, `JOYCODE_2`, and so on. This works only when the Android input provider supplies stable unique IDs and all mapped devices are connected at startup; otherwise use the port's own player assignment or a documented connection order.

Do this in order

  1. 01

    Record the Android app or frontend, its exact MAME/core revision, input provider, and whether it exposes Input Devices, `ctrlrpath`, and the `ctrlr` option.

  2. 02

    Start with all intended pads connected and capture each device ID from Input Devices or verbose `Input: Adding…` log output where the port supports it.

  3. 03

    Confirm the IDs remain unique and unchanged across one clean restart; stop if the provider reports identical or unstable IDs.

  4. 04

    In a full MAME build, create a controller `.cfg` under the configured `ctrlrpath`, put `mapdevice` entries in the first applicable default system section, and select it with `-ctrlr` or the equivalent option.

  5. 05

    Restart with every mapped device connected and confirm verbose output reports the intended remapping before changing per-game buttons.

  6. 06

    If the Android port omits controller files or stable IDs, use its own player assignment or a fixed connection sequence and record the limitation instead of editing unsupported XML.

Decision and diagnostic table

EvidenceCan stable mapping work?Action
Unique device IDs plus `-ctrlr` supportPotentially yesUse one selected controller file and verify logs
IDs change after restartNo reliable `mapdevice` matchUse port assignment or fixed connection order
Identical pads expose identical IDsNot individually distinguishableKeep physical ports/order fixed
Android port has no `ctrlrpath` or controller-file UIFull-MAME method unavailableDo not paste desktop XML into guessed folders

Joy numbers normally follow enumeration

MAME documents that input device numbers are not stable by default. USB or Bluetooth reconnection, hub changes, and a restart can change the order in which the input provider enumerates devices.

A saved per-game button assignment that refers to Joy 1 can therefore follow the number rather than the physical pad unless a stable mapping layer exists.

mapdevice belongs only in a controller file

MAME applies `mapdevice` elements from the selected controller configuration file. It ignores them in ordinary system and default configuration files, so editing `default.cfg` cannot solve enumeration.

All explicitly mapped devices must be present at startup for numbering to behave as expected. Verify the log before trusting the layout.

Android ports define the practical boundary

An app branded with MAME may wrap or modify upstream configuration, and a libretro core uses the frontend's input system. Neither guarantees direct access to upstream `-ctrlr`, `ctrlrpath`, verbose logs, or clipboard-based device IDs.

Treat absent controls as a platform boundary, not an invitation to invent a filesystem path. Use the port's documented UI and keep a reversible connection-order note.

First-party sources

Related guides