How to configure MAME controls correctly?

I just recently finished putting together the Picade 10" on a Pi 3B+. I an existing updated Rasbian install so I manually installed Retropie on that. After finally getting sound working the next problem I have is with the controls inside MAME. I’m using lr-mame2003 as the emulator. I have no idea what’s going on the with the controls – they seem all over the place and even changed on me.

So the first problem I had was the controls were triggering the extra options (like screen record and fast-forward). So was able to edit the retroarch.conf and map those to commands to different keys. The second problem seems to the buttons not mapped to what I expect and opening the MAME menu, etc. The third problem is that the controls don’t seem to work right. Some responsiveness problems.

I noticed that MAME seems to detect the controls as RetroPad as well as a keyboard and that’s causing some conflict. Does that make sense? What is the best way to get the Picade working with MAME?

I’m also having the same problem. The difference with my setup is that I started from a fresh RetroPie image as of yesterday (v4.7.1).

I’ve configured the controls using the emulationstation wizard. When I start to play a game in mame, pushing the joystick down triggers the in-game menu shown below:

I can close it again by pressing B, but the next time I press down again, it displays. Wondering if any of the picade admins could help? I’m very new to RetroPie etc

If you need any more config info, please let me know

Thanks!

My control mappings are as follows:

Normally the Tab key on the keyboard brings up the mame in-game menu that you show on your screenshot. I would exit Emulation Station so you get the command prompt, and then see if the 4 joystick directions are behaving in the same way as the four arrow keys on a keyboard.

On your 2nd photo you show “Select + Hotkey” both on the front left button, but these should be on separate buttons. The hotkey button is usually the one on the left of the cabinet, so “LT” on your photo.

Thanks for getting back to me with some great suggestions @mironc

Firstly, I reset the controller config and mapped it again. This time mapped as follows as suggested:

I opened the command prompt and was able to move the cursor in all directions with the joystick. A/B mapped to Ctrl/Shift etc which seemed correct and matched the keys displayed during the controller setup wizard.

This time, when I opened SF2, I had to press B to insert a coin (which previously worked with select. Once I got into the game, B brought up the in-game menu as well as adding a coin every time I pressed it.

I read about the jstest tool and thought this might be useful. If I then run the following as suggested in the RetroPie doco, I get No such file or directory:

jstest /dev/input/js0

If I cd into /dev/input and ls it shows:

by-id
by-path 
event0
event1
event2
mice

So the error makes sense. There’s no js0. I’m guessing this is because the HAT is pretending to be a keyboard. I tried all of the above, and the following was the only 1 that worked:

jstest /dev/input/mice

Output

Driver version is 0.8.0
jstest is not fully compatible with your kernel. Unable to retrieve button map!
Joystick (Unknown) has 2 axes and 2 buttons.
Testing … (interrupt to exit)

I then ran through the following key presses:

up, right, down, left, a, b, x, y, ls, rs, select, start, hotkey

And got the following output (I’ve separated with spaces):

^[[A ^[[C ^[[B ^[[D <nothing> <nothing> z <nothing> x [space] o i ^[

The ones marked <nothing> are mapped to ctrl, shift and alt, so that makes sense.

Do you have any other troubleshooting steps I could perform please?

You can check that the buttons and joystick are producing to the correct key presses by running the following command:

showkey -k

The full list of key codes is here:

To exit the showkey command don’t press a key for 10 seconds.

In your output from the jstest command it looks like select and start are the wrong way round: select should be “i”, and start should be “o”

Thanks @mironc. You were right, the select/start buttons were the wrong way around. I opened up the picade and found I’d got them the wrong way around when connecting to the HAT.

I still had the problem with keys popping up in-game menus though. This post was helpful for me to understand what’s going on.

What’s happened was the menu had popped up and I’d gone into the game settings and selected one of the first options (under the Input (general) menu, and then pressed down thinking it would move to the next item, but it actually saved the down position as the configure menu key. So every time I pressed down in the game, it would show the menu.

What I’ve done to “fix” it is press the hotkey to get the menu up, then went into Input (general), then map Config Menu to return (enter button on right of picade) and On Screen Display to escape on the left side. This was tricky, as this utility keeps adding OR to the mappings. So if I press a key e.g. A, then press enter and try to map another key e.g. B, it maps to A OR B. I have to keep doing it until the maximum number of ORs are reached and it records a single key.

This has made the game playable. Now I just need to override the P1 1-6 buttons to get the right combo for SF2!

All of this tinkering around was totally worth it when I saw the delight in my 8 and 11 year old boy’s faces when they played SF2 for the first time and I taught them the special moves - priceless!

Thanks for your help