Guide: Advanced Controller Mappings
-
@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. -
@mediamogul Thanks for your quick response.
I removed the
&
from the runcommand-onstart.sh and got the following response:/opt/retropie/configs/all/runcommand-onstart.sh: line 27: syntax error: unexpected end of file 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 Amiberry build 2017-01-08, by Dimitris (MiDWaN) Panokostas and Olly Aigner Based on previous work by Chips and TomB (Pandora) Joystick 0 : DragonRise Inc. Generic USB Joystick Buttons: 12 Axis: 4 Hats: 1 Joystick 1 : DragonRise Inc. Generic USB Joystick Buttons: 12 Axis: 4 Hats: 1 Joystick 2 : DragonRise Inc. Generic USB Joystick Buttons: 12 Axis: 4 Hats: 1 Joystick 3 : DragonRise Inc. Generic USB Joystick Buttons: 12 Axis: 4 Hats: 1 starting sound thread.. stopping sound thread.. xboxdrv: no process found
Xboxdrv did not start.
The reference to line 27 is because I pressed
enter
at line 26. The reference to "xboxdrv: no process found" is because I have a runcommand-onend.sh file that stops xboxdrv if it is already running.After testing the above, I added (and now removed)
fi
as well and it didn't like that either.I've also removed the additional bash script from uae4arm.sh that I had added.
Just for completeness, the starting lines of the uae4arm.sh had read:
#!/bin/bash bash joystick.sh config="$1" rom="$2" rom_bn="${rom%.*}" pushd "${0%/*}" >/dev/null if [[ -z "$rom" ]]; then ./uae4arm elif [[ "$rom" == *.uae ]]; then ./uae4arm -config="$rom" -G else source "../../lib/archivefuncs.sh"
The second line was the new script I added. Joystick.sh (executable and in the same folder) was as follows:
#!/bin/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 &
In any event, it didn't work and I've removed it now and I've tested the script since removing.
Not sure what to do now. Thanks, mediamogul.
-
Let's take a step back. You posted a few examples that did work in various contexts, but they were different here and there from the one you were inserting into the runcommand-onstart. Let's double check that particular command to make sure it works by itself and go from there. Alone, it should be:
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
Try running it from the command line and see if it barks out any errors.
-
@mediamogul Thanks. Once I get home from work in a few hours, I'll do the commandline thing and let you know. Thanks, again.
-
As you have a dragonrise encoder you could be the very person to help me with my issues (and lack of knowledge)
Does yours now work ok with Daphne (My main, and currently, only issue)?
-
@Chillimonster Hi. I did have it working at one point, but on one of my other Raspberry Pi's. Sorry, but I haven't got it installed on the current Pi. I'll have a look - either install it on the current Pi and try it out with both xpad and xboxdrv or dig out the old Pi and see what settings I've got on it. (My recollection with the "old" Pi is that I had installed xboxdrv to work exclusively across all emulators).
-
@mediamogul I copied and pasted the text and it worked as intended:
xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details. Your Xbox/Xbox360 controller should now be available as: /dev/input/js4 /dev/input/event10 Press Ctrl-C to quit
-
@Chillimonster Hi. I just fired up the old Pi that has another DragonRise attached to it with xboxdrv installed, and have discovered that in fact this joystick is not working with Daphne. I do have Dragon's Lair installed, but I've tested it a minute ago and there's no joystick input at all. It just runs through the attract mode.
I went back to my notes (I keep copious notes of how I got things working) and it turns out in my "to do" list I had Daphne/DragonRise/xboxdrv on my list of things to get working, but it appears I didn't get round to it.
I have in the meantime built another RetroPie system, but haven't yet installed Daphne on this new one. I'm currently working on the Amiga and a couple of other systems, but will get to Daphne at some point, especially as I have clearly not got it working before. Sorry about that. I'm assuming that you've exhausted efforts with the xpad driver too.
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.