Please do not post a support request without first reading and following the advice in

Advmame controller problem

  • @spud11 Thanks!

    I wouldn't expect much to change in advancemame on this. By any account, the emulator is "working as designed" as they say. It is the game code that is ignoring player 2 controls, not mame. It simply checks the cocktail cabinet dip switch, and if it is set to upright, well there is only one joystick in the machine, so player 2 is going to share the player 1 joystick. Nothing to fix here. Not as much fun with friends, but you could use it as an opportunity to emphasize the quality of the emulation and explain how the original cabinet worked and chalk it up to "accuracy".

  • @caver01 Thanks for letting me know that - that it's unlikely to be "fixed" (not that it really needs fixing, as such, as it's just doing what it should be doing).

    By the way, given that you are using arcade joysticks, could I ask please how you have addressed the 4-way/8-way joystick problem with older games like Ms Pacman? Are your joysticks already hardware (4 way) restricted? I ask because, with mediamogul's help, I turned to xboxdrv because of its ability to software restrict my 8-way joysticks for Ms Pacman etc.

  • Global Moderator

    @spud11 said in Advmame controller problem:

    When I checked the advmame.rc again, it basically gave me this for each line:
    input_map[p2_up] keyboard[0,r] or keyboard[1,scan0] or keyboard[2,scan0]

    which might mean it can't find the extra virtual keyboards (?).

    Edit: A proper solution to this can be found at the post below.

    I noticed the same behavior today. Advance MAME/MAME can really be too smart for it's own good sometimes. It tries to set up everything automatically on every launch and ends up overwriting settings that I would prefer be set in stone.

    There may be a better way, but I took a page out of the RetroPie playbook as to how RetroArch is set up and completely restricted the software's ability to make changes to the settings. From now on, I'll be configuring all the settings manually through a text editor. What I've done is added a command to /opt/retropie/configs/all/runcommand-onstart that removes write permissions to /opt/retropie/configs/mame-advmame/advmame.rc on launch and paired it with a command in /opt/retropie/configs/all/runcommand-onend that reinstates write permissions when the software exits. For anyone interested in this madness, the examples are below.


    if [ "$2" = "advmame" ] || [ "$2" = "advmess" ]
    chmod -w /opt/retropie/configs/mame-advmame/advmame.rc
    chmod -w /opt/retropie/configs/mame-advmame/advmess.rc


    if [ "$2" = "advmame" ] || [ "$2" = "advmess" ]
    chmod +w /opt/retropie/configs/mame-advmame/advmame.rc
    chmod +w /opt/retropie/configs/mame-advmame/advmess.rc

  • @mediamogul Okay, that's interesting. Ironically, over the weekend, I decided to ditch lr-mame2003 for the landscape roms (but leaving it for the portrait mode roms) and I have, once again, reinstalled my advmame setup with its romset, with a view to trying to get the Player 2 controls separately recognised, probably with xboxdrv. It is probably a forlorn hope for me, given that the roms themselves are acting consistently with their programming, but I might as well try and see if the keyboard workaround can be made to work on my system. I'll play around with your new runcommand-onstart/runcommand-onexit commands as part of my messing around.

    One thing I was thinking of doing was, using xboxdrv, to tie all joysticks to Player 1's keyboard controls (up/down/left/right) etc, but the problem with that is that it no doubt will interfere with the 2 player simultaneous games. Having checked the forum and especially @caver01 's comments over the past 10 months, unlike the 4-way restricted games, there doesn't appear to be a comprehensive list of 2 player simultaneous games that can be "carved out".

  • @spud11 you don't have to break other games with a single rom control setup. Just add the romname/ in front of the inputs in the .rc file and they will be just for that game.

  • @caver01 Okay, thanks for that too.

  • @spud11 No prob. The .rc file is pretty sensitive to errors--mame won't launch if there is a mistake in the file. But you can use the rom prefix like a comment delimiter if it makes it easier for testing. For example, you could add the fake ROM name comment/ in front of a line to effectively have Advancemame ignore it until you launch a ROM called "comment".

  • Global Moderator


    Setting up reliable controls for Advance MAME has been a bit like wrestling a bear, but now that it's done, I'm amazed at the number of games that are finally playable on the Pi. Right off the bat I mapped a nice set of fully analog tank controls for 'Discs of TRON', and I was even able to play ATARI's 'Stun Runner', which was way past the tipping point previously. 'Tapper', 'Paperboy', 'Journey' and 'TRON' are also all performing well in the audio department after setting resample to 'internal' and the vector games are gorgeous after following your guide. Your name and insights have come up quite a few times while I've been researching all this, so I wanted to thank you personally.

  • @mediamogul Wow, that's real nice. Thanks. We each add what we can to the wealth of configuration knowledge and experience, and since my cabinet is primarily an arcade machine with real arcade controls, my contributions have been along those lines. Also, I started using another distribution--PiPlay which was built around AdvanceMAME, so I got pretty good at configuring it. We have come a long way since then, and everything keeps getting better.

    I hope to payback the compliments soon, however, as my next build project will be a TV connected box with bluetooth 8bitdo controllers. At some point, I will be diving into many of the same challenges you faced configuring the games I love. I am especially curious about Tron, DOT, and other titles that can take advantage of analog sticks.

    I am curious about a few arcade titles like Food Fight, Sinistar, and others that use either a 49-way or a hall-effect joystick. These perform clumsily on a digital 8-way stick. Do they translate better to an analog gamepad stick?

  • @spud11 I guess I overlooked your question/comment about 4-way vs. 8-way joysticks. But before I get into it, I wanted to mention that in the .rc file, if you specify your keyboard device as RAW, then all keyboards look like ONE keyboard to MAME. That saved me so much headache once I figured that out I can't even tell you. On AUTO, it was detecting multiple keyboards, and depending on USB ports and whether I had a real external keyboard attached, Keyboard [1] would get written into the config file when configuring my IPAC controls, and later, when I unplugged the external keyboard, it would move, so the inputs would no longer be recognized (the IPAC would now move to Keyboard [0]). Anyway, once I specified RAW those problems disappeared and ALL keyboard key presses were interpreted as if they were coming from a single keyboard. It no longer mattered if I attached an external. "J" was always "J" no matter where it came from.

    Now, for the 4-way and 8-way sticks, this is a real problem for folks using actual arcade controls. The only true solution is a physical restrictor plate. I'd love to try one of the expensive 360 joysticks from Ultimarc to effectively pull this off in firmware, or the Mag-stik that allows you to switch this on the fly. On Happ Supers or Competition sticks, you can make some adjustments with the actuator on the bottom of the joystick but all you are really doing is making it easier or harder to hit both microswitches in the corners.

    @mediamogul describes a way to overcome these issues with software using the xboxdriver, but from what I have heard to date, this solution is for gamepad users and won't really apply to folks like me using a keyboard controller. That's a real bummer, as I would love to have reliable 4-way control for games without giving up my 8-way setup. For now, I just have to pretend, and watch the frustration of friends when Mario gets stuck on a ladder, or PacMan doesn't turn. People usually chalk it up to user error, with the nostalgia overshadowing the bad gameplay--but I know better.

    If there is one weakness in my build, it is the 8-way sticks for 4-way games. I hate it. But whadayagonnado.

  • Global Moderator


    if you specify your keyboard device as RAW, then all keyboards look like ONE keyboard to MAME.

    ...and with that valuable tip, you've just remedied the last problem I had with Advance MAME. Restricting write access to the preferences, as I mentioned above, allowed for a hackneyed solution to set keyboard controls that wouldn't shift, but it came at the price of not being able to use the GUI and one other insurmountable problem. I always map save state an load state to 'select+r' and 'select+l' respectively, but MAME was throwing up a notice to specify the slot location that would only accept input from keyboard 0. Setting device_keyboard to 'raw' solves the whole shebang. I'll make note of it in my post above, so that no one else wastes time going in that direction.

  • @mediamogul Yeah, I don't know if I have ever mentioned raw keyboard for AdvMAME on this forum. I kinda forgot about it, to be honest, and with each new image I configure, I always pull in the changes I have made to my .rc file(s).

    I can see a possible use case for individual keyboards detected, as you could get really creative with multiple controllers, but there are more than enough keys to go around, so it doesn't make much sense to have them separated.

    I'm glad this tip helped. I was really pulling my hair out over this a long time back, almost to the point of maintaining my .rc file with a complicated spreadsheet so I could output changes that would include mapping to all "possible" keyboards attached. That would have been a big mess, especially given some of the complex mapping I have setup for games like Sarge where I am using a single joystick to drive a tank by leveraging <CODE NOT> boolean mapping for tanksticks.

  • @caver01 Oh, this is very good information - raw format. Over the past 3 or 4 days, I haven't had a chance to experiment with Advmame to see if I can make things happen the way I want them to. But I'll set things to raw mode and play around with that and xboxdrv and see if there might be some options.

    Regarding the physical restrictor gates, this is true, but you'd be surprised how well the software solution can work (at least using the joysticks I have). I'm lucky that I went the DragonRise/USB encoder route rather than IPAC, as my encoder isn't recognised as a keyboard and so it actually works well with xboxdrv. (For me, with Ms Pacman, if xboxdrv is in "8-way mode", Ms Pacman's head spins around like Linda Blair in The Exorcist, whereas it doesn't in "4-way mode". It's very funny.)

    However, before going down the xboxdrv route, I looked at other options. One such option we haven't mentioned is:

    I have not tested one of these. These guys don't ship to my country and, although I have relatives in the US who I could ship it to, it is fairly expensive (if you buy 4, as I was contemplating). Because of my setup, getting under my arcade table is a real pain, so a solution that slots over the top was what I was looking for. The seller has 3 or 4 different varieties and a proper non-ebay website too if you want to know more.

  • @spud11 I appreciate those options, and if I was starting from scratch it would be hard to ignore those possibilities. However, I can't really modify the top surface of my panel. My best option for improving 4-way is via software, or replacing my sticks with ones that are a lot more expensive that let me trigger restrictors electronically, or with digital sticks that emulate 4 way action. The fancy digital sticks like the Ultimarc 360 would be preferable, as I could also leverage this for games that want a 49-way, or hall effect pseudo-analog input.

    Still, I am VERY interested in seeing how far I could go with an IPAC and the xboxdrv. I had thought not very far, but perhaps there is a way to emulate a gamepad by way of keyboard presses? I just have not researched it.

  • Did anyone ever figure out the 2 joystick issue (without using xboxdrv)? I’m using 2 different 8bit do controllers and both p1 and p2, even after mapping separately, utilize only joy1

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.