Guide: Advanced Controller Mappings
-
@Rion said in Guide: Advanced Controller Mappings:
I will probably bugg you some more when i start mapping the individual emulators
Not a problem. I'm sure we'll have better luck after the controller has fully paired.
-
Hi again!
I've finally tried to use what I learned from this thread (and another one about mapping the Atari800 emulator buttons) and the wiki to my Retropie installation, but it does not seem to work.
I've created the following /opt/retropie/configs/all/runcommand-onstart.sh file
#!/bin/sh ## Uncomment one or all of the following if you need to find some information about the emulator or roms ## Name of the emulator #echo $1 >> /dev/shm/runcommand.log ## Name of the software used for running the emulation #echo $2 >> /dev/shm/runcommand.log ## Name of the rom #echo $3 >> /dev/shm/runcommand.log ##Executed command line #echo $4 >> /dev/shm/runcommand.log ### The FUN begins #Get ROM name striping full path rom="${3##*/}" ### Set variables for your joypad and emulator ### Basic Configurations - Standard controller mappings XboxOne="/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-Microsoft_Controller_7EED8E7D89A9-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --trigger-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr \ --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 \ &" ### Extended Configurations ### Specific emulator configuration or any other parameters you will need only for some emulators atari800="--axismap -Y1=Y1,-Y2=Y2 \ --dpad-as-button \ --evdev-keymap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr \ --ui-axismap X1=KEY_KP4:KEY_KP6,Y1=KEY_KP8:KEY_KP5 \ --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_KPASTERISK:KEY_EQUAL \ --ui-buttonmap a=KEY_RIGHTCTRL,b=KEY_F2,x=KEY_EQUAL,y=KEY_KPASTERISK,lb=KEY_F9,rb=KEY_F5,du=KEY_KP8,dd=KEY_KP5,dl=KEY_KP4,dr=KEY_KP6,start=KEY_F4,back=KEY_F3,lt=KEY_HOME,rt=KEY_HOME,tl=KEY_HOME,tr=KEY_HOME \ --ui-buttonmap lt+a=KEY_ENTER,lt+b=KEY_ESC,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_F1 \ --ui-axismap lt+X1=KEY_LEFT:KEY_RIGHT,lt+Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap guide=void" fourway="--four-way-restrictor" invert="--ui-buttonmap du=KEY_DOWN,dd=KEY_UP" ### Kill Command xboxkill="sudo killall >/dev/null xboxdrv" ### Execute the driver with the configuration you need # $1 is the name of the emulation, not the name of the software used # it is intellivision not jzintv case $1 in atari800) $xboxkill joycommand="$XboxOne $atari800 &" eval $joycommand ;; esac
were I've tried to map my XboxOne controller to the Atari800 emulator control keys.
I've mapped half the dpad (that is treated as an ABS event) to the main direction keys, and I've used the mapping of the Atari800 buttons from this thread:
https://retropie.org.uk/forum/topic/3651/mapping-certain-keys-from-atari800-emu-to-the-gamepad/7
It seems all OK to me, as the same Xbox One controller configuration is succesfully used in the rc.local file, but when I start the Atari800 emulator from Emulationstation, and select a game from the list, I just get the emulator menu (the one in which you can choose the cartridge type), and I cannot move the cursor using the controller.
I've made the script executable, and configured xboxdrive to run at user level.
Could anybody point me to what I'm doing wrong ?
Thanks a lot !
-
Hi @weirdocollector ,
Hi think the problem is the
&
at the end of the variableXboxOne
, when the command is executed in theeval $joycommand
part, it will run only the Basic XboxOne configuration in the background, and will not pass the specific command for the emulator.
The&
to run the program in background is already part of thejoycommand
variable, so it is also not needed.Please, try to edit the command removing
&
from theXboxOne
variable and let us know if it's working. -
Hi,
i would like to thank @meleu for the information you gave me about the standard output redirection and about the
runcommand.info
, i don't know why i never tried to open it before :).
And thank to @mediamogul for his guide, his help, and for adding theruncommand-onstart.sh
to the Universal Controller Calibration & Mapping Using xboxdrv wiki page.Thank you all.
-
@MadHorse said in Guide: Advanced Controller Mappings:
Hi @weirdocollector ,
Hi think the problem is the
&
at the end of the variableXboxOne
, when the command is executed in theeval $joycommand
part, it will run only the Basic XboxOne configuration in the background, and will not pass the specific command for the emulator.
The&
to run the program in background is already part of thejoycommand
variable, so it is also not needed.Please, try to edit the command removing
&
from theXboxOne
variable and let us know if it's working.Thanks a lot !
I'm now away from my RetroPie: I'll try ASAP and let you know.
Thanks again!
-
@MadHorse said in Guide: Advanced Controller Mappings:
And thank to @mediamogul for his guide, his help, and for adding the runcommand-onstart.sh to the Universal Controller Calibration & Mapping Using xboxdrv wiki page.
Not a problem. Please feel free to add to it with any other ideas or techniques you may have going forward.
-
@MadHorse said in Guide: Advanced Controller Mappings:
Hi @weirdocollector ,
Hi think the problem is the
&
at the end of the variableXboxOne
, when the command is executed in theeval $joycommand
part, it will run only the Basic XboxOne configuration in the background, and will not pass the specific command for the emulator.
The&
to run the program in background is already part of thejoycommand
variable, so it is also not needed.Please, try to edit the command removing
&
from theXboxOne
variable and let us know if it's working.Hi !
I've tried again after renoving the '&' at the end of the 'XboxOne' variable, but it still doesn't work.
I've noticed that the first time I launch the Atari800 emulator from Emulationstation, the menu in which it is possible to choose the cartridge type appears, but it is not possible to change the time or lauch the game from this menu, even using the keyboard (up/down keys or return).
If I press F5 it goes to the Atari800 start screen, and after this I can press F1, enter the main menu, and launch the game from there.
Once the game has lauched, the XboxOne controller does not work in game.
Any suggestion on this ?
Should I have to remove the XboxOne controller configuration in the rc.local ?
Thanks in advance for any help.
P.S.: I'd also like to thank Mediamogul and all the nice and clever people that has made this thread a reality.
-
hi @weirdocollector,
probably you also need to remove the
\
character at the end of the last line of the XboxOne basic configuration.You don't need to remove the configuration from rc.local, we start with a
sudo killall >/dev/null xboxdrv
that kill any other instance of xboxdrv, but you have to remember to add the same configuration at the end of theruncommand-onend.sh
otherwise the controller will not work anymore when you exit from the emulator. -
Hello
I'm new to this forum and was hoping please for some help in mapping a Zero delay USB Encoder Arcade joystick for the small arcade table I've built. I'm using the latest Raspberry Pi 3 and have RetroPie 4.0.2 installed. With the ordinary Xpad driver installed with RetroPie, I've got the joystick working in Emulationstation and Retroarch and in some of the libretro cores (but not all of these seem to work) and so was hoping to use some of the emulators instead of libretro cores. I was hoping the xboxdrv driver would mean less individual mapping for the emulators.
I've installed the xboxdrv driver and disabled it via RetroPie-Setup.
I've read through every post of this thread, and have some familiarity with Linux but am struggling with the mappings. I've got 6 buttons - those that should correspond to A, B, X and Y plus a Start and Select button. There is only 1 joystick, but I'm not sure if I should be mapping that to analog (left stick) or to the D-Pad please on the virtual XBox controller.
My apologies for the long post. I wasn't sure how to do "inline" comments (like Rion and mediamogul have done, for example).
Here is the output.
cat /proc/bus/input/devices
:I: Bus=0003 Vendor=0079 Product=0006 Version=0110 N: Name="DragonRise Inc. Generic USB Joystick " P: Phys=usb-3f980000.usb-1.2/input0 S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:0079:0006.0001/input/input0 U: Uniq= H: Handlers=js0 event0 B: PROP=0 B: EV=1b B: KEY=fff 0 0 0 0 0 0 0 0 0 B: ABS=3001f B: MSC=10
[Note: no other devices connected at the time.]
ls /dev/input/by-id/
:usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick usb-DragonRise_Inc._Generic_USB_Joystick-joystick
evtest /dev/input/event0
Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x79 product 0x6 version 0x110 Input device name: "DragonRise Inc. Generic USB Joystick " Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 288 (BTN_TRIGGER) Event code 289 (BTN_THUMB) Event code 290 (BTN_THUMB2) Event code 291 (BTN_TOP) Event code 292 (BTN_TOP2) Event code 293 (BTN_PINKIE) Event code 294 (BTN_BASE) Event code 295 (BTN_BASE2) Event code 296 (BTN_BASE3) Event code 297 (BTN_BASE4) Event code 298 (BTN_BASE5) Event code 299 (BTN_BASE6) Event type 3 (EV_ABS) Event code 0 (ABS_X) Value 127 Min 0 Max 255 Flat 15 Event code 1 (ABS_Y) Value 127 Min 0 Max 255 Flat 15 Event code 2 (ABS_Z) Value 130 Min 0 Max 255 Flat 15 Event code 3 (ABS_RX) Value 127 Min 0 Max 255 Flat 15 Event code 4 (ABS_RY) Value 127 Min 0 Max 255 Flat 15 Event code 16 (ABS_HAT0X) Value 0 Min -1 Max 1 Event code 17 (ABS_HAT0Y) Value 0 Min -1 Max 1 Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Properties: Testing ... (interrupt to exit)
I then tested the buttons and axes which produced the following:
Buttons:
(EV_KEY), code 288 (BTN_TRIGGER) (EV_KEY), code 289 (BTN_THUMB) (EV_KEY), code 290 (BTN_THUMB2) (EV_KEY), code 291 (BTN_TOP) (EV_KEY), code 298 (BTN_BASE5) (EV_KEY), code 295 (BTN_BASE2)
I've tried to map the first 4 buttons above to A, B, X and Y, respectively, and the last 2 I've tried to map to Start and Select, respectively.
Axes:
(EV_ABS), code 3 (ABS_RX) (EV_ABS), code 3 (ABS_RX) (EV_ABS), code 0 (ABS_X) (EV_ABS), code 0 (ABS_X)
The ABS_RX axes correspond to the joystick moving up and down; the ABS_X axes correspond to the joystick moving left and right.
ABS_Y, ABS_Z, ABS_RY, ABS_HAT0X and ABS_HAT0Y are not mapped.
BTN_TOP2, BTN_PINKIE, BTN_BASE, BTN_BASE3, BTN_BASE4, BTN_BASE6 are not mapped.In the etc/rc.local file, I mapped the Virtual Xbox 360 as follows:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --mimic-xpad \ --device-name "8-Way Arcade Joystick" \ --evdev-absmap ABS_X=x1,ABS_RX=y1 \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_BASE2=back,BTN_BASE5=start \ --ui-axismap --ui-buttonmap lb=void,rb=void,tl=void,tr-void,guide=void,dpad_x=void,dpad_y=void,lt=void,rt=void \ &
The above code produced no change at all. It reboots into EmulationStation and if I try to configure the joystick I get the usual DragonRise one - no virtual XBox Driver.
If I change the mapping to below, when I reboot I get the message during boot up that it has mapped to the virtual XBox controller (js1 and Event1, for example, assuming no keyboard is attached) and to press CTRL-C but unfortunately it's crashed without going any further - no error message and no Emulationstation. If I press any keys, it just produces symbols and I have to reboot again.
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --device-name "8-Way Arcade Joystick" --mimic-xpad \ --dpad-as-button \ --evdev-absmap ABS_X=x1,ABS_RX=y1 \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_BASE2=back,BTN_BASE5=start \ --dpad-only \ --ui-axismap lt=void,rt=void --ui-buttonmap lb=void,rb=void,tl=void,tr-void,guide=void \ &
Could I please ask for some help? Thanks.
-
@spud11 said in Guide: Advanced Controller Mappings:
I'm new to this forum
I wasn't sure how to do "inline" comments
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
I'm not sure if I should be mapping that to analog (left stick) or to the D-Pad
In most cases, mapping to the left stick is the best option.
In the etc/rc.local file, I mapped the Virtual Xbox 360 as follows:
Each line except for the last should have a space and a backslash added so that it can be read as one single command, as follows:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --mimic-xpad \ --device-name "8-Way Arcade Joystick" \ --evdev-absmap ABS_X=x1,ABS_RX=y1 \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_BASE2=back,BTN_BASE5=start \ --ui-buttonmap lb=void,rb=void,tl=void,tr-void,guide=void,dpad_x=void,dpad_y=void,lt=void,rt=void \ &
That might be all that is needed to get you going. Everything else looks fine.
-
@mediamogul Thanks, mediamogul, for the code and the nice welcome! I'll have a go with that code once I get home, and will try the "blocks of code" with my next email too.
-
@mediamogul Hi. Thanks for your help. Unfortunately, the code did not work insofar as nothing changed. No errors or anything. Should I provide a log and, if so, which one please? Thanks again for your help.
-
There is no log to speak of. However, you can execute the command directly from a command prompt, minus the
&
at the end. There it should give some verbose feedback as to what is going on. -
@mediamogul Hi. Thanks for that. I ran the code in Putty. (I used "exit" rather than the "&" at the end of the code.) It produced the following error:
-- [ ERROR ] -------------------------------------------------------------- error: invalid argument '--ui-buttonmap lb=void,rb-void,tl=void,tr-void,guide=void,dpad_x=void,dpad_y=void,lt=void,rt=void' string2btn(): couldn't convert string "tr-void" to XboxButton
I then changed the "tr-void" to "tr=void" and it produced a similar error as above but the string2btn() line changed to the following:
string2btn(): couldn't convert string "dpad_x" to XboxButton
Thanks for your help.
-
@spud11 said in Guide: Advanced Controller Mappings:
it produced a similar error as above but the string2btn() line changed to the following:
I've never tried to void the dpad, but I do know that
dpad_x=void
anddpad_y=void
aren't valid entries for--ui-buttonmap
. However, I believe you might be able to void them under--ui-axismap
such as:--ui-axismap dpad_x=void,dpad_y=void
If that doesn't work, you might try omitting them from the configuration altogether.
-
@mediamogul Thanks. I'll try both options when I'm home and let you know how I go.
-
@mediamogul Hi. Thanks so much. The code without the --ui-axismap did the trick. I've set it out below for anyone who has a Zero Delay Arcade Encoder. For sake of completeness, I've attached an image of the encoder too.
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --mimic-xpad \ --device-name "8-Way Arcade Joystick" \ --evdev-absmap ABS_X=x1,ABS_RX=y1 \ --evdev-keymap BTN_TRIGGER=a,BTN_THUMB=b,BTN_THUMB2=x,BTN_TOP=y,BTN_BASE2=back,BTN_BASE5=start \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ &
Again, thanks so much, mediamogul. I couldn't have done it without your help. I'm now in the process of trying to change the arcade joystick to port 0 (rather than it defaulting to the DragonRise). .
-
Hi again.
I'm finally back to my RetroPie, ands I'm still struggling with the xboxdrv drive configuration, that continues to refuse to work as expected.
I've applied all the suggested syntax modifications to my /opt/retropie/configs/all/runcommand-onstart.sh, which is the now the following:
#!/bin/sh ## Uncomment one or all of the following if you need to find some information about the emulator or roms ## Name of the emulator echo $1 >> /dev/shm/runcommand.log ## Name of the software used for running the emulation echo $2 >> /dev/shm/runcommand.log ## Name of the rom #echo $3 >> /dev/shm/runcommand.log ##Executed command line echo $4 >> /dev/shm/runcommand.log ### The FUN begins #Get ROM name striping full path rom="${3##*/}" ### Set variables for your joypad and emulator ### Basic Configurations - Standard controller mappings XboxOne="/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-id/usb-Microsoft_Controller_7EED8E7D89A9-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --trigger-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr \ --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" ### Extended Configurations ### Specific emulator configuration or any other parameters you will need only for some emulators atari800="--axismap -Y1=Y1,-Y2=Y2 \ --dpad-as-button \ --evdev-keymap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr \ --ui-axismap X1=KEY_KP4:KEY_KP6,Y1=KEY_KP8:KEY_KP5 \ --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_KPASTERISK:KEY_EQUAL \ --ui-buttonmap a=KEY_RIGHTCTRL,b=KEY_F2,x=KEY_EQUAL,y=KEY_KPASTERISK,lb=KEY_F9,rb=KEY_F5,du=KEY_KP8,dd=KEY_KP5,dl=KEY_KP4,dr=KEY_KP6,start=KEY_F4,back=KEY_F3,lt=KEY_HOME,rt=KEY_HOME,tl=KEY_HOME,tr=KEY_HOME \ --ui-buttonmap lt+a=KEY_ENTER,lt+b=KEY_ESC,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_F1 \ --ui-axismap lt+X1=KEY_LEFT:KEY_RIGHT,lt+Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap guide=void" fourway="--four-way-restrictor" invert="--ui-buttonmap du=KEY_DOWN,dd=KEY_UP" ### Kill Command xboxkill="sudo killall >/dev/null xboxdrv" ### Execute the driver with the configuration you need # $1 is the name of the emulation, not the name of the software used # it is intellivision not jzintv case $1 in atari800) $xboxkill joycommand="$XboxOne $atari800 &" eval $joycommand ;; esac
As you may have noticed, I've uncommented some of the lines at the start of the script, in order to get the runcommand.log file, and getting some hints about what's wrong with it.
I've rebooted my Pi, but I got no runcommand.log file into the /dev/shm/ directory; I've also tried to run directly the script with ./runcommand-onstart.sh, and I got an empty runcommand.log file.
What am I doing wrong ?
Thanks for any help.
-
Hi again!
I've made some progress.
Launching the script ./runcommand-onstart.sh atari800, I get the following error message:
-- [ ERROR ] ------------------------------------------------------ error: invalid argument '--evdev-absmap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr' string2axis(): couldn't convert string "du" to XboxAxis
The problem seems to be that I do not know how to map the Xbox One controller hat (that is considered an analog input), to the
du, dd, dl, dr
keys.Do someone know how the correct mapping can be done ?
I've looked at the xboxdrv documentation, but I couldn't extrapolate anything useful.
-
The error is from du, dd, dl, dr being used in
--evdev-absmap
. du, dd, dl, dr can only be used with--ui-buttonmap
alongside--dpad-as-button
.
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.