Guide: Advanced Controller Mappings
-
@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
. -
@mediamogul You do a terrific job. I have gone through your guide many times but without success.
I think I mess up in the rc.local
The evtest displays lots of entries when a press a button and lots lots lots :) when I move a stick or analog trigger.
So I think my problem lies in how to populate the rc.local from the results of evtest
Can you post me your rc.local ?
I think I can get an idea reading yours and evtesting my retropie.
Thank you!
-
Hi,
I've tried the following:
--ui-buttonmap du=ABS_HAT0X-, dd=ABS_HAT0X+, dl= ABS_HAT0Y-, dr=ABS_HAT0Y+
preceded by alongside
--dpad-as-button
, but it still get an error.How can I map the hat (seen as an analog input) to the
dd, du, dl, dr
keys ?Thanks for any help.
-
@Pyjamarama said in Guide: Advanced Controller Mappings:
The evtest displays lots of entries when a press a button and lots lots lots
This also happens with one of my controllers. In my case it meant that the axis input was so sensitive that it was being activated whenever any button was pressed. To prevent this from carrying over to the virtual controller, I had to add the
--deadzone 4000
. However, you'll still need a way to discern the actual button information from all the extra information you're given inevtest
. This takes a bit of work, as you'll have to barely tap each button and then scroll up to the very top of the resulting input and see what the first listing was before all the garbage. -
@weirdocollector said in Guide: Advanced Controller Mappings:
How can I map the hat
Mapping the dpad hatswitch from a physical controller to the xboxdrv virtual controller is done as follows:
--evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y
From there you would normally map keys to it like any other axis:
--ui-axismap dpad_x=KEY_LEFT:KEY_RIGHT,dpad_y=KEY_UP:KEY_DOWN
However, if you want to the dpad to be seen as button presses rather than an axis with the new virtual controller, you would add:
--dpad-as-button
Once this has been added you can now key-map the dpad with
--ui-buttonmap
such as:--ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT
-
Thanks mediamomogul!
Now the script works, but I have another problem.
If I enter the Atari5200 emulator, the controller commands doesn't work, but if I go to my SSH console and I type (in the /opt/retropie/configs/all directory)
./runcommand-onstart.sh atari800 + Return
, while the emulator is running, the controller starts working as expected (yay!).It seems that the script is finally correct, but it doesn't seem to start when the atari emulator il launched.
Am I forgetting something ?
-
I'm afraid I'll have to defer this question to @MadHorse, who has a better understanding of this area. In the mean time, go ahead and post the full contents of your
runcommand-onstart.sh
file and I'll see if anything jumps out. -
Thanks !
Here is my
runcommand-onstart.sh
script:#!/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 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 \ --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
Thanks for any help !
-
Ok, I've found the problem...
The
runcommand-onstart.sh
script passes as first parameters ($1
) the stringatari5200
, and not the stringatari800
, making the case into the script to skip the execution of the driver.In my script I've changed all the occurrances of
atari800
intoatari5200
and it now works !!Thanks to everybody for all the help !
-
Well done sir! Case scripting is an area that I haven't had time to fully explore yet, so these posts are always very informative.
-
@mediamogul sorry for acting like a lazy guy here, but can you share with us a way to set only one button to act like pressing two buttons?
The goal is to put a button on a bartop to do "exit emulator" function (usually start+select).
Thanks in advance.
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.