Guide: Advanced Controller Mappings
-
@mediamogul said in Guide: Advanced Controller Mappings:
Have you updated RetroArch in a while?
I did a Retroarch update but it did not solve the issue. I am running RPi3 B+/Stretch/RetroPie 4.4, so it is a very recent image.
At some point, Retroarch (yellow text on bottom just before the game starts) shows an incorrect port joystick mapping and the game does not work. Killing xboxdrive restores the use of Controlblock to exit the game, but Retroarch would not get the right mapping if I launch a new game unless I reboot. Frustrating.
-
This may be able to be sorted out as-is, but if you're open to an alternative, let me suggest something more reliable. I avoid the uncertainty of these particular situations by having a keyboard map set for players one and two in RetroArch. To correspond with this, I also have my two controllers fully key-mapped with xboxdrv to match. Once everything is launched, it really doesn't matter which controller RetroArch tries to grab hold of, because it'll be acknowledging the keyboard map regardless.
-
@mediamogul @guydot I agree 100% with this approach. Mediamogul put me onto this method about 2 years ago and it just works. 99% of cores and emulators have keyboard mapping. I've only struggled with one or two eg reicast; otherwise, all good.
-
@mediamogul I will give it a shot, as all other methods failed. The closest I got was with Joystick Selection "by name" method: the games work well even when Retroarch shuffled the ports, but Emulationstation crashes when I exit a "port-confused" game.
If I understand the method correctly - I will have to change Controlblock to "MAME" mode = keyboard emulation and then run 2 xboxdrv configured to match the keys generated by my controllers. Correct?
-
@guydot said in Guide: Advanced Controller Mappings:
If I understand the method correctly - I will have to change Controlblock to "MAME" mode = keyboard emulation and then run 2 xboxdrv configured to match the keys generated by my controllers. Correct?
Actually, you would just change your xboxdrv maps to be complete key-mappings of the Controlblock. From there, you'd assign those keys to players one and two in RetroArch.
-
@mediamogul @spud11 I am missing something here.
Right now:
(1) Controlbox is creating 2 joypads: JS0/JS1 and event 2/3
(2) I use 2 xboxdrv commands, each has --evdev-absmap and --evdev-keymap that correspond to a joypad joystick + buttons
(3) In Retroarch.cfg, I tried to use input_player1_joypad_index = "2" and input_player2_joypad_index = "3" to mapIs proposed method to add --ui-buttonmap to map xboxdrv to keyboard keys? I guess I need more steps... Thanks for all your help!
-
@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 \ &
-
@mediamogul I think I had my aha! moment :-) I am away but will test in a week or so and report back. Thanks!!!
-
Not a problem. Let us know how it works out.
-
@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 \ &
-
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. -
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 andABS_
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
-
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 &
-
@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. ;)
-
@mediamogul - Just to clarify one thing below. I've been following your guide and in the example you'll see
tl
andtr
in the keymap line shown below from the guide examples but on the controller mapping diagram it shows aslt
andrt
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
-
@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.
-
@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!
-
@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?
-
@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! ;)
-
@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
andABS_HAT0X
should I add them both, one each to the absmap and keymap lines? Does it distinguish between the two somehow?
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.