Adafruit GPIO Arcade Controller not Working in MAME
-
Well last night I was testing other things with retropie, and ended up plugging in my X-box one control in through USB, configured the controls in emulation station, launched one of my ROMs (roboroto) and it was working just fine, and the joystick works fine in emulation station before launching a ROM and it doesn't when it launches so that is where I'm at.
-
@mrinfected101 I had a thought. . . in another thread a couple days ago there was a user who had a keyboard controller wired up to the Player1 joystick. Everything worked in ES, but in lr-mame2003, left and right failed. Turns out, they had the joystick wired backwards. Left was wired to right and so on.
You normally would not think it matters because you are mapping the controls, right? But in MAME, the emulator was accepting two inputs at the same time--the virtual retropad mapping from RetroArch/ES configuration, and the RAW keystrokes. This dual input situation in mame2003 is documented in other threads and is rarely a problem. Anyway, we suspect that when they were pushing LEFT on the joystick, the retropad was sending LEFT inputs, but at the same time, the raw key that was sent was RIGHT--the opposite because it was wired backward. MAME was also seeing this input and the result was cancelling the movement seen by the game.
Is your joystick perhaps wired arbitrarily/incorrectly? In other words, regardless of how you have it setup in ES and Retroarch, does pushing UP actually send UP key, or is it sending something else? If you were to bring up a command prompt, could you move the cursor with your joystick?
-
@caver01 Well when I open the command prompt its not displaying any command lines when I press keys, when I configured the controls in command prompt I did as follows, downloaded the retrogame git clone, then ls, enter, cd Adafruit-Retrogame/ , enter, cd configs, enter, nano retrogame.cfg, enter, then configured the GPIO pins to controls, ex: pin 16 is left on the stick.
-
@mrinfected101 Well, you might not notice everything the keys are doing at a command prompt unless you know exactly what to expect. For instance, player one directions are just the arrow keys by default in MAME, so unless you know that, you might not notice what moving the joystick is doing at a command prompt. Other button defaults may include LeftControl, or LeftAlt, space, etc, so these also may not be obvious. I was just wondering if you can even prove that they are actually sending inputs.
One idea you could try is to run the advk utility from the bin directory of advancemame (any version) This should let you test whether your arcade controls are generating keystrokes at least.
-
@caver01 When I was mapping my keys, I was able to check they were sending the virtual key outputs, is that what you mean?
-
@mrinfected101 Yes, that is part of it--you definitely need to be certain that when you trigger an input, that it sends a virtual keypress that you intend. The second part from above is the fact that MAME2003 expect certain keyboard defaults, regardless of how you map things in retroarch. For most people, the retroarch mappings override, but for keyboard controller users like us, it is important to be aware of that this version of mame actually sees two inputs at once. This is basically a bug that has been allowed to languish because it does not have any serious impact to the emulation and there are workarounds easier than than fixing it. SO, this second part may be an issue. If you have RIGHT ARROW mapped to the left movement of your joystick which would be backwards, retroarch will send the corrected, remapped MOVE LEFT input (using a virtual retrogame controller) but MAME will simultaneous see a raw keypress RIGHT ARROW which it interprets as right movement. In other words, the contradiction would cancel itself and it would seem like your joystick does not work.
It might be a big coincidence if you are setup this way, but it did just come up on another thread within the past couple of weeks, and I know how easy it is to get things wired in reverse when looking at a joystick from the bottom.
-
So I should try remapping the joystick in emulation station, also what about the buttons, because those aren't working either
-
@mrinfected101 If you haven't remapped back to your adafruit keyboard controller connected buttons since trying your xbox controller, yes, I would.
-
@caver01 I've remapped the controls, and tried inverting the controls, still have nothing...
-
@mrinfected101 Well, I am at a loss. Since your original post says that the emulators work with the keyboard, just not with the joystick, I gotta believe there is something amiss with the adafruit/retrogame configuration. In some ways, RetroPie is working, but your adafruit stuff isn't.
I know controller setup is the most common challenge people face with RetroPie, but this one might be better asked of Adafruit. Perhaps they have some specific suggestions for when this comes up. I would definitely open a dialog on their forum if you haven't already.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.