Guide: Advanced Controller Mappings
-
Glad to see that worked. I might do a little experimentation to see how low the value can be dropped and make a note of it in the guide.
-
@mediamogul Hi mediamogul. Actually, sorry, I didn't explain myself very well. I should have said xboxdrv starts with no errors but the autofire does not work with the code I've supplied.
-
Ah, I see. Well, I'm gonna be gaming a good bit tonight, so I might try to give Stanley a fully automatic upgrade in 'Donkey Kong 3'. I'll let you know how it goes.
-
@mediamogul That would be terrific. Thanks. Hopefully, it's something simple I've missed or misunderstood.
-
OK, I can't speak as to whether or not the method you were using is broken in xboxdrv or not, but I was able to find a better and more flexible way of implementing autofire. Using the 'B' button as an example, the following should work the way you want.
--buttonmap b^autofire:100=b
This method would seem to be better all around, as it even allows you to set one button to act as the autofire equivalent of another. For example:
--buttonmap y^autofire:100=b
would mean that the 'B' button could act normally when pressed, while the 'Y' button would autofire 'B' at 100ms intervals. I haven't used any autofire configs before myself, but I have to admit, this would save a lot of blisters while playing 'Silver Surfer'.
-
@mediamogul said in Guide: Advanced Controller Mappings:
--buttonmap b^autofire:100=b
Thanks so much. That most definitely works. Full code on commandline is:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --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 a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_C,rb=KEY_V,back=KEY_5+KEY_1,start=KEY_6+KEY_2,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN \ --buttonmap x^autofire:100=x \ --ui-buttonmap back+start=macro:/opt/retropie/configs/all/advmame_exit.macro \ &
However, it still requires the kids to hold down the fire button permanently in Defender and I think 2 buttons is all they can really manage - thrust and reverse. I was hoping to try to have it so that the fire button autofires permanently without them having to hold down anything.
There is reference in the manual to the
toggle
function but no explanation as to how to use it. Anyway, I suppose that probably wouldn't work as autofire would probably switch it on and off a zillion times. There's nothing I could see in the manual which would suggest that there is a permanent "on" switch for a button. Thanks for your continuing help. -
I'll experiment with adding a toggle into the mix a little later today. It works as a modifier in much the same that the autofire feature does, so I'm not sure if they'll work together or not.
An alternative in 'Defender' might be to map the fire button to both direction buttons. You'd give up a bit of control, but it would pair it down to two buttons.Edit: After considering how 'Defender' is actually played, that wouldn't really work.
-
@mediamogul - how can I debug the driver ? I am trying to make sure that amiberry is launching and using my config. There seem to be some errors .. but the game launches .. the messages fly by too fast.
Thanks
#!/bin/sh source ~/RetroPie/roms/pc/get_stick_id/stick_id.sh echo $MYCTRL >> /dev/shm/stick.log ## 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 Configuraions - Standard controller mappings basicPS4="/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev=/dev/input/by-id/$MYCTRL \ --silent \ --detach-kernel-driver \ --force-feedback \ --mimic-xpad \ --dpad-as-button \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_RX=lt,ABS_RY=rt,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap BTN_EAST=a,BTN_C=b,BTN_SOUTH=x,BTN_NORTH=y,BTN_WEST=lb,BTN_Z=rb,BTN_START=tl,BTN_SELECT=tr,BTN_THUMBL=guide,BTN_TL2=back,BTN_TR2=start \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767" amiga="--axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x2=REL_X:1,y2=REL_Y:1 \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \ --ui-buttonmap lt=BTN_LEFT,rt=BTN_RIGHT,start=KEY_ESC,back=KEY_LEFTCTRL,y=KEY_SPACE,a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_LEFTSHIFT \ --ui-buttonmap guide=void,tl=void,lt=void,rt=void,back=void \ --ui-axismap x2=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 amiga) $xboxkill joycommand="$basicPS4 $amiga &" eval $joycommand ;; esac #--ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \
-
how can I debug the driver ?
First, you can try seeing if the command will launch on it's own from the command line. It should bark back any errors that come up. Your particular command should look like:
/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev=/dev/input/by-id/$MYCTRL \ --silent \ --detach-kernel-driver \ --force-feedback \ --mimic-xpad \ --dpad-as-button \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_RX=lt,ABS_RY=rt,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap BTN_EAST=a,BTN_C=b,BTN_SOUTH=x,BTN_NORTH=y,BTN_WEST=lb,BTN_Z=rb,BTN_START=tl,BTN_SELECT=tr,BTN_THUMBL=guide,BTN_TL2=back,BTN_TR2=start \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 \ --axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x2=REL_X:1,y2=REL_Y:1 \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \ --ui-buttonmap lt=BTN_LEFT,rt=BTN_RIGHT,start=KEY_ESC,back=KEY_LEFTCTRL,y=KEY_SPACE,a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_LEFTSHIFT \ --ui-buttonmap guide=void,tl=void,lt=void,rt=void,back=void \ --ui-axismap x2=void
-
@mediamogul thanks ... I am creating two logs to try and nail this down ... one just logs the controller name I am using system wide , the other logs the runcommand $1
The have the following line in them
runcommand.log hasamiga
xboxdrv.log has
usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick
Here is my runcommand-onstart.sh
#!/bin/sh source /opt/retropie/configs/all/get_id.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 $MYCTRL >> /opt/retropie/configs/all/xboxdrv_logs/xboxdrv.log echo $1 >> /opt/retropie/configs/all/xboxdrv_logs/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##*/}" echo $rom >> /opt/retropie/configs/all/xboxdrv_logs/rom.log ### Set variables for your joypad and emulator ### Basic Configuraions - Standard controller mappings basicPS4="/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev=/dev/input/by-id/$MYCTRL \ --silent \ --detach-kernel-driver \ --force-feedback \ --mimic-xpad \ --dpad-as-button \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_RX=lt,ABS_RY=rt,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ --evdev-keymap BTN_EAST=a,BTN_C=b,BTN_SOUTH=x,BTN_NORTH=y,BTN_WEST=lb,BTN_Z=rb,BTN_START=tl,BTN_SELECT=tr,BTN_THUMBL=guide,BTN_TL2=back,BTN_TR2=start \ --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767" amiga="--axismap -Y1=Y1,-Y2=Y2 \ --device-name "Amiga Joy" \ --ui-axismap x2=REL_X:1,y2=REL_Y:1 \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \ --ui-buttonmap lt=BTN_LEFT,rt=BTN_RIGHT,start=KEY_ESC,back=KEY_LEFTCTRL,y=KEY_SPACE,a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_LEFTSHIFT \ 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 amiga) $xboxkill joycommand="$basicPS4 $amiga &" echo $joycommand >> /opt/retropie/configs/all/xboxdrv_logs/joycommand.log eval $joycommand ;; esac
I was expecting to see a new controller named 'Amiga Joy" when running the cat command via ssh. But is seems like we are never hitting the amiga) section of the case statement because the joycommand.log file never gets generated. It is running the runcommand-onstart though and its also creating a rom.log from the rom variable. Its just not getting into the amiga subroutine at all.
-
Earlier you had poster the error you received from the command itself. When I posted the example command above, I missed the
$MYCTRL
variable. Try it again with the actual controller ID to see if the basic command works on it's own.As far as you runcommand script goes, I believe:
--calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767"
Should be:
--calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 \"
-
@mediamogul OK ... I am getting much closer .. my problem earlier was because I was concatenating the device_name incorrectly ... I needed to escape the quotes around the name.
so that line reads like this now
--device-name \"Amiga Joy\" \
I also added sudo in front of the /
basicPS4="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
The output in the shell is :
Your Xbox/Xbox360 controller should now be available as: /dev/input/js1 /dev/input/event3 Press Ctrl-C to quit
running cat reveals :
I: Bus=0003 Vendor=045e Product=028e Version=0110 N: Name="Amiga Joy" P: Phys= S: Sysfs=/devices/virtual/input/input3 U: Uniq= H: Handlers=kbd mouse1 event3 B: PROP=0 B: EV=200007 B: KEY=70c003c0 30000 0 0 0 0 1680 0 3000400 20000002 B: REL=3 B: FF=1 3f870000 0 0
the log i wrote looks like this
usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev=/dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick --silent --detach-kernel-driver --force-feedback --mimic-xpad --dpad-as-button --deadzone-trigger 15% --deadzone 4000 --trigger-as-button --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_RX=lt,ABS_RY=rt,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y --evdev-keymap BTN_EAST=a,BTN_C=b,BTN_SOUTH=x,BTN_NORTH=y,BTN_WEST=lb,BTN_Z=rb,BTN_START=tl,BTN_SELECT=tr,BTN_THUMBL=guide,BTN_TL2=back,BTN_TR2=start --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767 --axismap -Y1=Y1,-Y2=Y2 --device-name "Amiga Joy" --ui-axismap x2=REL_X:1,y2=REL_Y:1 --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP --ui-buttonmap lt=BTN_LEFT,rt=BTN_RIGHT,start=KEY_ESC,back=KEY_LEFTCTRL,y=KEY_SPACE,a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_LEFTSHIFT &
I must be doing something wrong though because running this stops the dpad and joystick from working at all in emulations station. Unless I need to configure input again in emulation station.
-
Unless I need to configure input again in emulation station.
You might have to. I'd definitely try that first.
-
@mediamogul Hi mediamogul. I never really sorted out the autofire for Defender in the way I hoped (ie I was hoping that it would just autofire constantly without holding down the button), but it is good enough for now. Thanks for your help on this.
I've now turned to the Amstrad CPC with lr-caprice32. It's working very well with xboxdrv, but I am having one problem. When I bring up the virtual keyboard with F9, it expects me to use a mouse to navigate. My bluetooth keyboard which has a built in touchpad works perfectly.
I've tried to replicate the mouse/touchpad by using my joystick as a mouse in the virtual keyboard. I've set up the right trigger to act as the modifier. I know the right trigger works because if I am in game and I press the right trigger, the joystick no longer operates; if I press the right trigger again, the joystick works again.
However, in the virtual keyboard GUI, moving joystick does nothing. Could you please have a look at my code? I was wondering whether the "rt" needed to be mapped to a key (for example). Thanks for any help.
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 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 \ --buttonmap rt^toggle=rt \ --ui-axismap rt+x1=REL_X:20,rt+y1=REL_Y:20 \ --ui-buttonmap a=KEY_X,b=KEY_Y,x=KEY_SPACE,y=KEY_ENTER,lb=KEY_1,rb=KEY_2,back=KEY_3,start=KEY_4,lt=KEY_5 \ --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \ --ui-buttonmap back+start=KEY_SPACE+KEY_ESC \ --ui-buttonmap start+back=KEY_F9 \ &
-
Your command appears to be right on the money. Also, from the activity that you've described, it's doing everything as it should. It could be that lr-caprice32 will only make use mouse0. Are any other mice attached while you're attempting all this. If so, try having them disconnected beforehand.
-
@mediamogul That's a good point. There are 2 other mice set up as home made spinners plus a trackball. It would be a bit fiddly to remove them so, unless there's something else I can do, I suppose I'll just have to use my bluetooth keyboard instead for the time being. Thanks for your help.
-
There are 2 other mice set up as home made spinners plus a trackball.
If they're not being used in lr-caprice32, you might be able to temporarily blacklist them from the
runcommand-onstart.sh
and then re-enable them in theruncommand-onend.sh
. Granted, I don't know if this is even possible, but it might be worth exploring. -
@mediamogul Hi. I'm gradually making my way through most of the emulators without too many problems now. The flexibility of xboxdrv really is amazing. I must confess I now prefer non-libretro/retroarch emulators that have hardcoded keys and then I can just use xboxdrv to convert them to my Dragonrise joystick inputs. It often takes a couple of minutes only.
However, I've run into a snag with linapple. I've read through this thread and noted your setup with linapple mimicking the keys and have followed it as per usual, but I'm finding my UP and DOWN aren't working in Championship Loadrunner (my test game). LEFT, RIGHT and the two buttons are okay, and I've made sure Joystick 2 isn't operational.
Stepping back one step, when I physically installed Joystick 1, I put it the wrong way round so the x and y axes were mixed up. This means with linapple (and other non-retroarch emulators) the axes are always messed up.
With linapple, I first experimented with linapple's internal joystick setup (no xboxdrv) before moving onto xboxdrv and your key method. With linapple's internal joystick setup, I had movement along both x and y axes (albeit in the wrong directions given the physical installation).
Now that I'm using xboxdrv though, LEFT and RIGHT are working as they should do, and so are the buttons, but UP and DOWN aren't working at all, and it has me a bit stumped as it should be a simple setup. Could you please have a look at the code and perhaps make any suggestions? Thanks.
Player1_appleII="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap x=void,y=void,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.3:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --ui-axismap X1=KEY_KP4:KEY_KP6,Y1=KEY_KP8:KEY_KP2 \ --evdev-keymap BTN_THUMB2=a,BTN_PINKIE=b,BTN_BASE3=back,BTN_BASE6=start \ --ui-buttonmap a=KEY_KP0,b=KEY_KPDOT \ --ui-buttonmap back=KEY_UNKNOWN,start=KEY_UNKNOWN,start+back=KEY_F1,back+start=KEY_F10" case $2 in linapple) $xboxkill joycommand="$Player1_appleII &" eval $joycommand ;;
Relevant parts of
linapple.conf
are:####################################################################### # # Joysticks, those sticks of joy! There may be 2 joysticks at the same time # Possible values are: # 0 - joystick disabled # 1 - use PC joystick #1 or #2, for corresponding joystick # 2 - Keyboard standard # 3 - Keyboard centered # When joysticks used as a keyboard, they are stuck to Numpad keys (1-9 - axis movement, 0 - button1, . - button2) # when centered used, axis of joystick will be centered after releasing any cursor (Numpad 1..9) key. # otherwise it assumed to be pressed always # 4 - Use mouse as a joystick. Rather interesting thing, try it. Useful in Fantavision(tm)by Broderbund Software # Default values are 2 for Joystick 0, and 0 for Joystick 1 Joystick 0 = 3 Joystick 1 = 0 # For Joysticks you can define which Joystick index number, axis number, and buttons. # # Default for Joystick 1 is index 0, axis 0 and 1, buttons 0 and 1. # Default for Joystick 2 is index 1, axis 0 and 1, button 0. Joy0Index = 0 Joy1Index = 1 Joy0Button1 = 0 Joy0Button2 = 1 Joy1Button1 = 0 Joy0Axis0 = 0 Joy0Axis1 = 1 Joy1Axis0 = 0 Joy1Axis1 = 1 # Enable Quitting the program with by pressing two joystick buttons at the same time # Default is enabled, default buttons are 8 and 9. (Xbox 360 back and start) JoyExitEnable = 1 JoyExitButton0 = 8 JoyExitButton1 = 9
-
Could it be related to this:
https://retropie.org.uk/forum/topic/5962/dragonrise-usb-driver-issue -
@mediamogul Thanks. In fact, I wound up having to reinstall linapple because something else was going on, and it appears that it's now working properly with xboxdrv after reinstallation, so all good.
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.