Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
07200 DIP/Input Minor Always Jan 6, 2019, 15:25 Nov 18, 2020, 01:28
Tester illando View Status Public Platform
Assigned To Resolution Open OS
Status [?] Acknowledged Driver
Version 0.204 Fixed in Version Build 64-bit
Fixed in Git Commit Github Pull Request #
Summary 07200: Stable Controller IDs for 2 controllers of the same brand.
Description The Stable Controller IDs configuration ( ) is not working using 2 controllers of the same brand.
This configuration is based on the device ID, but if the controllers that have generic names like "PS4Controller" MAME can not disambiguate between these devices.
<mapdevice device="PS4Controller" controller="JOYCODE_1" />
<mapdevice device="PS4Controller" controller="JOYCODE_2" />

A solution to this problem can be found at this link (reply #12 by tverona)
In his private build he made MAME able to recognise also the "Instance" for each device, so it's possible to write it in the .config file.
<mapdevice device="instance_f1641160-a808-11e5-8006-444553540000" controller="JOYCODE_1" />
<mapdevice device="instance_f1641160-a808-11e5-8002-444553540000" controller="JOYCODE_2" />
Steps To Reproduce
Additional Information
Github Commit
Regression Version
Affected Sets / Systems
Attached Files
There are no relationship linked to this issue.
User avatar
Jan 8, 2019, 01:18
To my knowledge, such information can be added to the mapdevice entry already:

The documents, I fear, are not set up to handle the duplicate controller ID scenario, but it should work.
User avatar
Jan 8, 2019, 17:49
edited on: Jan 8, 2019, 17:56
@Tafoid Yes but this is just for Directinput, so it will work only on Windows. Right?
Is there a way to ask MAME to visualise the instance on MacOs an try adding it to the mapdevice?
Also SDL2 should support InstanceID:
User avatar
Jan 11, 2019, 10:17
Opened up for some Developer help with this, hopefully
User avatar
R. Belmont
Aug 22, 2020, 19:25
MacOS doesn't let you see the IDs of the controllers at that level of detail. I added the ability to use the SDL2 JoystickInstanceID but it's just a generated number on non-Windows systems. If the stable controller feature is important to you, you need to use Windows, unfortunately.
User avatar
Nov 18, 2020, 01:28
I've also had a lot of trouble figuring out how to piece together how this works on Mac, so I've written this abbreviated example that I think it would be appropriate to have here to help other MAME users and testers. The truth is that while it *isn't* possible to differentiate two different identical controllers on Mac, it *is* definitely possible to use the mapdevice feature to get stable controllers when using different ones.

I wanted to play Blasteroids on MAME 0.226 for Mac on Catalina 10.15.7. I already had the rom in the "roms" directory.

I plugged in my Logitech RumblePad 2 USB controller. I also use a Sony Dualshock 3 but it's more complicated.

After plugging the controllers in, I ran MAME with the -v option. This outputs a lot of debug info onto the screen, part of which tells me which ID MAME is getting for my Logitech. I’m running MAME from the command line, an:d

 mame0226-64bit$ ./mame64 -v

In the middle of all that output is this:

 Joystick: Start initialization
 Input: Adding joystick #0: LogitechRumblePad2USB (device id: 030000006d04000018c2000000010000)
 Joystick: Logitech RumblePad 2 USB [GUID 030000006d04000018c2000000010000

The number I want is the device id shown above, “030000006d04000018c2000000010000”

Let’s say I want this device to always be JOYCODE_1 inside MAME. To make this happen, I created my own bitmaster.cfg file in the “ctrlr” directory inside MAME. You can use whatever editor you want, just make sure it ends with .cfg and not .txt as is the default for TextEdit.

I will specify when I run MAME that I want it to load this config file when I run it on the command line later. It’s worth noting that MAME loads a bunch of files for config, and order is matters. The most important thing to keep in mind right now is that MAME will create a config file for each game, in this case “blstroid.cfg” inside the “cfg” directory. THIS FILE IS LOADED *AFTER* our “bitmaster.cfg” and will OVERRIDE ANY CONFLICTING SETTINGS. Also, the “blstroid.cfg” file will be COMPLETELY OVERWRITTEN each time we make changes to the controls while MAME is running. So the reason we put our controller overrides into a separate file in the “ctrlr” directory is so that they don’t get magically overwritten when we change controls inside MAME.

So inside my “ctrlr/thebitmaster.cfg” file I put this:

 <mameconfig version="10">
 <system name="default">
 <!-- Scotts attempt to make a custom input configuration file -->
             <mapdevice device="030000006d04000018c2000000010000" controller="JOYCODE_1" />

That “<mapdevice>” tag is what tells MAME that “I always want my Logitech controller to be Joystick 1 in MAME.”

Now, to test, I run MAME again, this time telling it I want to use my custom config file:

 mame0226-64bit$ ./mame64 -v -ctrlr bitmaster
Note that I did *not* put “.cfg” at the end of “thebitmaster.” MAME adds this automatically.

Close to the end of the output, I see this:

 Starting Blasteroids (rev 4) ':'
 Attempting to parse: bitmaster.cfg
 Input: Remapped joystick #1: LogitechRumblePad2USB (device id: 030000006d04000018c2000000010000)
 Attempting to parse: default.cfg
 Attempting to parse: blstroid.cfg
The “Input: Remapped…” line confirms the override worked. MAME will now *always* use my Logitech for Joystick 1 no matter how many other things I plug in.

Also notice the two lines with “Attempting to parse” below that. Changes in those files are made *after* the ones in my customer “thebitmaster.cfg” file and will override them.

Now my controllers stay put. My Logitech will always be JOYCODE_1. This same procedure can be followed with multiple controllers. As long as they don't have the same ID, they will all work correctly.

I have a slightly longer writeup with details about handling the Dualshock 3, which can show up as two identical devices ALL BY ITSELF, here:

I don't know the markup for this site and I don't see a Preview button, but I'm happy to massage this however people here think is best, including removing the link to my own website.