Guide: Advanced Controller Mappings
-
@mediamogul ,
This guide is a jem, thank you for creating it and monitoring this thread for the past seven months.
Quick question please.
I just switched from a wired SNES style pad to a wireless XBox360 controller, and following the instructions on the GutHub RetroPie Setup Wiki for XBox360 controllers, I was lead to believe that XPad is the way to go, due to kernel issues plaguing XBoxdrv. But I see that this thread still has people using XBoxdrv, and clearly XBoxdrv is vastly more configurable than XPad. So my question, before fully diving into this guide and applying it, is, are the warnings against using XBoxdrv unfounded? Let me put it another way, is there a single specific pitfall to avoid which would render XBoxdrv problematic? If it's about the kernel, any hints on how to determine what version of the kernel I am currently on, and how to avoid updating it in the future would be a big help. If the answer to these questions is available in the pages of this thread, please let me know that and I'll search it out.
Thanks!
-Dave -
To save me a lot of reading can someone give me a set of simplified steps to implement this for daphne and my dragonrise zero delay encoder, or even the most relevant posts to read
There is a lot of stuff in here that i'm not too sure of and dont want to mess my system up (Have taken a backup just in case!)
-
are the warnings against using XBoxdrv unfounded?
xboxdrv has two different modes of operation. The first acts as a tailored driver for an XBox 360 controller. It's here where there are kernel issues and if the goal is to simply get an XBox 360 controller up and running, then XPad is recommended. However, xboxdrv can also act as a mapping soltion for any controller that reports itself as a joystick event to the system, which also happens to apply to an XBox 360 controller. Using it in this way presents no kernel conflicts to my knowledge.
To save me a lot of reading can someone give me a set of simplified steps to implement this for daphne and my dragonrise zero delay encoder
While the information is currently unfamiliar to you and seems like a lot to digest, don't let it put you off too badly. Most of the length of the guide is dedicated to detailing the minor steps that are sometimes taken for granted. Make no mistake, this is more of an advanced technique than just normally configuring your controller, but by documenting every button press and keystroke along the way, you might be surprised at how quickly it moves from top to bottom once begun.
When I replied to you earlier, I took a brief look at the dragonrise zero delay encoder and what I found seemed to indicate that it identifies itself as a joystick event, which would allow it to work here. However, some encoders identify as a keyboard and cannot be mapped by xboxdrv. Fortunately, if you decide to move forward with this, you'll know in the earliest steps of the guide whether this will ultimately be possible when running
evtest
. If your button presses come back asBTN_
you can continue on. If they come backKEY_
then unfortunately it's not going to work, but at least you won't have wasted much time on anything. -
Many thanks for the clarification on the DR encoders.
Will have a play later and report back (as no doubt a config file will be of use to others if i get it working)
Chris
-
a s no doubt a config file will be of use to others if i get it working
Very much so.
-
When i run evtest i get continuous scrolling of various text.
Is there any way to stop it to get the details i need?
-
Someone else recently reported the same issue with the scrolling data. Is there anyway you can report back as to exactly what information is scrolling? Does it make mention of an axis repeatedly by chance?
-
@mediamogul said in Guide: Advanced Controller Mappings:
...xboxdrv can also act as a mapping soltion for any controller that reports itself as a joystick event to the system, which also happens to apply to an XBox 360 controller. Using it in this way presents no kernel conflicts to my knowledge.
That said, @mediamogul, if I follow your guide, am I operating the driver purely in 'mapping solution' mode by default? Also should I uninstall my Xpad driver before attempting your guide? Many thanks for the help.
-
OK by following the guide and in particular post 126 on this thread i have mapped the dragonrise to use xboxdrv when booting daphne.
Now the next issue.
Daphne (The emulator i am having problems with) always looks for the first js0, and the mapped xboxdrv is js1
is there a way to have this appear as js0 for this emulator?
-
if I follow your guide, am I operating the driver purely in 'mapping solution' mode by default?
In a sense, it's all pretty much the same thing. Mapping the physical controller to the xboxdrv virtual controller that it creates is more or less what is being done in the automatic mode anyway, but in answer to your question, yes it would then solely be used in this second manner.
Also should I uninstall my Xpad driver before attempting your guide?
All of my mapping examples include the
--detach-kernel-driver
argument, which is supposed to detach the XPad driver on launch, allowing them both to coexist.From the xboxdrv man page
-d, --detach-kernel-driver
Detaches the kernel driver that is currently associated with the
given device. This is useful when you have the xpad module
loaded and want to use xboxdrv without unloading it.However, I'm unsure if the Xpad driver would be active again when xboxdrv exits. I'm afraid a little experimentation would be needed there.
-
@Chillimonster said in Guide: Advanced Controller Mappings:
is there a way to have this appear as js0 for this emulator?
There is, but Daphne actually looks for the first joystick event rather than a jsX assignment and the event order cannot be changed. If you are able to map the dragonrise encoder's joystick to keyboard input using the xboxdrv guide, then Daphne won't have to worry about finding it, as it will just think it's any other keyboard.
Edit: Do you happen to know if the dragonrise has a mode to switch itself to keyboard input? If it did, then you should be able to map it that way instead.
-
I'll have a look at mapping the standard keyboard keys to the xboxdrv
-
don't let all the coding scare you. give it your best shot and people here will help point you in the correct direction. mostly @mediamogul. he is a god at this
-
he is a god at this
Hah, thank you for the compliment. I'll try not to let it go to my head. Of course, now that I think about it, why shouldn't "a god" use this information to it's fullest extent? Why, I could use this knowledge to control a cybernetic legion of scripted automatons, loyal only to me that could then be used to remake the world, nay the very fabric of existence in my image, so that I might rule over all without mercy or compassi... ahem, or I could just play a nice game of 'Bubble Bobble'.
-
-
@mediamogul Good stuff sir. I'm off to give this a shot. Thank you!!
-
Need to get my head round the key mappings.
Had a go at weekend and failed miserably.
Managed to get the settings for joystick to bind to the daphne emulator with the onstart / onend files so i can get it to enable / disable with the emulator, but no dice emulating keyboards controls
-
Managed to get the settings for joystick to bind to the daphne emulator with the onstart / onend files
That's always a good start.
but no dice emulating keyboards controls
If you want to post your xboxdrv command here, I'll take a look.
-
Hi mediamogul
You helped me about 5 months ago to get a DragonRise arcade joystick to work for which I was very appreciative.
I'm now trying to sort out uae4arm and was hoping you might help again please. My situation is that, using xpad driver, all cores and emulators (libretro and non-libretro) work, except uae4arm. With uae4arm, the axes are incorrect - x and y are mixed up. There appears no way to alter this from within uae4arm.
I have set up uae4arm to work with whdload and all games automatically start from Attract Mode/Emulationstation.
I need to restrict xboxdrv to operate only for uae4arm, and this is where I'm having trouble.
Steps taken:
- Works from /etc/rc.local
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2.3:1.0-event-joystick --detach-kernel-driver --silent --force-feedback --deadzone-trigger 15% --deadzone 4000 --trigger-as-button --mimic-xpad --device-name "Amiga Joystick Player 1 (xboxdrv)" --evdev-absmap ABS_X=y1,ABS_Y=x1 --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 &
(Note: having trouble using line separation which is why I have the statement on one line.)
- Works from runcommand-onstart.sh:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2.3:1.0-event-joystick --detach-kernel-driver --silent --force-feedback --deadzone-trigger 15% --deadzone 4000 --trigger-as-button --mimic-xpad --device-name "Amiga Joystick Player 1 (xboxdrv)" --evdev-absmap ABS_X=y1,ABS_Y=x1 --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 &
I've made the runcommand-onstart.sh executable and the above statement works as it replaces my DragonRise controller with the mimicked xbox controller, but the problem is that every emulator/core other than the Amiga now has mixed up axes.
- Works from terminal
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2.3:1.0-event-joystick \ --detach-kernel-driver \ --silent \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --mimic-xpad \ --device-name "Amiga Joystick Player 1 (xboxdrv)" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --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 \ &
However, I can't get the code to work from runcommand-onstart.sh with if/then statement using the following code:
#!/bin/sh echo $1 >> /dev/shm/runcommand.log echo $2 >> /dev/shm/runcommand.log echo $3 >> /dev/shm/runcommand.log echo $4 >> /dev/shm/runcommand.log if [ "$1" = "amiga" ] then sudo killall xboxdrv sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2.3:1.0-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --trigger-as-button \ --mimic-xpad \ --device-name "Amiga Joystick Player 1 (xboxdrv)" \ --evdev-absmap ABS_X=y1,ABS_Y=x1 \ --evdev-keymap BTN_TRIGGER=x,BTN_THUMB=y,BTN_THUMB2=a,BTN_PINKIE=b,BTN_BASE3=back,BTN_BASE6=start \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ &
The runcommand.log output of this code is:
/opt/retropie/configs/all/runcommand-onstart.sh: line 26: syntax error near unexpected token '&' /opt/retropie/configs/all/runcommand-onstart.sh: line 26: '&' Parameters: Executing: pushd /opt/retropie/emulators/uae4arm/; ./uae4arm -config="/home/pi/RetroPie/roms/amiga/Alien Breed Special Edition '92.uae" /opt/retropie/emulators/uae4arm /opt/retropie/supplementary/runcommand
I've also tried $2, $3 and $4 instead (with attempts to get the executable statement right and with "uae4arm" as the emulator). None has worked. It appears that where there is no if/then statement, it works perfectly, but with the if/then statement, the code doesn't recognise when emulation has started. I suspect that has something to do with the particular uae4arm setup I have with whdload.
My emulators.cfg for the Amiga looks like this:
uae4all = "bash /home/pi/RetroPie/roms/amiga/+Start\ UAE4All.sh" default = "uae4arm" uae4arm = "pushd /opt/retropie/emulators/uae4arm/; ./uae4arm -config=%ROM%" uae4arm-a500 = "/opt/retropie/emulators/uae4arm/uae4arm.sh rp-a500.uae %ROM%" uae4arm-a1200 = "/opt/retropie/emulators/uae4arm/uae4arm.sh rp-a1200.uae %ROM%" lr-puae = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-puae/puae_libretro.so --config /opt/retropie/configs/amiga/retroarch.cfg %ROM%"
I've also tried inserting the code (under items 1 and 2 above) into uae4arm.sh directly, but that hasn't worked and I've also tried putting the code into a separate bash script and "called" that script with bash from uae4arm.sh, but again that doesn't work. (I've probably made a mess of the syntax in the bash scripts, to be honest).
Thanks for any help.
-
@spud11 said in Guide: Advanced Controller Mappings:
I've probably made a mess of the syntax in the bash scripts, to be honest
You're probably OK. Just backtrack everything to the
runcommand-onstart.sh
method and first try removing the&
from the end of the command. I found that it was needed to continue to boot process when used inrc.local
, but it seems like I remember someone telling me that it wasn't necessary here.
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.