Guide: Advanced Controller Mappings
-
@mediamogul Thank you Mediamogul for the quick reply.
Actually I have a genuine Xbox 360 controller. And the Toggle Button is working pretty well in order to switch between configurations files. I am just looking for the basic config file, in order to change it to match my needs. In last resort I think that what you are describing might be useful in order to create a basic config file, from scratch. But I need to know how to map it from /etc/rc.local to a xboxdrv cfg file. Do you know any documentation about it ? I did'nt find anything. Thanks again! -
@Jon_Ge Well. I think I got it https://github.com/xboxdrv/xboxdrv/tree/stable/examples I will try that this weekend. Thank you anyway.
-
No problem. I hope it works out.
-
I added a section on key-mapping. This includes:
- Mapping keyboard keys to the controller buttons
- Mapping mouse movement to the analog sticks
- Mapping keyboard keys to the analog sticks
- Launching specific mappings alongside a specific emulator
- Managing global and individual mappings
I used ScummVM as the example, which should also help those suffering through the current control issues found in the native joystick support. I just beat 'Monkey Island 2' the other night using these controls and it was a joy to play.
-
@mediamogul said in Guide: Advanced Controller Mappings:
I added a section on key-mapping. This includes:
- Mapping keyboard keys to the controller buttons
- Mapping mouse movement to the analog sticks
- Mapping keyboard keys to the analog sticks
- Launching specific mappings alongside a specific emulator
- Managing global and individual mappings
I used ScummVM as the example, which should also help those suffering through the current control issues found in the native joystick support. I just beat 'Monkey Island 2' the other night using these controls and it was a joy to play.
Thank you very much. I used the scummvm part. Now I can finally play again!
Also thanks @Mayki for asking some questions for the ps3 controller. I used your configuration and it worked fine.Now I will create some settings for dosbox. With this tutorial it is much easier using xboxdrv than the mapper from dosbox.
-
Thank you for this guide. The Intellivision emulator maps the numeric keypad to the hat axes. The PS3 controllers has no hats so I was able to use xboxdrv to make use of the XBox controller's hat axes.
Thanks @Mayki for the PS3 configuration, saving me a heap of time. I did find that the left analog stick axes were inverted so I had to add
--axismap -y1=y1,-y2=y2 \
to my configuration to fix this. -
I'm glad the guide has helped and that this space has been used to share ideas. I made a mapping for DOSBox just the other day specifically for 'Chex Quest' that's a lot of fun to control. Also, speaking of Intellivision, I thought I'd share my own mapping for jzintv that I'm particularly proud of:
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 \ --force-feedback \ --dpad-as-button \ --trigger-as-button \ --deadzone-trigger 15% \ --deadzone 4000 \ --device-name "Logitech Rumblepad 2 (xboxdrv)" \ --silent \ --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_S:KEY_D,Y1=KEY_E:KEY_X,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4,lt+X2=KEY_5:KEY_6,lt+Y2=KEY_7:KEY_8,rt+X2=KEY_9:KEY_0,rt+Y2=KEY_MINUS:KEY_EQUAL \ --ui-buttonmap a=KEY_LEFTSHIFT,b=KEY_HOME,x=KEY_LEFTCTRL,y=KEY_LEFTALT,lb=KEY_F1,rb=KEY_F12,lt=KEY_HOME,rt=KEY_HOME,tl=KEY_HOME,tr=KEY_HOME,du=KEY_E,dd=KEY_X,dl=KEY_S,dr=KEY_D,start=KEY_PAUSE \ --ui-buttonmap back=cycle-key:KEY_F6:KEY_F5 \ --ui-buttonmap guide=void
Notice that with the use of 'lt' and 'rt' modifier keys applied to the
--ui-axismap
variable, I was able to map the entire twelve button keypad to the right joystick without changing any of jzintv's default settings:
--ui-axismap X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4,lt+X2=KEY_5:KEY_6,lt+Y2=KEY_7:KEY_8,rt+X2=KEY_9:KEY_0,rt+Y2=KEY_MINUS:KEY_EQUAL
Also, using the 'cycle-key' variable, I can make use of the emulator's ability to switch controller mappings on the fly for games that require player one to be using the second controller, without taking up two keys to do it:
--ui-buttonmap back=cycle-key:KEY_F6:KEY_F5
I could geek out on this stuff all day and there's still a lot more that xboxdrv allows for. I want to add a smaller section about adding rapid fire capabilities to any button sometime soon. Anyone who might find the Intellivision mapping of interest, below is a similar example for player 2 that also conforms to jvintv's default settings.
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.4:1.0-event-joystick \ --detach-kernel-driver \ --force-feedback \ --dpad-as-button \ --trigger-as-button \ --deadzone-trigger 15% \ --deadzone 4000 \ --device-name "Logitech Rumblepad 2 (xboxdrv)" \ --silent \ --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_J:KEY_K,Y1=KEY_I:KEY_M,X2=KEY_KP1:KEY_KP2,Y2=KEY_KP3:KEY_KP4,lt+X2=KEY_KP5:KEY_KP6,lt+Y2=KEY_KP7:KEY_KP8,rt+X2=KEY_KP9:KEY_DOT,rt+Y2=KEY_0:KEY_ENTER \ --ui-buttonmap a=KEY_RIGHTSHIFT,b=KEY_HOME,x=KEY_RIGHTCTRL,y=KEY_RIGHTALT,lb=KEY_F1,rb=KEY_F12,lt=KEY_HOME,rt=KEY_HOME,tl=KEY_HOME,tr=KEY_HOME,du=KEY_I,dd=KEY_M,dl=KEY_J,dr=KEY_K,back=KEY_HOME,start=KEY_PAUSE \ --ui-buttonmap guide=void
-
@mediamogul That's pretty impressive stuff. My approach was more straightforward as I wanted to take advantage of jzIntv's default mappings to play Deadly Discs. I swapped the hat with the right analog stick and created a keyboard hack file for JS1.
I have only tested the PS3 controller by USB for 1 player games so I may be taking a closer look at your configs later.
It may be an idea to create a repo on Github, like the one @Jon_Ge posted above, to collect configurations specific to RetroPie, maybe by controller and by emulator.
-
@dudleydes said in Guide: Advanced Controller Mappings:
It may be an idea to create a repo on Github, like the one @Jon_Ge posted above, to collect configurations specific to RetroPie, maybe by controller and by emulator.
That would be most keen.
-
Hi mediamogul,
first thing, WOW, what an amazing guide, i was fine tuning my retropie to make it work the way i want, but i wasn't able to configure scummVM to use the joypad in a correct way.
With your guide i was able make it work correctly like it work with my mouse and keyboard.
But, there is always a but,
when i start scummVM the joypad is recognized correctly and it's working very well, but it seems it doesen't load the scummvm.ini, because all the configuration i have made and my game list are disappeared.
I'm using Retropie 4.0.2 with ScummVM ver 1.8.1pre
My +Start ScummVM.sh look like this:#!/bin/bash game="$1" pushd "/home/pi/RetroPie/roms/scummvm" >/dev/null sudo killall >/dev/null xboxdrv sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ >/dev/null \ --evdev /dev/input/event2 \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_#48=lt,ABS_#49=rt \ --evdev-keymap KEY_#302=a,KEY_#301=b,BTN_DEAD=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_TRIGGER=back,KEY_#720=guide,BTN_TOP=start,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 \ --ui-axismap x1=REL_X:10,y1=REL_Y:-10 \ --ui-buttonmap b=BTN_LEFT,a=BTN_RIGHT,start=KEY_F5 \ --ui-buttonmap guide=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,lt=void,rt=void,back=void \ --ui-axismap x2=void \ -- \ /opt/retropie/emulators/scummvm/bin/scummvm --fullscreen --joystick=0 --extrapath="/opt/retropie/emulators/scummvm/extra" $game while read line; do id=($line); touch "/home/pi/RetroPie/roms/scummvm/$id.svm" done < <(/opt/retropie/emulators/scummvm/bin/scummvm --list-targets | tail -n +3) popd >/dev/null
If instead of
-- \
i use-- &
, ScummVM start with the correct configuration and game list, the joypad is working correctly, but when i quit ScummVM, the Joypad isn't working anymore in Emulationstation.
I solved adding sudo killall >/dev/null xboxdrv as last line but i don't know if it's a good way.
What do you think i made it wrong in my configuration ?
Thank you for any help. -
By adding the
&
, you have separated the command in two. First it launches your xboxdrv configuration and then it launches ScummVM as a separate process. For xboxdrv to tear itself down after the emulator quits, it all has to be in the same command, meaning that your xboxdrv config launches ScummVM as a part of itself and is therefore aware when it quits.I believe I know where the problem is. I think you may have either skipped over the step that allows uninput to run at the user lever, or you still have
sudo
attached to the beginning of your xboxdrv command. Either way, it's important that the command run at the user level and not the root user, which has no config preferences for any of the emulators. -
Thank you very much, you were absolutely right, i've made the step that allows uninput to run at user level but i forgot to remove
sudo
at the beginning of the command.
Now it works perfectly.
Thank you very much. -
I'm glad it's working. Tell Threepwood he fights like a dairy farmer.
-
How appropriate! I fight like a cow! :D
Thank you again.
-
For anyone interested, I posted an example of an Atari800/5200 mapping here.
-
@mediamogul you have been making an epic tutorial here...
I d love to see a 4way restrictions tutorial for games like PacMan in FBA and ΜΑΜΕ
-
I'm glad it's been helpful. Restricting the direction to four ways can be done by just adding the variable line below to any xboxdrv command. I've been meaning to edit the first section to make mention of it, but I'll post it here also.
--four-way-restrictor
If you're formatting the command the way I've been illustrating so far, you'd of course add a space and backslash afterward to allow a carriage return to the next line:
--four-way-restrictor \
The difference this makes when playing something like 'Pac-Man' or 'Burger Time' is huge and allows for a much tighter and more authentic control scheme.
-
@mediamogul Sorry for the possible silly post that follows :)
So...lets say my rom is called pacman.zip
If I create a pacman.zip.cfg file that contains only
--four-way-restrictor
and put it where my roms are, will be enough?
-
I'm afraid not. It can be added to any xboxdrv command, but it's exclusive to xboxdrv. I was a bit unclear in my wording above. I'll change for posterity.
-
@mediamogul I think that I am on xboxdrv. How can I check that it is working? (except from playing experience)
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.