23 December 2018

Using and configuring Joysticks with M.A.M.E./QMC2 - Update December 2018

Update December 2018: First thing to do is to test whether your joystick is fully functional under MacOS. The easiest way to do is to use an online Gamepad Tester like this one:
This gives you a basic understanding of whether your gamepad works in your OS or not. In the case of the PS4 controller, for example, everything shows up under Safari (Google Chrome misses out on the PS Button as B12), which gives you a good first feeling that this joypad should work in MacOS software.

Second, if it works, you have two choices: 

1. Leave it as is: My first joypad, for example was a Logitech F310 Gamepad, a good choice. Switched on the backside to Direct Input, it runs out of the box in QMC2. No drivers under MacOSX required.

Update November 2016: Since the X Input mode emulates XBox controllers, I gave this XBox driver from Github a try - and it works! The immediate advantage is that all things are configurable in the MacOS System Settings, and RetroArch automatically assigns the joypad to XBox configuration, which is nice. Further insights will follow, but that's a good thing. It is fully compatible with MacOS Sierra.

As a second joypad, I went for a PS4 controller, and this thing rocks, both on USB and Bluetooth. No additional drivers required. Build quality is superb, this is a clear recommendation. It is still my favorite joypad for MAME.

Read further for MAME Joystick settings...

2. Configure your joypad within MAME. The main task here is to have these settings stored in /cfg/default.cfg  Once done, you can transfer it as your specific configuration to a new version of MAME.

Important Update December 2018: MAME quite frequently updates default.cfg, which makes this a dangerous place for keeping your favourite configuration. The following hack seems to work for me, and it seems the real way to go:

  • First, I configured my PS4 joypad as described below under "MAME Joystick settings".
  • Then I renamed this default.cfg file to controller-ps4.cfg and moved it into the ctrlr directory.
  • Finally, in the mame.ini, you check the following two parameters:
    • ctrlrpath                 ctrlr     (it should be like this)
    • ctrlr                     controller-ps4 (this is empty by default, and here comes your filename generated in the previous step
Two big advantages of this tweak: Your joystick settings get away from default.cfg, which from time to time gets reset (at least I think so). Also you can manually switch joystick profiles in your mame.ini, which is the way I prefer when trying out a different joystick - I just leave the other configuration intact.

Back to MAME Joystick Settings: In MAME, the configuration of the settings are a bit tricky. You must get accustomed to the interface in MAME and can reconfigure Control settings. These were the really important things to do:
Input General/Other Controls/Coin 1 - assign a joystick button so that you can insert coins with it
Input General/Other Controls/1 Player Start - start game with one player
Input General/Other Controls/2 Player Start - start game with two players
Input General/User Interface/UI Cancel - exit the UI and the game
This is how I get bets results: Launch any game and enter the MAME Menu with TAB. Then head for the general Input Configuration and head for the above mentioned options.
- Press RETURN to adjust a control -> go for the joypad control
- Press RETURN for a second time -> add the keyboard control
- Exit the Control section and enter the game again by pressing TAB
As a result you have both joypad and keyboard control in place.

Important: If everything went smoothly, your MAME Joystick Settings are from now on stored in /cfg/default.cfg in a readable XML version. As soon as you migrate these settings, you should enjoy these settings in the next MAME version as well! For my PS4 controller, default.cfg reads as follows:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="default">
            <port type="P1_START">
                <newseq type="standard">
                    JOYCODE_1_BUTTON10 OR KEYCODE_1
            <port type="P1_SELECT">
                <newseq type="standard">
                    JOYCODE_1_BUTTON9 OR KEYCODE_5
            <port type="START1">
                <newseq type="standard">
                    JOYCODE_1_BUTTON10 OR KEYCODE_1
            <port type="COIN1">
                <newseq type="standard">
                    JOYCODE_1_BUTTON9 OR KEYCODE_5
            <port type="UI_CANCEL">
                <newseq type="standard">


Result: Player 1 Start, Player 1 Select, Start1, Coin1 and UI Cancel are both assigned to the joypad and the keyboard. Migration to the next MAME version works.


3. QMC2 Basic Settings: Tools/Options/Frontend/Joystick/Enable Joystick Control set to on
After pressing Rescan joysticks, the F310 is immediately recognized and configured as Logitech Dual Action. That's all to do for a successful start.

By pressing the Mode button, you can switch between the Left Analogue Control and the 4-Switch D-Pad. I like the Analogue Control a lot, in particular when it comes to playing Gyruss.

QMC2 Extended Joystick Settings: There are some very nice things in QMC2 that make your joystick even more valuable - go again to Tools/Options/Frontend/Joystick - Map

Joypad Calibration can be important: Prior to assigning keys to the QMC2 frontend, please be sure that you calibrate your joypad. In my case I had to define Deadzones for the analogue controls so that they would not interfere with the digital pad, which I user for Cursor up and Cursor down. See this screenshot:

Without such deadzones, joypad control in QMC2 proved unreliable and useless. Until now, I  did not experience any impact on the gameplay, but it's a trial-and-error thing -> the blue lines should be completely steady after Deadzones.

Cursor up and Cursor down - allows you to move through your games list with your joystick
Play (independent) - for starting a game with your joystick


  1. I don't suppose you have any issues or tips on getting the mouse analog input working for a game like Arkanoid?

    1. There are some issues with mice on OS X and sdlmame.

      Are you running sdlmame directly or using QMC2?

      If using QMC2, you have to enable mouse in "Input Options" and also map "panel device" to mouse in "automatic device selection"
      (These are all in config window)

      If using sdlmame directly, you have to use "-mouse" and "-paddle_device mouse" options.


Any comments are welcome!