Guide: Advanced Controller Mappings
-
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.
-
Wow.
Only now am I starting to look into xboxdrv , in particular because I've always used the standard PS3 controllers and haven't felt the need for this until I am now trying to set up the GameMaker ports for SuperCrateBox, They Need to be Fed, Maldita Castilla.
I will certainly go through the extremely detailed tutorial and all the threads where @mediamogul and the rest of the community are sharing their guidance and make things happen on my own, but I was wondering if anyone would already have such mappings of PS3-controller-to-keyboard for these games, and the runcommand-xxx changes for these particular ports. :)
Doesn't hurt to ask. I will certainly take a look at it on my own afterwards and share any results I come up with. It's just I haven't had a lot of free time at home so any head start would be helpful.
Thanks!
-
@spud11 said in Guide: Advanced Controller Mappings:
I copied and pasted the text and it worked as intended
That's one less potential cause. Now, make a backup of
runcommand-onstart.sh
if you need to and then clear the original completely except for:#!/bin/sh if [ "$1" = "amiga" ] then 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 \ & fi
-
@pjft said in Guide: Advanced Controller Mappings:
I was wondering if anyone would already have such mappings of PS3-controller-to-keyboard for these games
I've never seen anyone discussing those particular games, but somewhere in this thread, there's a guy who mapped his PS3 controller and detailed it. You could knock off a few steps by cannibalizing his command and just add in the keys you want. It's probably best to start from scratch so that all the steps are accountable, but even then, it could still be used as a good reference.
-
@mediamogul thanks. I'll probably do it from scratch then, just need to find the time :)
I'll post any updates and likely all the questions when I run into difficulties.
-
@pjft You can find an xboxdrv config here that I use to map my PS3 controller in ROTT, a source port of Rise of the Triad.
It differs slightly from the PS3 controller example given in the xboxdrv repo. In my case, the PS button, or
guide
in xboxdrv, is mapped toKEY_#704
whereas in the xboxdrv example, it's mapped toKEY_#720
. My controller is model number CECHZC1E, one of the original SIXAXIS controllers. If you have a newer model, thenKEY_#720
may be the correct mapping.
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.