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

    Guide: Advanced Controller Mappings

    Scheduled Pinned Locked Moved Help and Support
    joystickcontrollermappingxboxdrvscummvm
    626 Posts 35 Posters 481.6k 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.
    • RiverstormR
      Riverstorm
      last edited by Riverstorm

      Also something odd is it seems the X/Y axis is "inverted" on the d-pad vs. the left/right stick on a 360 controller using evtest /dev/input/event[event1] so in the script above I have HAT0Y as X and HAT0X as Y.

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

        @Riverstorm

        Good 4-way games are lost to simple mistakes of not hitting that ladder squarely in Donkey Kong, etc. using controllers.

        I hear you. Correcting that issue is probably my favorite use of all this stuff.

        Do I use the output from evtest /dev/input/event[event1] and add it 3 times as shown below?

        Seeing as how you have two different models, I'd at least confirm that they're all identifying the same way. When mapped, xboxdrv will delineate them from the --evdev location you enter. I assume that there are four unique entries at /dev/input/by-id/?

        Also with a 360 controller I didn't get output for rt/lt or at least I assigned them to buttons TL2 & TR2 as they aren't an axis?

        Based on your listing, they appear to be buttons, as BTN_ denotes buttons and ABS_ denotes an axis.

        Lastly should I use the option to make the triggers into buttons on a 360 controller. I added the option below.

        That's what I do and mine are definitely buttons already. If I'm remembering correctly, it adds a bit of flexibility for using them as hotkeys if need be.

        Lastly, lastly do I need to use the rename parameter for each controller as I have 4 but they are all the same.

        I would, yes. It helps certain software delineate the controllers and it really helps visually when you're trying to identify them yourself.

        Also something odd is it seems the X/Y axis is "inverted" on the d-pad vs. the left/right stick

        This seems to be normal behavior with all controllers for some reason. Our approaches may differ, but below, you'll see I used --axismap -Y1=Y1,-Y2=Y2 to correct the issue on mine. The example is a base command I use for 4-way restriction with no other fancy additions, so it should also answer your question about the restriction method itself. All that ever needs to be added to any command is --four-way-restrictor to make it happen. However, you can also restrict the DPad with --modifier dpad-restrictor=fourway. It's arguably unnecessary due to most DPads being restricted by design, but I usually add it anyway for good measure.

        Below that I'll post a listing of all the arcade ROMs that I currently 4-way restrict. Over time, I've actually started doing this for similar games on most older console platforms as well. It really pays off more often than you'd think.

        sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
          --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2.1:1.0-event-joystick \
          --detach-kernel-driver \
          --force-feedback \
          --trigger-as-button \
          --deadzone-trigger 15% \
          --deadzone 4000 \
          --device-name "Logitech Rumblepad 2 (xboxdrv)" \
          --silent \
          --axis-sensitivity X1=-0.00,Y1=-0.00,X2=-0.00,Y2=-0.00 \
          --four-way-restrictor \
          --modifier dpad-restrictor=fourway \
          --axismap -Y1=Y1,-Y2=Y2 \
          --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
          --evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
          --ui-buttonmap guide=void \
          &
        
        ncv2.zip
        mspacmnf.zip
        alibaba.zip
        amidar.zip
        armwrest.zip
        astinvad.zip
        atetris.zip
        anteater.zip
        armorcar.zip
        astrob.zip
        astrof.zip
        bagman.zip
        ballbomb.zip
        barrier.zip
        blkhole.zip
        blasto.zip
        blockade.zip
        btime.zip
        carjmbre.zip
        carnival.zip
        cavelon.zip
        chameleo.zip
        checkman.zip
        chinhero.zip
        circusc.zip
        ckong.zip
        commando.zip
        dazzler.zip
        devilfsh.zip
        digdug.zip
        digdug2.zip
        digger.zip
        disco.zip
        dkong.zip
        dkong3.zip
        dkongjr.zip
        docastle.zip
        dommy.zip
        dorodon.zip
        frogger.zip
        galaga.zip
        galaxian.zip
        galxwars.zip
        guzzler.zip
        invrvnge.zip
        invinco.zip
        jjack.zip
        joust2.zip
        jrpacman.zip
        jumpcoas.zip
        jungler.zip
        kchamp.zip
        kchampvs.zip
        kicker.zip
        kingball.zip
        ladybug.zip
        lasso.zip
        levers.zip
        lnc.zip
        locomotn.zip
        logger.zip
        lrescue.zip
        lupin3.zip
        mappy.zip
        marvins.zip
        mikie.zip
        mmonkey.zip
        monsterb.zip
        moonal2.zip
        moonqsr.zip
        mrdo.zip
        mrflea.zip
        mrjong.zip
        mrtnt.zip
        mspacman.zip
        mystston.zip
        naughtyb.zip
        netwars.zip
        olibochu.zip
        ozmawars.zip
        pacnpal.zip
        pacplus.zip
        pengo.zip
        perestro.zip
        pickin.zip
        pignewt.zip
        pisces.zip
        pleiads.zip
        pooyan.zip
        popflame.zip
        puckman.zip
        pacman.zip
        pulsar.zip
        qix.zip
        radarscp.zip
        retofinv.zip
        rocnrope.zip
        route16.zip
        samurai.zip
        tsamurai.zip
        scregg.zip
        sindbadm.zip
        solarfox.zip
        sonofphx.zip
        invadpt2.zip
        panic.zip
        shollow.zip
        spclaser.zip
        streakng.zip
        sbagman.zip
        superpac.zip
        superqix.zip
        ssi.zip
        swat.zip
        tactcian.zip
        tankbatt.zip
        taxidrvr.zip
        elecyoyo.zip
        theend.zip
        timelimt.zip
        tomahawk.zip
        todruaga.zip
        tranqgun.zip
        triplep.zip
        tutankhm.zip
        vanvan.zip
        volfied.zip
        vsgongf.zip
        wiping.zip
        warpwarp.zip
        zigzag.zip
        zzyzzyxx.zip
        alphaho.zip
        pacnchmp.zip
        comotion.zip
        copsnrob.zip
        cosmicg.zip
        cosmos.zip
        crash.zip
        crush.zip
        redufo.zip
        diamond.zip
        dorunrun.zip
        dominos.zip
        drmicro.zip
        drgnbstr.zip
        dremshpr.zip
        elvactr.zip
        eyes.zip
        firetrap.zip
        40love.zip
        galpanic.zip
        gundealr.zip
        hardhat.zip
        headon.zip
        headon2.zip
        heiankyo.zip
        hexa.zip
        hustle.zip
        intrepid.zip
        ironhors.zip
        karianx.zip
        kungfum.zip
        lvgirl94.zip
        logicpro.zip
        logicpr2.zip
        msjiken.zip
        kikcubic.zip
        mineswpr.zip
        mtrap.zip
        dowild.zip
        mrgoemon.zip
        natodef.zip
        rallyx.zip
        nrallyx.zip
        pepper2.zip
        pettanp.zip
        popeye.zip
        punchout.zip
        raiders5.zip
        rampage.zip
        reikaids.zip
        robby.zip
        rthunder.zip
        sidetrac.zip
        schaser.zip
        spaceinv.zip
        spacezap.zip
        spectar.zip
        springer.zip
        stratvox.zip
        sia2650.zip
        spnchout.zip
        tapper.zip
        rbtapper.zip
        targ.zip
        telmahjn.zip
        theglob.zip
        thief.zip
        timber.zip
        toypop.zip
        wwjgtin.zip
        wndrmomo.zip
        yamyam.zip
        zerozone.zip
        zookeep.zip
        pairs.zip
        higemaru.zip
        elecyoy2.zip
        

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

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

          @riverstorm

          Ah, I almost forgot to give an example of how you would handle this ROM-specifically from the runcommand-onstart. There are quite a few ways actually, but this is probably the easiest to illustrate and it uses the xboxdrv launch command I posted above. You'll notice I only used three games, but you can add as many as you want accordingly.

          ROMNAME="${3##*/}"
          if [ "$ROMNAME" = "pacman.zip" ] || [ "$ROMNAME" = "mspacman.zip" ] || [ "$ROMNAME" = "jrpacman.zip" ] && [ "$2" = "advmame" ]; then
            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2.1:1.0-event-joystick \
              --detach-kernel-driver \
              --force-feedback \
              --trigger-as-button \
              --deadzone-trigger 15% \
              --deadzone 4000 \
              --device-name "Logitech Rumblepad 2 (xboxdrv)" \
              --silent \
              --axis-sensitivity X1=-0.00,Y1=-0.00,X2=-0.00,Y2=-0.00 \
              --four-way-restrictor \
              --modifier dpad-restrictor=fourway \
              --axismap -Y1=Y1,-Y2=Y2 \
              --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
              --evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
              --ui-buttonmap guide=void \
          fi &
          

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

          1 Reply Last reply Reply Quote 0
          • RiverstormR
            Riverstorm
            last edited by

            @mediamogul - Thank you for the help and information. I am going to give it a shot and will let you know how it turns out. I have a few more questions but you've given me plenty here to get started, thank you good sir and have a great weekend.

            On a side note, are from the Carolina's? I have no idea why I keep thinking you are from that area and I was thinking of you during the weekend of that devastating hurricane. If I remember you were doing yard work in like April with some nice weather and we got hammered here for one of the biggest snows on record that month. I almost posted a pic for you to check it out. ;)

            mediamogulM 1 Reply Last reply Reply Quote 0
            • RiverstormR
              Riverstorm
              last edited by Riverstorm

              @mediamogul - Just to clarify one thing below. I've been following your guide and in the example you'll see tl and tr in the keymap line shown below from the guide examples but on the controller mapping diagram it shows as lt and rt is that a typo in the line?

              --evdev-absmap ABS_[X]=x1,ABS_[Y]=y1,ABS_[RX]=x2,ABS_[RY]=y2,ABS_[•]=lt,ABS_[•]=rt,ABS_[HAT0Y]=dpad_x,ABS_[HAT0X]=dpad_y \
              --evdev-keymap BTN_[SOUTH]=a,BTN_[EAST]=b,BTN_[NORTH]=x,BTN_[WEST]=y,BTN_[TL]=lb,BTN_[TR]=rb,BTN_[TL2]=tl,BTN_[TR2]=tr,BTN_[MODE]=guide,BTN_[SELECT]=back,BTN_[START]=start \
              

              Also since my triggers register as buttons do I just delete these two entries from absmap line and only use the keymap entries ?

              ABS_[•]=lt,ABS_[•]=rt
              
              1 Reply Last reply Reply Quote 0
              • mediamogulM
                mediamogul Global Moderator @Riverstorm
                last edited by mediamogul

                @riverstorm said in Guide: Advanced Controller Mappings:

                On a side note, are from the Carolina's? I have no idea why I keep thinking you are from that area and I was thinking of you during the weekend of that devastating hurricane.

                I am indeed sir. Born and bred in the briar patch of beautiful South Carolina. We got really lucky in my area. Of course, I'll still be spending most of the weekend and probably next on cleanup. However, no trees came down, which is always a good thing.

                I almost posted a pic for you to check it out.

                Hey, never hesitate. I love seeing that stuff. Nature, with all of its crazy ups and downs, is the main reason I enjoy living here so much.

                I've been following your guide and in the example you'll see tl and tr in the keymap line shown below from the guide examples but on the controller mapping diagram it shows as lt and rt is that a typo in the line?

                Actually, they're a separate entry. The 'tl/tr' listings are the xboxdrv equivalent to what's more commonly referred to as 'l3/r3', which are the buttons activated by pressing down the two thumbsticks.

                Also since my triggers register as buttons do I just delete these two entries from absmap line and only use the keymap entries ?

                I believe you would, yes.

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

                1 Reply Last reply Reply Quote 0
                • RiverstormR
                  Riverstorm
                  last edited by

                  @mediamogul said in Guide: Advanced Controller Mappings:

                  I am indeed sir. Born and bred in the briar patch of beautiful South Carolina. We got really lucky in my area. Of course, I'll still be spending most of the weekend and probably next on cleanup. However, no trees came down, which is always a good thing.

                  In the briar patch eh, love it! ;) That's great to hear! Mother nature can be a nasty girl for sure. I'll be spending about half my weekend outdoors too just "winterizing". It's getting pretty cold at night. I think the 30s this evening (frost advisories) and 50s during the days.

                  I replaced the soffit and fascia on the shed that needs painting, replace an outdoor water faucet, seal my garage floor (the chemicals on the streets they use to melt snow eats concrete pretty good), drain hoses, pack-up summer deck chairs, tables, umbrella, bikes, etc.

                  You can delete this pic as not to to go off topic with pics of snow and controllers but here's a pic of what's happening on the west side of the state, here, today. Way to early for this stuff but the good is we won't see it here on the east side of the state, today at least but it's coming soon. ;)

                  I'll get you a pic of that storm this past spring. It was pretty neat to see it that deep so late in the season, my youngest daughter had a ball in it!

                  0_1538173654415_Snow.jpg

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

                    @riverstorm said in Guide: Advanced Controller Mappings:

                    here's a pic of what's happening on the west side of the state, here, today.

                    Wow, that was yesterday? With enough distance you can't help but see it as a work of art, but I'm sure you guys feel a fair amount dread along with it. Exactly where do you hail from again?

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

                    RiverstormR 1 Reply Last reply Reply Quote 0
                    • RiverstormR
                      Riverstorm @mediamogul
                      last edited by

                      @mediamogul said in Guide: Advanced Controller Mappings:

                      Exactly where do you hail from again?

                      Yeah that was this past weekend even though it's a bit early for snow. To be honest I actually love the snow and cold. It's the cold and wind combined that I don't care for so much.

                      I am in South Dakota. So we here can appreciate that north/south distinction like you but some just don't care and lump as one in their mind. ;)

                      The Missouri river divides the state almost down the middle and that's where the time zone changes from Mountain to Central. People in Mountain time are referred to as West River and those in Central are East River. West has the scenic Black Hills, Badlands, Mt. Rushmore, Sylvan Lake (it was in the movie National Treasure but it's not behind Mt. Rushmore). The area is surprisingly great for really decompressing and taking all that scenic nature in if you can break yourself away from the tech you remember how nice it can really be outdoors. The East is much flatter more about agriculture and livestock. It's more metropolitan but still good hunting, camping, fishing, etc.

                      I love camping and fishing but not so much hunting but we will drive out in the country to shoot guns at whatever. Hunting is huge here and brings in a lot of tourists in the fall. Our population density is real low so if you like wide open spaces or a quiet acreage you got it within 10 minutes in any direction. We did make the top 5 places to live this year but the one demographic that is highly held as negative is the weather, people just don't like snow and cold. They just need to get in touch with their inner child and build a snowman again! ;)

                      mediamogulM 1 Reply Last reply Reply Quote 0
                      • RiverstormR
                        Riverstorm
                        last edited by

                        @mediamogul - An actual post related question. ;) Yeah I was confused when I saw rt/tr. I thought it was a typo as they are just inverse but both are different mappings. I see now what you were saying.

                        Also you're correct it does list all 4 joysticks in by-id. I use two different Microsoft wireless dongles and the 'by-id' name seems to change based on which Microsoft wireless dongle is in use. The E0C number part of the name listed below is what's changing but the rest of the name is consistent. Is this possible to include?

                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0C26450-event-joystick
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0C26450-if02-event-joystick
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0C26450-if04-event-joystick
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0C26450-if06-event-joystick
                        
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0CA52D0-event-joystick
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0CA52D0-if02-event-joystick
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0CA52D0-if04-event-joystick
                        usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0CA52D0-if06-event-joystick
                        

                        The other thing is the D-Pad. I see it's has both an ABS and BTN value such as BTN_TRIGGER_HAPPY1 and ABS_HAT0X should I add them both, one each to the absmap and keymap lines? Does it distinguish between the two somehow?

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

                          @riverstorm said in Guide: Advanced Controller Mappings:

                          Sylvan Lake (it was in the movie National Treasure but it's not behind Mt. Rushmore)

                          Ha! I like those movies well enough myself, but I've talked with so many history and geography buffs that go off on them for those inaccuracies. It's a bit understandable too. I mean, each outing they spend half the movie trying to wow the audience with little known facts about America and then proceed to misrepresent just as many for the sake of convenience. Nonetheless, SD sounds like my kind of country for sure. Rumor has it, you guys are hiding a West Dakota from the tourists and keeping it's ultimate splendor to yourselves. If I ever happen to make it out that way maybe you could get me past the bouncer.

                          The E0C number part of the name listed below is what's changing but the rest of the name is consistent. Is this possible to include?

                          If you use the by-id location for the --evdev argument, it'll assure that the controllers are delineated properly.

                          The other thing is the D-Pad. I see it's has both an ABS and BTN value such as BTN_TRIGGER_HAPPY1 and ABS_HAT0X

                          Each controller should either have one or the other. You said that you have two controller types, so is it that the DPad differs between the two? Keep in mind that the controllers are not mapped all together. Each instance of xboxdrv maps a separate controller, so if it is that the inputs differ between types, they can be mapped accordingly in their own instance.

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

                          RiverstormR 1 Reply Last reply Reply Quote 0
                          • RiverstormR
                            Riverstorm @mediamogul
                            last edited by

                            @mediamogul said in Guide: Advanced Controller Mappings:

                            I mean, each outing they spend half the movie trying to wow the audience with little known facts about America and then proceed to misrepresent just as many for the sake of convenience.

                            To true! I think that's how rumors get started by mixing fiction/non-fiction. "Duh, haven't you seen National Treasure? Everyone knows there's a lake behind Mt. Rushmore!"

                            The wife cleared me so if you're ever in this area ping me in a post and we'll take you out for dinner. Her only condition was she wants to tag along on the trip to West Dakota, it'll be her first trip there too! :) After West Dakota I am thinking East Dakota could be fun too!

                            Ok well to be honest here I am swimming in information and kind of getting lost. The first part of the guide I followed like a champ and have all the information documented in a file but I am lost on putting it altogether. It's a bit overwhelming to understand what all needs to be done.

                            Breaking it down the first step is to get the right number of instances loaded in the rc.local, second create the runcommand-start and also I think I'll need a runcommand-exit?

                            Just to verify if I wanted to cover both wireless dongles I would need to load 8 instances in the rc.local file since each dongle shows a different by-id for the 4 controllers?

                            Also would I add all 8 controllers to the code runcommand-start? In the example below it loads one? Would I need to repeat the --evdev command and controller parameter lines below 8 times between the if/fi? Or would I need to get into something like section 3B - Expanding Launch Capabilities? I am not sure if that makes sense.

                            Lastly is there a list someplace already to match all 4-way games in mame2003?

                            ROMNAME="${3##*/}"
                            if [ "$ROMNAME" = "pacman.zip" ] || [ "$ROMNAME" = "mspacman.zip" ] || [ "$ROMNAME" = "jrpacman.zip" ] && [ "$2" = "advmame" ]; then
                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                            	--evdev /dev/input/by-id/[usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0C26450-event-joystick] \
                            	--device-name "XBOX 360 Controller 1" \
                            	--silent \
                            	--detach-kernel-driver \
                            	--force-feedback \
                            	--deadzone-trigger 15% \
                            	--deadzone 4000 \
                            	--calibration X1=-32767:0:32767,Y1=-32767:0:32767 \
                            	--calibration X2=-32767:0:32767,Y2=-32767:0:32767 \
                            	--calibration DPAD_Y=-32767:0:32767,DPAD_X=-32767:0:32767 \
                            	--axis-map -HAT0X=HAT0X
                            	--axis-sensitivity X1=-0.00,Y1=-0.00,X2=-0.00,Y2=-0.00,HAT0Y=-0.00,HAT0X=-0.00 \
                            	--trigger-as-button \
                            	--four-way-restrictor \
                            	--modifier dpad-restrictor=fourway \
                            	--evdev-absmap ABS_[X]=x1,ABS_[Y]=y1,ABS_[RX]=x2,ABS_[RY]=y2,ABS_[HAT0Y]=dpad_x,ABS_[HAT0X]=dpad_y \
                            	--evdev-keymap BTN_[SOUTH]=a,BTN_[EAST]=b,BTN_[NORTH]=x,BTN_[WEST]=y,BTN_[TL]=lb,BTN_[TR]=rb,BTN_[TL2]=lt,BTN_[TR2]=rt,BTN_[THUMBL]=tl,BTN_[THUMBR]=tr,BTN_[MODE]=guide,BTN_[SELECT]=back,BTN_[START]=start \
                            fi &
                            

                            I did shut off all controllers except one for testing and it does look like the XBOX 360 d-pad has both a BTN_ and ABS_ value. Both models output the same exact values for all buttons and axis'. In the output below I pressed left and then right once. You'll see the values defined on the top portion when the command loads and also the properties right below it when pressing the d-pad. It seems to output two values for each press.

                            Input driver version is 1.0.1
                            Input device ID: bus 0x3 vendor 0x45e product 0x2a1 version 0x100
                            Input device name: "Xbox 360 Wireless Receiver"
                            Supported events:
                              Event type 0 (EV_SYN)
                              Event type 1 (EV_KEY)
                                Event code 304 (BTN_SOUTH)
                                Event code 305 (BTN_EAST)
                                Event code 307 (BTN_NORTH)
                                Event code 308 (BTN_WEST)
                                Event code 310 (BTN_TL)
                                Event code 311 (BTN_TR)
                                Event code 312 (BTN_TL2)
                                Event code 313 (BTN_TR2)
                                Event code 314 (BTN_SELECT)
                                Event code 315 (BTN_START)
                                Event code 316 (BTN_MODE)
                                Event code 317 (BTN_THUMBL)
                                Event code 318 (BTN_THUMBR)
                                Event code 704 (BTN_TRIGGER_HAPPY1)
                                Event code 705 (BTN_TRIGGER_HAPPY2)
                                Event code 706 (BTN_TRIGGER_HAPPY3)
                                Event code 707 (BTN_TRIGGER_HAPPY4)
                              Event type 3 (EV_ABS)
                                Event code 0 (ABS_X)
                                  Value  -2155
                                  Min   -32768
                                  Max    32767
                                  Fuzz      16
                                  Flat     128
                                Event code 1 (ABS_Y)
                                  Value   1652
                                  Min   -32768
                                  Max    32767
                                  Fuzz      16
                                  Flat     128
                                Event code 3 (ABS_RX)
                                  Value  -3768
                                  Min   -32768
                                  Max    32767
                                  Fuzz      16
                                  Flat     128
                                Event code 4 (ABS_RY)
                                  Value  -3389
                                  Min   -32768
                                  Max    32767
                                  Fuzz      16
                                  Flat     128
                                Event code 16 (ABS_HAT0X)
                                  Value      0
                                  Min       -1
                                  Max        1
                                Event code 17 (ABS_HAT0Y)
                                  Value      0
                                  Min       -1
                                  Max        1
                              Event type 21 (EV_FF)
                                Event code 80 (FF_RUMBLE)
                                Event code 81 (FF_PERIODIC)
                                Event code 88 (FF_SQUARE)
                                Event code 89 (FF_TRIANGLE)
                                Event code 90 (FF_SINE)
                                Event code 96 (FF_GAIN)
                            Properties:
                            Testing ... (interrupt to exit)
                            Event: time 1538437117.040101, type 1 (EV_KEY), code 704 (BTN_TRIGGER_HAPPY1), value 1
                            Event: time 1538437117.040101, type 3 (EV_ABS), code 16 (ABS_HAT0X), value -1
                            Event: time 1538437117.040101, -------------- EV_SYN ------------
                            Event: time 1538437117.328099, type 1 (EV_KEY), code 704 (BTN_TRIGGER_HAPPY1), value 0
                            Event: time 1538437117.328099, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 0
                            Event: time 1538437117.328099, -------------- EV_SYN ------------
                            
                            mediamogulM 1 Reply Last reply Reply Quote 0
                            • mediamogulM
                              mediamogul Global Moderator @Riverstorm
                              last edited by mediamogul

                              @riverstorm said in Guide: Advanced Controller Mappings:

                              Breaking it down the first step is to get the right number of instances loaded in the rc.local, second create the runcommand-start and also I think I'll need a runcommand-exit?

                              If you just want to 4-way restrict in certain software, with certain ROMs, you can ignore doing anything to rc.local. For example, I use my plain vanilla controller to play most games, but I use the onstart/onend scripts to launch mappings only for the games I wish.

                              if I wanted to cover both wireless dongles I would need to load 8 instances in the rc.local file since each dongle shows a different by-id for the 4 controllers?

                              I'm a little uncertain as to why your controllers are producing two events each. Are you using a driver such as xpad? It could be that there's the original event and then another created by xpad. That's actually how xboxdrv does things, so it would make sense.

                              Also would I add all 8 controllers to the code runcommand-start? In the example below it loads one? Would I need to repeat the --evdev command and controller parameter lines below 8 times between the if/fi? Or would I need to get into something like section 3B - Expanding Launch Capabilities? I am not sure if that makes sense.

                              You can use either. I just use if/fi. There, the basic logic is that if the criteria is met, then commands are performed. In this case, one instance of xboxdrv is a command. For four controllers, you would say that if the criteria is met, four xboxdrv commands are performed. Those commands begin with sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv and end with the final -- argument, at which point you would either list another xboxdrv command below it, or end the if/fi with fi &.

                              Lastly is there a list someplace already to match all 4-way games in mame2003?

                              The list I posted above is as close as you're likely to find. From what I remember when looking myself, the available lists tend to only note parent ROMs. Mine is based off those findings, but I've added the clones that I find important, like pacman.zip for example.

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

                              1 Reply Last reply Reply Quote 0
                              • RiverstormR
                                Riverstorm
                                last edited by

                                @mediamogul - Let me do some more "studying" here. Ok I wasn't sure if that was a comprehensive list or most of the 4 way games in mame2003 only or all emulators supported in RetroPie or just what you've come across? I sorted them alphabetically below if you have any use for it.

                                My goal is pretty simply and that's to improve 4-way games for a better play experience on the vanilla XBOX 360 controller. Sometimes I have 1 plugged in, maybe 2 and occasionally all 4. Rarely 3 for maybe say Xenophobe.

                                How simple may I go?

                                1. Load the driver
                                2. Configure my controller through ES
                                3. Create the runcommand-start checking ROMNAME but add only --four-way-restrictor

                                Would this work in the Arcade folder with no emulator specified in the 'if' statement?

                                I don't need to do any type of cleanup on game exit?

                                It might be a bad habit but I spend all my time in planning before doing anything and usually (hopefully) very little in actual implementation.

                                I see the value in having complete and granular autonomy on each mapping for precision configuration. Plus I love the ScummVM example but just getting something simple in place to start would be great and maybe someday it will be a standard. I almost feel 4-way restriction on the correct games is a must long term, especially if the implementation is easy and straight forward.

                                I know the day I started this and I posted a question at you because I had this guide up for weeks in a TAB waiting to get around to it. I saw Robert created a new issue with Plus and I thought perfect timing! I wasn't sure if it was coincidence or he was watching the forums and the post prompted some idea or motivation.

                                Anyway I think @grant2258 has nailed something good in Mame2003-Plus. With a few lines of code he added 2 new options in the RA settings (Quick Menu/Options/last option in the list) for 4-way games 'XOR' and 'Last Pressed' that seem to be working pretty well. I think they plan to make it standard for a good 4-way game experience out of the box but want to do more testing with it first. If you or anyone have it loaded you probably have a good feel for certain games you play often or any feedback for improvement can be posted here.

                                40love.zip
                                alibaba.zip
                                alphaho.zip
                                amidar.zip
                                anteater.zip
                                armorcar.zip
                                armwrest.zip
                                astinvad.zip
                                astrob.zip
                                astrof.zip
                                atetris.zip
                                bagman.zip
                                ballbomb.zip
                                barrier.zip
                                blasto.zip
                                blkhole.zip
                                blockade.zip
                                btime.zip
                                carjmbre.zip
                                carnival.zip
                                cavelon.zip
                                chameleo.zip
                                checkman.zip
                                chinhero.zip
                                circusc.zip
                                ckong.zip
                                commando.zip
                                comotion.zip
                                copsnrob.zip
                                cosmicg.zip
                                cosmos.zip
                                crash.zip
                                crush.zip
                                dazzler.zip
                                devilfsh.zip
                                diamond.zip
                                digdug.zip
                                digdug2.zip
                                digger.zip
                                disco.zip
                                dkong.zip
                                dkong3.zip
                                dkongjr.zip
                                docastle.zip
                                dominos.zip
                                dommy.zip
                                dorodon.zip
                                dorunrun.zip
                                dowild.zip
                                dremshpr.zip
                                drgnbstr.zip
                                drmicro.zip
                                elecyoy2.zip
                                elecyoyo.zip
                                elvactr.zip
                                eyes.zip
                                firetrap.zip
                                frogger.zip
                                galaga.zip
                                galaxian.zip
                                galpanic.zip
                                galxwars.zip
                                gundealr.zip
                                guzzler.zip
                                hardhat.zip
                                headon.zip
                                headon2.zip
                                heiankyo.zip
                                hexa.zip
                                higemaru.zip
                                hustle.zip
                                intrepid.zip
                                invadpt2.zip
                                invinco.zip
                                invrvnge.zip
                                ironhors.zip
                                jjack.zip
                                joust2.zip
                                jrpacman.zip
                                jumpcoas.zip
                                jungler.zip
                                karianx.zip
                                kchamp.zip
                                kchampvs.zip
                                kicker.zip
                                kikcubic.zip
                                kingball.zip
                                kungfum.zip
                                ladybug.zip
                                lasso.zip
                                levers.zip
                                lnc.zip
                                locomotn.zip
                                logger.zip
                                logicpr2.zip
                                logicpro.zip
                                lrescue.zip
                                lupin3.zip
                                lvgirl94.zip
                                mappy.zip
                                marvins.zip
                                mikie.zip
                                mineswpr.zip
                                mmonkey.zip
                                monsterb.zip
                                moonal2.zip
                                moonqsr.zip
                                mrdo.zip
                                mrflea.zip
                                mrgoemon.zip
                                mrjong.zip
                                mrtnt.zip
                                msjiken.zip
                                mspacman.zip
                                mspacmnf.zip
                                mtrap.zip
                                mystston.zip
                                natodef.zip
                                naughtyb.zip
                                ncv2.zip
                                netwars.zip
                                nrallyx.zip
                                olibochu.zip
                                ozmawars.zip
                                pacman.zip
                                pacnchmp.zip
                                pacnpal.zip
                                pacplus.zip
                                pairs.zip
                                panic.zip
                                pengo.zip
                                pepper2.zip
                                perestro.zip
                                pettanp.zip
                                pickin.zip
                                pignewt.zip
                                pisces.zip
                                pleiads.zip
                                pooyan.zip
                                popeye.zip
                                popflame.zip
                                puckman.zip
                                pulsar.zip
                                punchout.zip
                                qix.zip
                                radarscp.zip
                                raiders5.zip
                                rallyx.zip
                                rampage.zip
                                rbtapper.zip
                                redufo.zip
                                reikaids.zip
                                retofinv.zip
                                robby.zip
                                rocnrope.zip
                                route16.zip
                                rthunder.zip
                                samurai.zip
                                sbagman.zip
                                schaser.zip
                                scregg.zip
                                shollow.zip
                                sia2650.zip
                                sidetrac.zip
                                sindbadm.zip
                                solarfox.zip
                                sonofphx.zip
                                spaceinv.zip
                                spacezap.zip
                                spclaser.zip
                                spectar.zip
                                spnchout.zip
                                springer.zip
                                ssi.zip
                                stratvox.zip
                                streakng.zip
                                superpac.zip
                                superqix.zip
                                swat.zip
                                tactcian.zip
                                tankbatt.zip
                                tapper.zip
                                targ.zip
                                taxidrvr.zip
                                telmahjn.zip
                                theend.zip
                                theglob.zip
                                thief.zip
                                timber.zip
                                timelimt.zip
                                todruaga.zip
                                tomahawk.zip
                                toypop.zip
                                tranqgun.zip
                                triplep.zip
                                tsamurai.zip
                                tutankhm.zip
                                vanvan.zip
                                volfied.zip
                                vsgongf.zip
                                warpwarp.zip
                                wiping.zip
                                wndrmomo.zip
                                wwjgtin.zip
                                yamyam.zip
                                zerozone.zip
                                zigzag.zip
                                zookeep.zip
                                zzyzzyxx.zip
                                
                                mediamogulM 1 Reply Last reply Reply Quote 0
                                • RiverstormR
                                  Riverstorm
                                  last edited by

                                  @mediamogul - Thanks for all the help and advice working on this, I really appreciate it. I'll let you know how things go.

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

                                    @riverstorm said in Guide: Advanced Controller Mappings:

                                    Sorry, I somehow missed your last reply

                                    Load the driver
                                    Configure my controller through ES
                                    Create the runcommand-start checking ROMNAME but add only --four-way-restrictor

                                    All that is correct. You'll still need to make a basic map from your controller to the virtual xboxdrv controller, but the only fancy thing you'd add is the 4-way restriction.

                                    Would this work in the Arcade folder with no emulator specified in the 'if' statement?

                                    If you specify that the xboxdrv command be launched with the arcade system criteria it would. For example:

                                    if [ "$ROMNAME" = "pacman.zip" ] && [ "$1" = "arcade" ]; then
                                    

                                    An example of using the emulator as the criteria would look like:

                                    if [ "$ROMNAME" = "pacman.zip" ] && [ "$2" = "advmame" ]; then
                                    

                                    I don't need to do any type of cleanup on game exit?

                                    Yes, it's actually covered in the guide at some point that you'd need to add something to the tune of:

                                    sudo killall >>/dev/shm/runcommand.log xboxdrv
                                    

                                    Plus I love the ScummVM example but just getting something simple in place to start would be great and maybe someday it will be a standard.

                                    Originally, I used ScummVM as the main example because of the stuttery joystick support it had not too long ago. However, it's native support is very smooth now. Still, it's nice to add other things like matching the same button combinations to quit that you use in RetroArch for example. I run 32 different systems and many different ports and it really is great to have the same button combinations for all of them to quit, pause, take a screenshot and bring up the options menu.

                                    Anyway I think @grant2258 has nailed something good in Mame2003-Plus.

                                    I've been following that. It's a great addition. I've been meaning to test it, but I just can't seem to fit enough hours in the day lately.

                                    Thanks for all the help and advice working on this, I really appreciate it.

                                    It's never a probelm. If you decide to put any of this to practice, I think you'll find that it can come together fairly well once you start going through the steps. Something like this in theory leads to an endless amount of what ifs.

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

                                    1 Reply Last reply Reply Quote 0
                                    • RiverstormR
                                      Riverstorm
                                      last edited by Riverstorm

                                      @mediamogul - You're great, your documentation and advice are the only thing that's making it possible for me to add this amazing feature and I appreciate the help tremendously. I just figured you were busy and it's a good spot for me to pause for a moment too.

                                      I know what you mean about not enough hours in the day. I took a vacation day yesterday to go home and work. How's that for the American dream. ;) I hope to continue working on things this weekend. I also need to replace two electrical outlets and two light switches as the wife is hard on that stuff. I don't what she does but it looks like she has WWE Smackdown's with this stuff or something when I am gone.

                                      Here in the fall stores like Lowes, Home Depot and Menards are packed as everyone is scrambling with fall projects before winter. Once winter hits it's way to cold for paint, caulk, water, anything will freeze, crack, peel, etc. as it's well below freezing most days and things can't set and seal. Last night we hit 34F...burrr...I had to pull the plants into the garage due to frost advisories. I will still work outside in a light jacket in November doing little things but all big projects are off the table until next spring that late in the season. I am just a cold weather person vs. heat.

                                      If you do get a chance to test the changes Grant made to the code for 4-way games I would love to hear your thoughts on how it feels vs. managing it through the xboxdrv driver. It's pretty straight forward as the ROM sets are mostly the same and you can dump them in either arcade or mame-libretro (whichever one you don't use or both) for a quick test. No configuration just a quick setting change under Quick Menu/Options near the bottom. I've tested some of the classics and it feels pretty good to me.

                                      Even if it's perfect there's still going to be a big need for the xboxdrv way because it's only one core vs. a whole lot. You run 32, I think I am around 10 cores, mainly MAME, Nintendo and Atari. How many cores total does RetroPie support. I see the list in the docs but never counted all of them.

                                      You're right, I just need to get in there and some of these questions will be answered as I work through it. I will let you know how things go once I get few straight hours of leisure time to sit down and dig in as 5 minutes here and there is probably not going to cut it the first time through.

                                      I think it's a work habit. I pre-configure switches, routers, firewalls, etc. and then I create very short maintenance windows to flip over to the new equipment. It also doesn't hurt to pull a Scotty. "I need 30 minutes, captain!" and pull it off in 15 but my boss is incredibly technical for being a director so that doesn't always work. We are replacing about 1/3 of our switches this year and that includes some critical functions like Metro Communications (911). I'll let you know which day to not have an emergency! ;)

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

                                        @riverstorm said in Guide: Advanced Controller Mappings:

                                        I took a vacation day yesterday to go home and work. How's that for the American dream.

                                        Oh man! I know that movie. I had a plumber come in to install a second water heater not too long ago and the guy made a real mess of things. When the fit hit the shan I had to take a day off to fix the situation myself. The whole point of calling someone in the first place was to keep it off my plate. As Charlie Brown said so eloquently time and time again; ugh!

                                        If you do get a chance to test the changes Grant made to the code for 4-way games I would love to hear your thoughts on how it feels vs. managing it through the xboxdrv driver.

                                        Certainly. At the moment, it's only available in lr-mame2003-plus right? As long as there aren't any dropouts between the restricted directions I'm sure it'll do the job well.

                                        It also doesn't hurt to pull a Scotty. "I need 30 minutes, captain!" and pull it off in 15

                                        How else does one maintain a reputation as a miracle worker? ;)

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

                                        1 Reply Last reply Reply Quote 0
                                        • RiverstormR
                                          Riverstorm
                                          last edited by Riverstorm

                                          @mediamogul said in Guide: Advanced Controller Mappings:

                                          At the moment, it's only available in lr-mame2003-plus right?

                                          Yeah it's only in Plus currently. I don't think it's to many lines of code and maybe it'd be possible to port it to the other cores. After testing it's been whittled down to one option, "Last Pressed".

                                          The basic theory is the character will travel in the same direction until a new direction is established ignoring diagonals. So if you're traveling right you will continue right until say you press up.

                                          Basically like a 4-way acrade joystick is how he coded it. You travel in one direction until a new direction is set.

                                          When I look at my restrictor plate on a real arcade joystick it's a diamond shape so it will naturally "lock" direction into one of the 4 diamond tips. A controller has a bit of play since the "restrictor plate" is a circle so I think there's still room for error compared to a true arcade stick.

                                          It feels real good but I would be curious how it compares to the xboxdrv driver restriction. Regardless I think his code could be a benefit to all the Libretro MAME cores, it requires no configuration and works out of box for a better experience. That's just a win-win.

                                          I hear you on "contractors". I don't mean to sound cynical but I trust very few. My Dad when he was alive was through and through a DIY guy so I came by it honest but there's still a few things I am not comfortable with.

                                          I'll change electrical outlets, switches, 3-way, 4-way, install new outlets and run them back to the fuse box, etc. but I am just not comfortable working inside the actual fuse box. Everything else I'll give it shot and I am pretty comfortable but like you there's some things I'll just pay for to be done with it sometimes.

                                          The last big mess I had from a contractor was a radon system that started falling apart a few years after installation. He didn't use primer with the glue on PVC. I called him and we had a nice discussion on the merits of a $3 can of primer. It took a weekend but I had to build a new run from my basement, through the basement wall, up the garage wall (for legal reasons it can't be in the house), through the garage attic and out through the roof.

                                          Just for fun a few weeks back I ran some LED strip lighting under the length of kitchen cabinets. It turned out really nice and looks great especially in the evenings set on low. I think it'll be fun for social gatherings.

                                          Anyway I am pretty grateful and happy as I believe maintenance costs in a home are still cheaper than letting it completely fall apart and then replace it and it's not the "The Money Pit". I throw out those movie/TV references because none of them are lost on you. ;)

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

                                            @riverstorm said in Guide: Advanced Controller Mappings:

                                            It feels real good but I would be curious how it compares to the xboxdrv driver restriction.

                                            I'm hoping to try it out this evening alongside 'Donkey Kong' for this weeks MAME ROW. Without good 4-way restriction, Mario just loses interest half way up the ladders, when you can get him to climb at all.

                                            it's not the "The Money Pit". I throw out those movie/TV references because none of them are lost on you. ;)

                                            Ha! Well done sir. That has to hold the record for the most obscure 80s comedy reference on this site. I used to rent that quite a bit back in the day. I always felt like it was half-way educating me to future home life. Along with 'The Volunteers', I personally believe it's Tom Hanks' most underrated comedic movie. I'd even go so far as to say it's Shelly Long's best, although 'Don't Tell Her it's Me' is so bad it almost doubles around to being good again.

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

                                            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.