RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Advmame controller problem

    Scheduled Pinned Locked Moved Help and Support
    advmame 1.4controller
    32 Posts 6 Posters 15.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mediamogulM
      mediamogul Global Moderator @spud11
      last edited by mediamogul

      @spud11

      Advance MAME seems to get confused if two of the same controllers are used. It took me a while to come up with a workable solution and there might be a better way, but I ended up mapping both controllers to full keyboard input with each button having a separate key using xboxdrv. This was still a problem, because Advance MAME still got confused about what it deemed to be identical keyboards. I finally had to edit /opt/retropie/configs/mame-advmame/advmame.rc to map each key to be valid no matter what keyboard it was coming from. An example of mapping the 'B' button of my controller, which was mapped to the 'B' key of the xboxdrv virtual keyboard to player 1, button 1 of the Advance MAME config looks like:

      input_map[p1_button1] keyboard[0,b] or keyboard[1,b] or keyboard[2,b]
      

      Hopefully someone will have an easier alternative, but I've been using this for a while and at the very least, it works.

      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

      S 1 Reply Last reply Reply Quote 1
      • F
        ferdnand
        last edited by

        Also how do you exit a game , I would like "start+select", to exit.... Someone please come up with a script to map controller with, please

        caver01C 1 Reply Last reply Reply Quote 0
        • mediamogulM
          mediamogul Global Moderator @ferdnand
          last edited by mediamogul

          @ferdnand

          how did you get your controller for player one mapped... Also how do you exit a game , I would like "start+select", to exit.

          Have you tried mapping controls from the MAME menu? It can be invoked bay pressing the 'tab' key on your keyboard. The menu entry for mapping the exit function is listed as 'UI Cancel'. If you highlight that and press 'enter' the software will wait for you to press a button or button combo. In your case, you would then press the 'start' and 'select' button at the same time.

          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

          1 Reply Last reply Reply Quote 1
          • S
            spud11 @mediamogul
            last edited by

            @mediamogul Thanks for your help and just so you know, this is now my "landscape" mode setup, rather than "portrait". I'm basically exclusively reserving lr-mame2003 for portrait mode only, and intend to use advmame (or any other emulator/core that works) for landscape mode.

            So I went into Ms Pacman via advmame, pressed TAB and I tried first by removing all joysticks inputs, and then remapping each key for players 1 and 2 to separate keys. I then changed the advmame.rc as so:

            input_map[p1_up] keyboard[0,up] or keyboard[1,up] or keyboard[2,up]
            input_map[p1_down] keyboard[0,down] or keyboard[1,down] or keyboard[2,down]
            input_map[p1_left] keyboard[0,left] or keyboard[1,left] or keyboard[2,left]
            input_map[p1_right] keyboard[0,right] or keyboard[1,right] or keyboard[2,right]
            input_map[p1_button1] keyboard[0,lcontrol] or keyboard[1,lcontrol] or keyboard[2,lcontrol]
            input_map[p1_button2] keyboard[0,lalt] or keyboard[1,lcontrol] or keyboard[2,lcontrol]
            input_map[p1_button3] keyboard[0,space] or keyboard[1,space] or keyboard[2,space]
            input_map[p1_button4] keyboard[0,lshift] or keyboard[1,lshift] or keyboard[2,lshift]
            input_map[p2_up] keyboard[0,r] or keyboard[1,r] or keyboard[2,r]
            input_map[p2_down] keyboard[0,d] or keyboard[1,d] or keyboard[2,d]
            input_map[p2_left] keyboard[0,s] or keyboard[1,s] or keyboard[2,s]
            input_map[p2_right] keyboard[0,f] or keyboard[1,f] or keyboard[2,f]
            input_map[p2_button1] keyboard[0,a] or keyboard[1,a] or keyboard[2,a]
            input_map[p2_button2] keyboard[0,s] or keyboard[1,s] or keyboard[2,s]
            input_map[p2_button3] keyboard[0,q] or keyboard[1,q] or keyboard[2,q]
            input_map[p2_button4] keyboard[0,w] or keyboard[1,w] or keyboard[2,w]
            

            And then I tried playing just with the keyboard. Again, player 2's movement was governed by player 1's keyboard controls.
            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 (?).

            I've not invoked xboxdrv at the moment as I was just trying to see whether the keyboard commands would work.

            RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

            mediamogulM 2 Replies Last reply Reply Quote 0
            • mediamogulM
              mediamogul Global Moderator @spud11
              last edited by mediamogul

              @spud11

              That's pretty squirrely. I'm not sure if any of this is specifically buggy behavior, but rather the software trying to be too smart for it's own good by adapting to what it thinks are multiple controls. I'd be most interested for @edmaul69 to weigh in on this as well. He's been testing a version that is supposed to address these issues. For me, the method I landed on above is holding strong, but it's a kludgy resolution at best.

              RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

              S 2 Replies Last reply Reply Quote 1
              • S
                spud11 @ferdnand
                last edited by

                @ferdnand Hi. If you are using 1 controller only, it should be reasonably easy to map the controls.

                Just make sure you've got a keyboard attached and press TAB. That will bring up a sub-menu with "Input - General" and "Input - Game". If this is the first time you've messed around with advmame, probably best to pick the second option in case you mess it up. Then with the keyboard just navigate, press "enter" and press the button on the joystick that you want to use. Same with the joystick axes.

                After mapping everything, navigate with the keyboard down to "return to game". It will automatically save the inputs you've put in to advmame.rc.

                RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                1 Reply Last reply Reply Quote 1
                • S
                  spud11 @mediamogul
                  last edited by

                  @mediamogul Yeah, it's a bit weird. I was even thinking of forgetting advmame and just proceeding with fba or lr-mame2010, but that would be a bit of a pity, given that I've already got the advmame romset sorted out.

                  RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                  1 Reply Last reply Reply Quote 0
                  • caver01C
                    caver01 @ferdnand
                    last edited by

                    @ferdnand said in Advmame controller problem:

                    Also how do you exit a game , I would like "start+select", to exit.... Someone please come up with a script to map controller with, please

                    You can simply map to button presses at once to UI Cancel. In the mame GUI, map UI Cancel, and when it is time to press the key, press BOTH start and select, then wait for it to accept. It will create a <CODE AND> entry, which is to say, it will require both keys pressed at the same time to register the function, which is what you are asking for.

                    My 4-player cocktail style cabinet built as a custom "roadcase"

                    S 1 Reply Last reply Reply Quote 1
                    • caver01C
                      caver01
                      last edited by

                      @spud11 I had a thought about your experience with mspacman. It strikes me that unless you have the virtual DIP switch set to cocktail mode, that this game does indeed use player 1 controls for player 2. Follow me here. Imagine the actual arcade system, a stand-up cabinet with a single joystick. Where is player 2 controls? There are none. On the real game, you have to share the same joystick. Well, that may be exactly why that game is behaving the way it is.

                      Now, if you enable Cocktail mode, which is for a specific kind of cabinet, with two sets of joysticks across from each other, you get the different controls for player 1 and 2 because they are actually different controls on the real system. Of course, the screen also flips.

                      This same effect happens in Black Tiger as well, where the controls for player 2 don't really do anything unless running in cocktail mode.

                      In the end, this might just be accurate emulation of the real hardware.

                      My 4-player cocktail style cabinet built as a custom "roadcase"

                      S 1 Reply Last reply Reply Quote 1
                      • S
                        spud11 @caver01
                        last edited by

                        @caver01 Well, I've certainly learnt something new. I didn't realise the Advmame TAB setup was so sophisticated that it allowed this kind of key setup. That's really helpful. Thanks, caver01.

                        RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                        1 Reply Last reply Reply Quote 0
                        • S
                          spud11 @caver01
                          last edited by

                          @caver01 That makes 100% sense to me. The only thing that strikes me though is why advmame would allow us to set up 2 Player controls that are different from 1 Player controls, if it's not going to allow us to use those controls. But I think you've got to the nub of the problem. I'll be posting a response to mediamogul's comments in a minute too.

                          RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                          caver01C 1 Reply Last reply Reply Quote 0
                          • S
                            spud11 @mediamogul
                            last edited by

                            @mediamogul I thought about this problem overnight. It strikes me that I should be able to use my existing lr-mame2003/xboxdrv setup to bypass this issue with advmame.

                            xboxdrv allows me to map all 4 joysticks to the same keyboard settings for lr-mame2003. So what I've done is map Joysticks 3 and 1 to Player's 1 keyboard controls and Joysticks 2 and 4 to Player 2's keyboard controls. What this means is that it doesn't matter whether the game is in Portrait mode or in Landscape mode, I can either use Joystick 1 or Joystick 3 for Player 1 depending on the orientation; same with Player 2, using Joystick 2 or 4. I've tested this with Ms Pacman "in game" and it appears to work as it records movement with Joysticks 1 and 3 whilst playing Player 1; same with Player 2 using Joysticks 2 and 4.

                            So what I'll probably do now is setup a new folder for the lr-mame2003 romset in landscape mode and remove the advmame romset for the time being. I'll post my new xboxdrv code in the "Advanced Mapping Guide" thread.

                            RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                            1 Reply Last reply Reply Quote 0
                            • caver01C
                              caver01 @spud11
                              last edited by caver01

                              @spud11 I get your frustration about this. I thought the same thing with Black Tiger a while back. It is a horizontal game, and I wanted player 2 to use a second set of controls I have mounted in that orientation, but was angry when the game insisted I use player 1's joystick. Then I tried cocktail mode, which worked, but it was upsidedown for player 2.

                              So, the reason it lets you set separate controls for player 2 is for when you have a cabinet setup in cocktail mode that does indeed have separate controls. It would seem that the original game hardware would have to accommodate a second set of controls with this cabinet style. Otherwise, it all plays on the same joystick which is why the player 2 config is ignored on a regular cabinet. Makes sense, just doesn't make us very happy. It is easy to forget that the emulator is simply reproducing the capabilities of the original hardware, not merely adapting the gameplay to our modern control systems.

                              My 4-player cocktail style cabinet built as a custom "roadcase"

                              S 1 Reply Last reply Reply Quote 2
                              • S
                                spud11 @caver01
                                last edited by

                                @caver01 Yep, it's really quite remarkable how far emulation has come, particularly in the last 3-4 years, as we can now much more easily create the "look" of an arcade machine with the Raspberry Pi as the guts of it.

                                Hopefully, the author of advmame will find a software solution to what is an issue caused by perfect hardware emulation (as you've said). In the meantime, I'll probably just use lr-mame2003 with xboxdrv. I started using that core in the first place because I found that with a 1920x1200 monitor I was able to implement "real" full screen resolution more easily, than with advmame .

                                I love your build, by the way. I took note of it when you first put the screenshots up. A labour of love.

                                RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                caver01C 1 Reply Last reply Reply Quote 0
                                • caver01C
                                  caver01 @spud11
                                  last edited by caver01

                                  @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".

                                  My 4-player cocktail style cabinet built as a custom "roadcase"

                                  S 1 Reply Last reply Reply Quote 2
                                  • S
                                    spud11 @caver01
                                    last edited by

                                    @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.

                                    RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                    1 Reply Last reply Reply Quote 0
                                    • mediamogulM
                                      mediamogul Global Moderator @spud11
                                      last edited by mediamogul

                                      @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.

                                      runcommand-onstart

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

                                      runcommand-onend

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

                                      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        spud11 @mediamogul
                                        last edited by

                                        @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".

                                        RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                        caver01C 2 Replies Last reply Reply Quote 0
                                        • caver01C
                                          caver01 @spud11
                                          last edited by

                                          @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.

                                          My 4-player cocktail style cabinet built as a custom "roadcase"

                                          S 1 Reply Last reply Reply Quote 1
                                          • S
                                            spud11 @caver01
                                            last edited by

                                            @caver01 Okay, thanks for that too.

                                            RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                            caver01C 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.