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.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 @guydot
      last edited by mediamogul

      @guydot said in Guide: Advanced Controller Mappings:

      Is proposed method to add --ui-buttonmap to map xboxdrv to keyboard keys?

      It is, yes. As an example, below is an excerpt from my retroarch.cfg file where I've mapped my desired keyboard inputs for player one. Below that is a 4-way strict xboxdrv map that corresponds to those keys.

      retroarch.cfg excerpt:

      # Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, 
      # rather than relying on a default.
      input_player1_a = "a"
      input_player1_b = "b"
      input_player1_y = "y"
      input_player1_x = "x"
      input_player1_start = "t"
      input_player1_select = "e"
      input_player1_l = "l"
      input_player1_r = "r"
      input_player1_left = "left"
      input_player1_right = "right"
      input_player1_up = "up"
      input_player1_down = "down"
      input_player1_l2 = "d"
      input_player1_r2 = "f"
      input_player1_l3 = "c"
      input_player1_r3 = "v"
      

      4-way strict xboxdrv command:

      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
      	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
      	--detach-kernel-driver \
      	--dpad-as-button \
      	--trigger-as-button \
      	--deadzone-trigger 15% \
      	--deadzone 4000 \
      	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
      	--silent \
      	--four-way-restrictor \
      	--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-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4 \
      	--ui-buttonmap a=KEY_A,b=KEY_B,x=KEY_X,y=KEY_Y,lb=KEY_L,rb=KEY_R,lt=KEY_D,rt=KEY_F,tl=KEY_C,tr=KEY_V,du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT,start=KEY_T,back=KEY_E \
      	--ui-buttonmap guide=void \
      	&
      

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

      G 1 Reply Last reply Reply Quote 0
      • G
        guydot @mediamogul
        last edited by

        @mediamogul I think I had my aha! moment :-) I am away but will test in a week or so and report back. Thanks!!!

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

          @guydot

          Not a problem. Let us know how it works out.

          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 - Post 534...action...wow long thread! ;) I was wondering if I could get your help with setting up XBOX 360 controllers if possible, please, when/if you have time. I am in no hurry but not quite sure what to do next once I get the controllers setup.

            I have four XBOX 360 controllers using a wireless dongle. I use the Arcade folder running mame2003, FBA and Advmame for about 300 games. Basically I just want to break down the games for 4/8-way restriction. Good 4-way games are lost to simple mistakes of not hitting that ladder squarely in Donkey Kong, etc. using controllers.

            I am running RP 4.3 on a Pi 3 updated to the latest RetroPie script as of yesterday. My cores are recent from source and Advmame is on 3.8.

            I went through the tutorial and here's what I ended up with but I had a few questions. For calibration axis name. Do I use the output from evtest /dev/input/event[event1] and add it 3 times as shown below?

            evtest output for 360 controller:

            A = BTN_SOUTH = 304
            B = BTN_EAST = 305
            X = BTN_NORTH = 307
            Y = BTN_WEST = 308
            LB = BTN_TL = 310
            RB = BTN_TR = 311
            LT = BTN_TL2 = 312
            RT = BTN_TR2 = 313
            BACK = BTN_SELECT = 314
            START = BTN_START = 315
            GUIDE = BTN_MODE = 316
            TL = BTN_THUMBL = 317
            TR = BTN_THUMBR = 318
            X1/Y1 = ABS_X (UP/DOWN) | ABS_Y (LEFT/RIGHT)
            X2/Y2 = ABS_RX (UP/DOWN) | ABS_RY (LEFT/RIGHT)
            DPAD_Y/DPAD_X = ABS_HAT0Y (UP/DOWN) | ABS_HAT0X (LEFT/RIGHT)
            

            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? So I have two fields below still using asterisks.

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

            Lastly, lastly do I need to use the rename parameter for each controller as I have 4 but they are all the same. Well they are 2 different models among the 4 but they are all detected as the same. Do I need to define 4 controllers in the rc.local file?

            If I get this first step implemented correctly is there a guide restricting games to 4/8 way? Disclosure I didn't read all 533 posts so if there's a relevant section I can read through or a link to what steps I should think about next. Thanks Media for all this information, it's pretty incredible stuff. I wish 4/8 restriction was a controller feature as it's kind of relevant-ish to good gaming.

            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
            	--evdev /dev/input/by-id/[usb-©Microsoft_Xbox_360_Wireless_Receiver_for_Windows_E0C26450-event-joystick] \
            	--silent \
            	--detach-kernel-driver \
            	--force-feedback \
            	--deadzone-trigger 15% \
            	--deadzone 4000 \
            	--calibration X=-32767:0:32767,Y=-32767:0:32767 \
            	--calibration RX=-32767:0:32767,RY=-32767:0:32767 \
            	--calibration HAT0Y=-32767:0:32767,HAT0X=-32767:0:32767 \
            	--trigger-as-button \
            	--mimic-xpad \
            	--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 \
            	&
            
            mediamogulM 1 Reply Last reply Reply Quote 0
            • 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
                                            • 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.