Guide: Advanced Controller Mappings
-
@PMac10000 said in Guide: Advanced Controller Mappings:
It often seems like there are too many bases to cover.
Not a problem. It can be overwhelming for sure. To test, you can first launch 'Donkey Kong' and invoke the RetroArch menu with 'Hotkey+X'. This should put you in the quick menu. Pressing 'B' will take you one menu back. From there, move to the next menu listing to the right named 'Settings' and navigate down to 'Input'. Inside there, you should see a listing for the player one controls and the current input device can be set accordingly. You can then return to 'Donkey Kong' with 'Hotkey+X' and test to see if the ladders are now more manageable.
If it worked, you can set the controller as the default from the 'Configuration Editor', located in the RetroPie menu of Emulation Station. That should do the job, but if not, there's also @meleu's 'RetroPie-joystick-selection' tool. Information on its installation and use can be found here.
-
@PMac10000 @mediamogul Also, I found it best to map MAME to keys (ie use Tab in game and change input), then map RetroArch to the same keys and do the same in xboxdrv.
I've got 4 Dragonrise joysticks working well in this fashion, both in 4 way and 8 way configurations, both cocktail and "normal" modes.
-
@spud11 said in Guide: Advanced Controller Mappings:
Also, I found it best to map MAME to keys (ie use Tab in game and change input), then map RetroArch to the same keys and do the same in xboxdrv.
Very good advice. I do the same and haven't had any issues.
-
@mediamogul Yes, it was your advice to me 2 years ago! Best advice ever as you don't have to worry about joystick axes, changing joystick indexes and the like.
-
@spud11 said in Guide: Advanced Controller Mappings:
Yes, it was your advice to me 2 years ago! Best advice ever...
I'm glad it worked out. I also advised someone else to invest heavily in GameStop two years ago and now he has to use wadded up newspaper as shoes. Still, you win some and lose some.
-
@spud11 said in Guide: Advanced Controller Mappings:
@PMac10000 @mediamogul Also, I found it best to map MAME to keys (ie use Tab in game and change input), then map RetroArch to the same keys and do the same in xboxdrv.
I've got 4 Dragonrise joysticks working well in this fashion, both in 4 way and 8 way configurations, both cocktail and "normal" modes.
So to sum up, I think you're advising that I need to map individual game inputs anyway. There's no "magic wand" that's just going to launch 4-way games with an xboxdrv 4-way joystick, without additional intervention and configuration on my part.
That's OK if so. I think I will just launch xboxdrv 4-way in rc.local (not customizing the runcommand-onstart at all), and map 4-way games within the MAME menu to the "Retropad 3" inputs, which is the xboxdrv virtual 4-way pad. Does this sound like a good approach?
One potential glitch... I am noticing that in my setup, the Mame TAB menu does not always appear in all games. For example, it works in Donkey Kong and Defender, but not in Pac-Man or Ms Pac-Man. Any ideas? Thanks.
-
@PMac10000 said in Guide: Advanced Controller Mappings:
Does this sound like a good approach?
Sounds like it could work.
One potential glitch... I am noticing that in my setup, the Mame TAB menu does not always appear in all games. For example, it works in Donkey Kong and Defender, but not in Pac-Man or Ms Pac-Man. Any ideas?
Are you sure that you're using the same emulator between all the games?
-
@PMac10000 In MAME's tab menu, you can set the keys via Input (General), effectively operating for every game.
With xboxdrv, in my runcommand-onstart, I've got a full list of every 4 way game (about 200). I'll copy the relevant code a bit later for you. The relevant 4 way xboxdrv code is invoked automatically when I start one of these games
This means you don't need to make individualised controls for every 4 way game.
-
@spud11 said in Guide: Advanced Controller Mappings:
@PMac10000 In MAME's tab menu, you can set the keys via Input (General), effectively operating for every game.
With xboxdrv, in my runcommand-onstart, I've got a full list of every 4 way game (about 200). I'll copy the relevant code a bit later for you. The relevant 4 way xboxdrv code is invoked automatically when I start one of these games
This means you don't need to make individualised controls for every 4 way game.
Thanks ! I've been working from a simplified version of your code that you posted earlier in the thread. I've been able to manually play a couple games with the 4-way code enabled, and it definitely improves the experience.
However, I'm still unclear how to automate or scale it to other 4-way roms upon launch. The first problem I encounter is that these games are already mapped... for example Player 1 controls are mapped Dragonrise USB controller 0 (called "Retropad 1" by the MAME menu). So when launched with the Xboxdrv 4-way code active, now my Player 1 controls do nothing. UNLESS, I go into each game individually, and use the MAME tab menu to start remapping each Joypad direction and button to "Retropad 3", which is the new virtual 4-way controller. That works, but it seems like a cumbersome way to approach this. I suspect I'm missing a step here...
-
Another thing... with the Xboxdrv controller active, I seem to have lost the ability to exit games with Select + Start, even after remapping the buttons in Mame. (Man, that's a feature I've really come to rely on :-) Also, I've lost the ability to get into the RA menu via Select +X... any ideas are welcome.
-
@PMac10000 I'm just wondering whether you've set up the keys in Retroarch. I have a bluetooth mini keyboard that I use to test all the keys, including the start and exit keys to make sure they work. Once I've tested these, then I make sure that MAME uses the same keys for Player 1 that I've set in Retroarch and the same keys for Player 2 that I've set in Retroarch, and then I set up xboxdrv to correspond to those keys.
As @mediamogul mentioned previously, it might be worthwhile using @meleu's joystick selection tool so that you can set up the correct Dragonrise joystick for Player 1 and the correct one for Player 2. If you use it, you can set which joystick is Player 1 and which is Player 2 etc. In the
/opt/retropie/configs/all
folder, I have ajoystick-selection.cfg
with the following content:# This file was created by the joystick-selection tool. # It's recommended to NOT edit it manually. # The format is pretty simmilar to a retroarch.cfg file, but it contains only # input_player[1-4]_joypad_index, and accepts "strings" as a value. # Example: # input_playerN_joypad_index = "joystick name" # If "joystick name" is an integer, then the real joystick index is used. joystick_selection_by_name = "false" input_player1_joypad_index = "DragonRise Inc. Generic USB Joystick #3" input_player2_joypad_index = "DragonRise Inc. Generic USB Joystick #1" input_player3_joypad_index = "DragonRise Inc. Generic USB Joystick #2" input_player4_joypad_index = "DragonRise Inc. Generic USB Joystick #4"
Effectively, my third Dragonrise joystick is Player 1 and my first joystick is Player 2. I'm very careful never to remove the joysticks from the USB hub I have in case the indexes change if I did that. (The order in which the joysticks are attached and the USB ports to which they are connected can make a difference.)
Here is an extract of my
retroarch.cfg
which appears in the/opt/retropie/configs/all/
folder:.... input_player1_a = "x" input_player1_b = "z" input_player1_y = "a" input_player1_x = "s" input_player1_start = "enter" input_player1_select = "rshift" input_player1_l = "q" input_player1_r = "w" input_player1_left = "left" input_player1_right = "right" input_player1_up = "up" input_player1_down = "down" input_exit_emulator = "escape" .... input_menu_toggle = "f1" .... input_enable_hotkey = "space" .... input_player2_b = "alt" input_player2_b_btn = "5" input_player2_b_axis = "nul" input_player2_y = "shift" input_player2_y_btn = "0" input_player2_y_axis = "nul" input_player2_select = "p" input_player2_select_btn = "nul" input_player2_select_axis = "nul" input_player2_start = "i" input_player2_start_btn = "nul" input_player2_start_axis = "nul" input_player2_up = "r" input_player2_up_btn = "nul" input_player2_up_axis = "+0" input_player2_down = "f" input_player2_down_btn = "nul" input_player2_down_axis = "-0" input_player2_left = "d" input_player2_left_btn = "nul" input_player2_left_axis = "-1" input_player2_right = "g" input_player2_right_btn = "nul" input_player2_right_axis = "+1" input_player2_a = "ctrl" input_player2_a_btn = "1" input_player2_a_axis = "nul" input_player2_x = "l" input_player2_x_btn = "3" input_player2_x_axis = "nul" input_player2_l = "n" input_player2_l_btn = "2" input_player2_l_axis = "nul" input_player2_r = "m" input_player2_r_btn = "4" input_player2_r_axis = "nul" input_player2_l2 = "j" ....
A few things to bear in mind.
You'll see that I've set up the hotkey and the exit key. My "space" key is the hotkey. My "escape" key is the exit key.
Although I have actually set up my 2 controllers via the Emulationstation configuration menu (and you'll see that because my player 2 buttons ("btn") are defined above), I don't even bother with these any longer "in game". I'm only interested in the keys as MAME (input/general) and xboxdrv all correspond to these Retroarch keys as well.
Below is an extract of my
runcommand-onstart.sh
for my 4 way and 8 way games for lr-mame2003:#!/bin/sh ### Code begins ### Game/ROM full path rom="${3##*/}" ### ARCADE - LR-MAME2003 and LR-MAME2010 and LR-MAME2003PLUS - THIS CORE HAS ITS OWN KEYS SET UP VIA THE TAB MENU - The mappings below enable the joysticks to operate in 4-Way or 8-Way mode depending on the game. This is a libretro core. ### First: Using the TAB menu in lr-mame2003, either make note of the default keyboard controls and map the code below accordingly or in TAB map Player 1's and Player 2's controls to the keyboard controls you want and then map the code below. ### Player1_4Way_Mame2003 and Player2_4Way_Mame2003 map Joysticks 1 and 2 with four way restriction for use with lr-mame2003. ### Start + Select (Back) is assigned to saving the saved game (F2); Select + Start is assigned to loading the saved game (F4) Player1_4Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --four-way-restrictor \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_TRIGGER=x,BTN_THUMB=y,BTN_TOP2=lb,BTN_TOP=rb,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap start+back=KEY_F2,back+start=KEY_F4 \ --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,back=KEY_UNKNOWN,start=KEY_UNKNOWN,back+rt=KEY_SPACE+KEY_ESC,lt=KEY_5+KEY_1,rt=KEY_6+KEY_2 \ --ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/SoundToggle.sh" Player2_4Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \ --device-name "Player_2" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --four-way-restrictor \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_D:KEY_G,Y1=KEY_R:KEY_F \ --ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6+KEY_2,start=KEY_UNKNOWN,back+start=KEY_SPACE+KEY_ESC" ### Player1_8Way_Mame2003 and Player2_8Way_Mame2003 map Joysticks 1 and 2 with no restriction for use with lr-mame2003 Player1_8Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap tl=void,tr=void,guide=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_TRIGGER=x,BTN_THUMB=y,BTN_TOP2=lb,BTN_TOP=rb,BTN_BASE3=back,BTN_BASE6=start,BTN_BASE2=lt,BTN_BASE5=rt \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap start+back=KEY_F2,back+start=KEY_F4 \ --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,back=KEY_UNKNOWN,start=KEY_UNKNOWN,back+rt=KEY_SPACE+KEY_ESC,lt=KEY_5+KEY_1,rt=KEY_6+KEY_2 \ --ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/SoundToggle.sh" Player2_8Way_Mame2003="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \ --device-name "Player_2" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_D:KEY_G,Y1=KEY_R:KEY_F \ --ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6+KEY_2,start=KEY_UNKNOWN,back+start=KEY_SPACE+KEY_ESC" case $2 in ### Arcade lr-mame2003) case $rom in "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"|"congo.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"|"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"|"qbert.zip"|"qbertqub.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"|"sqbert.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"|"arkangc.zip"|"arkanoid.zip"|"arkatayt.zip"|"arkatour.zip"|"arkbl2.zip"|"arkbl3.zip"|"arkbloc2.zip"|"arkblock.zip"|"arknid2j.zip"|"arknid2u.zip"|"arknoid2.zip"|"arknoidj.zip"|"arknoidu.zip"|"arknoiuo.zip"|"arkretrn.zip"|"tempest.zip"|"tempest1.zip"|"tempest2.zip"|"tempest3.zip"|"temptube.zip") # Configuration only for these ROMs. $xboxkill joycommand="$Player1_4Way_Mame2003 & $Player2_4Way_Mame2003 &" eval $joycommand ;; *) # Configuration for every other ROM.. $xboxkill joycommand="$Player1_8Way_Mame2003 & $Player2_8Way_Mame2003 &" eval $joycommand ;; esac ;;
Things to note:
(a) all the 4 way arcade games are listed by romname. Those games use the 4 way restricted configuration. All other games use the 8 way restricted configuration;
(b) It's very important to name your xboxdrv configurations I find, so you know what joystick is Player 1 and what joystick is Player 2;
(c) I've got 10 buttons on my arcade for Player 1. These buttons are mapped to keys. Because of their location, I wound up mapping the buttons I assigned to "back/select" and "right trigger" (rt) to exit -back+rt=KEY_SPACE+KEY_ESC
. Note that if I press these 2 buttons together it triggers the "space" and "escape" keys which are the same keys set up in Retroarch for the hotkey and the exit button. So when I press these buttons together, the game will exit;
(d) In MAME, I have made sure that movement for Player 1 is via the arrow keys. You will see that that corresponds to my Retroarch settings and also corresponds to the settings in xboxdrv ---ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \
etc etc. In MAME, Player 2's movement keys are D, G, R and F. Again, in Retroarch you will see the same keys are set for movement and the same for xboxdrv ---ui-axismap X1=KEY_D:KEY_G,Y1=KEY_R:KEY_F \
etc etc
(e) As long as everything corresponds, it should work.So, if you haven't already done so, I'd recommend either going into Retroarch and setting up the keys as I did or make a backup of your
retroarch.cfg
and manually changing that file. (I always do the latter using WinSCP.)Then test and see if it works.
I hope this helps.
-
@spud11 Thanks for the detailed response. I am trying to test in my simplified setup... I have only the two Dragonrise joysticks with 6-buttons + Start and Select for each player. Joystick #1 is set to Player 1, and #2 is set to Player 2 (set and confirmed by @meleu tool). Again, my only goal is to launch 4-way joystick games from ES with the 4-way driver code, and (hopefully) not change much else about my setup. Most of my arcade games utilize lr-mame2003, some others (like the Pac-Man family) from fba. That may be complicating things somewhat.
I also have edited my retroarch.cfg file with the exact mappings you supplied above. Still having some trouble launching xboxdrv from your runcommand-onstart code. I can launch xboxdrv just fine from a command line, and successfully create the virtual 4-way joystick:
Your Xbox/Xbox360 controller should now be available as:
/dev/input/js3
/dev/input/event7Whenever I try to launch xboxdrv from your runcommand-onstart.sh I get a "driver or resource busy" error, so I need to work on that a bit.
I think the jist of what you're advising is that keyboard mapping is the "lowest common denominator" of the various layers that need to be aligned (Retroarch, Mame, Xboxdrv), so it makes sense to define a common keyboard map for all the buttons in Retroarch, and then configure Mame and Xboxdrv to match the keyboard. Is that right?
So far though, no luck, at least in the fba games where I cannot launch the RA menu no matter what I do, when the xboxdrv is active. (without xboxdrv, I just hit Select+X) . Player 1 Joysticks and buttons don't respond at all. In the mame games, I can use the keyboard to launch the tab menu and I can make progress with the 4-way games. Below is the xboxdrv parameters I've been successfully launching manually.
#!/bin/sh sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.1.2:1.0-event-joystick \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --device-name "Player_1_-_4-Way_Joystick_xboxdrv" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --four-way-restrictor \ --evdev-keymap BTN_THUMB=y,BTN_PINKIE=a,BTN_TOP2=b,BTN_TOP=rb,BTN_TRIGGER=x,BTN_THUMB2=lb,BTN_BASE2=back,BTN_BASE=start,BTN_BASE3=lt \ &
-
@PMac10000 Hi. You are doing very well on this.
Yes, to your question. "....so it makes sense to define a common keyboard map for all the buttons in Retroarch, and then configure Mame and Xboxdrv to match the keyboard. Is that right?" Yes.
Just off to work, but things to note:
(a) Not sure about the driver or resource busy error;
(b) Unlikelr-mame2003
,FBA
doesn't use the TAB interface. WithFBA
, it should be enough just to map the keys in Retroarch and in xboxdrv;
(b) You need to add the actual keymapping to your xboxdrv command. The 2 lines that you need (with modifications at least to the "button mapping" because you have 6 buttons whilst I have 10) are:--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,back=KEY_UNKNOWN,start=KEY_UNKNOWN,back+rt=KEY_SPACE+KEY_ESC,lt=KEY_5+KEY_1,rt=KEY_6+KEY_2 \
-
@mediamogul said in Guide: Advanced Controller Mappings:
Something that's always bothered me about launching xboxdrv using
runcommand-onstart.sh
is that it makes using the Runcommand menu itself somewhat impossible. This is because the xboxdrv mapping is made active before the Runcommand menu appears, therefore interfering with the expected control scheme. Over the weekend, I've been experimenting with some ways around this.First, I tried scripting the xboxdrv command not to launch until it detected that the intended emulator/port had launched. This worked well, except the script needed the specific executable name for the software it was looking for, making everything a little more laborous to set up than I felt it needed to be. I was prepared to live with it, until I noticed that AdvanceMame refused to recognized an xboxdrv simulated mouse event unless it was present before it launched. Seeing as how I play many games that rely on analog controls, it was important enough for me to rethink the approach.
What I needed was something that could be discovered from the
runcommand-onstart.sh
script that signals the launch of the Runcommand menu, yet yet also signals it's closing before the emulator/port software is launched. After taking a look at/opt/retropie/supplementary/runcommand/runcommand.sh
, it looked as though it invoked and exitedjoy2key.py
in exactly the way I needed. With a little more experimenting, I came up with the following that uses the xboxdrv example from the first section of my guide.if [ "$2" = "advmame" ]; then sudo killall > /dev/null 2>&1 xboxdrv j2kpid="0" until [ "$j2kpid" -gt "0" ]; do j2kpid=$(pgrep -f joy2key.py) sleep 1 done while s=$(ps -p "$j2kpid" -o s=) && [ "$s" ] && [ "$s" != 'Z' ]; do sleep 1 done /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --evdev /dev/input/by-id/[•] \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_[•]=x1,ABS_[•]=y1,ABS_[•]=x2,ABS_[•]=y2,ABS_[•]=lt,ABS_[•]=rt,ABS_[•]=dpad_x,ABS_[•]=dpad_y \ --evdev-keymap BTN_[•]=a,BTN_[•]=b,BTN_[•]=x,BTN_[•]=y,BTN_[•]=lb,BTN_[•]=rb,BTN_[•]=tl,BTN_[•]=tr,BTN_[•]=guide,BTN_[•]=back,BTN_[•]=start fi &
This waits for
joy2key.py
to launch, gets it's PID and then waits for it to end before launching whatever emulator/port is being launched (advmame in this example). So, in effect, you can now launch a game, use the Runcommand window as intended if needed and xboxdrv will launch afterwards.I've talked with so many people about xboxdrv on here that, unfortunately, a lot of it runs together. However, I do remember a few interested parties looking for a way to accomplish this, so I hope it helps. Granted there might be an easier, more effective way, so if anything comes to mind, please feel free to share.
Now that I'm using xboxdrv I'm noticing this as well. Can't change emulators or interrupt launching. I would have thought it was just a change of ordering (show dialog and then do the onstart), but from what you've described, it doesn't seem that straightforward.
-
@telengard said in Guide: Advanced Controller Mappings:
from what you've described, it doesn't seem that straightforward.
To change the order of events more efficiently would require changing
runcommand.sh
which isn't recommended. I still have the above solution in place and while it's a bit hacky on its face, it works very well. I believe the only thing I added was a final check to see if xboxdrv was active whileruncommand.sh
isn't. If that particular case ever proves true, then xboxdrv is shutdown, as it means that a gaming session is not active for whatever reason. -
@spud11 @Riverstorm
Long story short... I gave up on getting the xboxdrv 4-way selective-driver method described here working. I took @Riverstorm 's advice and compiled the lr-mame2003-plus package, which has a convenient 4-way joystick flag that can be enabled for these games.I verified the 4-way option is present using RA Quick menu. Great! (unfortunately, I'm still having no luck mapping inputs while using lr-mame2003-plus... no buttons or keyboard inputs work, nor TAB for Mame menu. Separate problem...)
In any case, while troubleshooting, I used the standard lr-mame2003 package to launch some 4-way games, and noticed that the 4-way joystick option was also present in the RA Quick Menu! I believe it's only shown as an option when running a 4-way game. I can find no documentation of lr-mame2003 supporting this 4-way flag on GitHub. But yet, there it is...
I've found that gameplay with lr-mame2003 4-way mode enabled has proven a little challenging in Pac-Man style games, and it will take some getting used to. For example... Instead of Pac-Man taking unwanted turns like in 8-way mode, he often just stops at an intersection, unless I've clearly anticipated the turn.
I'm curious if anyone else here has used the 4-way joystick mode in either lr-mame2003 or lr-mame2003-plus, and can compare the gameplay to the xboxdrv method. Thanks!
-
@PMac10000 said in Guide: Advanced Controller Mappings:
I'm curious if anyone else here has used the 4-way joystick mode in either lr-mame2003 or lr-mame2003-plus, and can compare the gameplay to the xboxdrv method. Thanks!
I can't compare the two, as I haven't tested the feature in libretro, but I can say that no such issue exists with the xboxdrv method. Also, seeing as how the directional dropout issue exists on a surprising amount of arcade console ports as well, having an outside universal solution up your sleeve can be very beneficial. For example, my favorite 'Pac-Man' variant is 'Jr. Pac-Man', specifically for the Atari 2600, due to its incredible breakneck pacing. Without a solution for four-way restriction, you'd be hard pressed to ever complete a level.
-
@PMac10000 - I don't know anyone that has tried both methods to compare (I always had to same question :) and you're correct 4-way is not documented in mame2003.
It was originally developed in mame2003-plus and the devs ported many of features and updates over to mame2003 just recently. They are very similar right now except for a few features and exclusive games that were added to Plus only. It should be pretty easy to test now that it's in 2 cores if anyone has the xboxdrv method setup.
I think I know what you're talking about and occasionally get stuck/stopped turning on ladders in Donkey Kong or get a millisecond lag still but could never quite know for sure and as you said you adapt to it but it doesn't feel 100% correct until you accept it as normal. Funny how the mind works.
Now that others are experiencing some of those same anomalies it might help looking into the issue. The dev @grant2258 that developed the feature loosely calls it "last direction" I believe. He tried a few methods and decided on this one.
Basically the character will continue in the same direction (up, down, left, right) until a new direction (up, down, left, right) is pressed. I think that might leave a bit of room on the stick for a dead spots but I am not 100% sure.
I think of it this way. There's 4 switches that equate to 8 directions. Which are up, down, left and right. The four angle directions are due to two switches being pressed simultaneously like up/right, up/left, down/right and down/left.
When you're moving right in Pac-Man and decide to go up at a corner but instead you hit right/up vs up only I don't think it will make the turn until it's up only. I don't know if that makes sense but I wonder if that's where potential dead spot might be introduced. In true 4-way there is no angle only the four directions which leaves no dead spot.
All this is just theory on my part but the dev that programmed the code would be able to answer it for sure.
-
@PMac10000 - I don't if it will help but go into RA and then Quick Menu -> Options. Near the bottom set
Input Interface
to simultaneous andLegacy Remapping
to enabled. Then your TAB key should work the same as mame2003 and hopefully allow you to map inputs in m3plus. -
Mame2003-plus has become very difficult for people to understand due to none legacy mode. First thing you want to do in mame2003 plus is update to the latest. Then you need to fix the input changes by deleting mame2003-plus/cfg contents.
the next step is to choose you controller type
options -> Control mapping ; analog_and_digital|digital (directions on lstick or dpad )
if you undestand how mame works this sets you input general too use directions default on dhat or lstick)to make mame work like you are used to set the following
options Input interface -> simultaneous (i named this mame and mark changed it back to simultaneous)no allow the mame mapping if you want to access the tab menu
Legacy Remapping (restart) -> enabledrestart you controls will work.
I cant really speak for mame2003 havent tested the feauture on there mark ported it there works like is should in plus.
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.