Guide: Advanced Controller Mappings
-
@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.
-
Glad to hear it. It's also good to see that all this mapping nonsense has become second nature. I agree with you about the standalone emulators. The RetroArch ports are very convenient and have their own set of advantages, but they always seem to lack so many features that their standalone counterparts have had for years. That said, it's great to have both options available.
-
@mediamogul Hi. I had a look through the thread and tried a search too, but it is now so long I couldn't find what I was looking for.
Could you please let me know whether you mapped your F710 directly via Reicast's config program or whether you mapped a keyboard via Reicast's config program and then used xboxdrv to map the keyboard to the F710?
I've tried mapping my Dragonrise Arcade joystick via Reicast's config program, and that does work, but that will only allow me to map 1 dpad or the analog controls, not both dpads and the analog controls.
So I thought I would use Reicast's config program to map my bluetooth keyboard. That allowed me to map both dpads but not the analog controls. From there, I thought I might be able to use xboxdrv to map things so that I could use a toggle so that I could shift from dpad1 to dpad2 using the same joystick. Although xboxdrv seems to be working in the background, the arcade joystick and buttons aren't doing anything at all. I haven't fully tested it out yet, but it did make me think: does xboxdrv even work with Reicast or is it "a bridge too far"? Any help would be appreciated. Thanks.
-
I haven't used Reicast in a while and I currently have it uninstalled, but I believe I just used the the default method for mapping. If I remember correctly, Reicast needs the joystick to be analog, so a straight key-map wouldn't work. You should be able to create a toggle that switches your joystick between analog and a key-map, but I think you'd still need to configure Reicast to find the analog stick. When you key-mapped before, was it just the joystick not being read, or were the buttons unresponsive as well?
-
@mediamogul Thanks very much.
I went back to the default method - scrubbed the keyboard idea, and now I've reconfigured the joystick using the default method. First time I ignored the dpads and only mapped the analog stick. Second time I mapped both dpads and the analog stick to the joystick. (The configuration program allows you to map more than one button or axis to the same thing which is a bit weird).
However, in both examples, the analog stick doesn't seem to work. Some games like Trizeal seem to rely on the analog stick and some like NBA Showdown require dpad1. The latter works, but the former doesn't so it appears the analog controls aren't being mapped properly to the DragonRise joystick, despite registering during the default configuration process. All the fire buttons work in both cases.
It's a bit of a pity. I'd really like to get the exit button/key mapped to select + start using xboxdrv like almost every other emulator I have. On my arcade table, it's really easy to press the exit button accidentally with reicast's default config.
Current mapping with both dpads and analog stick mapped to the joystick:
[emulator] mapping_name = DragonRise Inc. Generic USB Joystick btn_escape = 296 [dreamcast] btn_a = 290 btn_b = 293 btn_c = 288 btn_d = 289 btn_x = 292 btn_y = 291 btn_z = 298 btn_start = 299 axis_x = 1 axis_y = 0 [compat] axis_dpad1_x = 1 axis_dpad1_x_inverted = no axis_dpad1_y = 0 axis_dpad1_y_inverted = yes axis_dpad2_x = 1 axis_dpad2_x_inverted = no axis_dpad2_y = 0 axis_dpad2_y_inverted = yes btn_trigger_left = 295 axis_x_inverted = no axis_y_inverted = yes
-
I've held off on responding, hoping that I'd find some time to do some personal experimenting here, but the hammers just keep falling. One idea that's worth entertaining if you haven't already tried it, is having that particular xboxdrv map activated in Emulation Station and running the joystick configuration. Seeing as how it is now supposed to configure Reicast controls automatically, it might make some small difference that would allow it to work.
-
@mediamogul Thanks for that. Unfortunately, I'm actually only using Attract Mode now. I still have Emulation Station installed but haven't used that for quite some time, so I'm unsure what you mean by "xboxdrv map activated in Emulation Station".
-
how would i go about making my dpad a mouse? I'm using the Loverpi snes controller and zdoom, and i would like to utilize the menus. thanks
-
how would i go about making my dpad a mouse?
So long as your DPad identifies as ABS events and not BTN, you would just use the same set of steps for mapping mouse movement to a joystick.
-
@mediamogul Hi. I'm currently using xboxdrv and moonlight together and trying both to quit a game and terminate the stream with the one key press.
Occasionally, I'm finding that if I quit a game, the stream continues. Built into Moonlight, you can quit a game with the ESC key and also quit the stream by holding down Shift-Control-Alt+Q.
By pressing the back + right trigger keys, I'm trying to get xboxdrv, first, to send the ESC key and, second, to send Shift-Control-Alt+Q, but cannot get it to work.
I've tried setting up a macro but the macro seems only to allow one key press at a time (eg press ESC, then press Shift etc) eg the following won't work:
send KEY_ESC 1 wait 100 send KEY_LEFTCTRL+KEY_LEFTSHIFT+KEY_LEFTALT+KEY_Q 1
I've also tried
--ui-buttonmap back+rt=KEY_ESC+KEY_LEFTCTRL+KEY_LEFTSHIFT+KEY_LEFTALT+KEY_Q \
, but that doesn't work.I've tried having both
--ui-buttonmap back+rt=KEY_ESC \
and--ui-buttonmap back+rt=KEY_LEFTCTRL+KEY_LEFTSHIFT+KEY_LEFTALT+KEY_Q \
in the one script. That doesn't work.I see that you've previously set up key-cycles via xboxdrv and xboxdrv seems to allow key-sequences, but not sure how that works.
So at the moment I've got back+rt sending the Escape key and rt+back sending the Shift-Control-Alt+Q and I quickly press one after the other which works. It would just be nice to have back+rt do both with the one key press.
Would you have any insight please?
-
@spud11
Sorry it's taken me a while to get back to you, but I knew I was going to have to re-familiarize myself with a few things first. To tell you the truth, your current working arrangement is one I've settled on myself for a few tricky situations like this and there aren't a lot of alternatives. However, your key-cycle suggestion might just work to consolidate the commands to one button, albeit with two button presses. The cycle would look something like:--ui-buttonmap back+rt=cycle-key:KEY_ESC:KEY_LEFTCTRL+KEY_LEFTSHIFT+KEY_LEFTALT+KEY_Q
Just like what you've tried already, it's possible that combinations can't be used in the cycle, but if it works, you should be able to press the button once for 'Escape' and again for 'CTRL+Shift+Q'.
-
@mediamogul Thanks, mediamogul, for taking the time. I can confirm that that worked - by pressing twice you get the Escape key followed by Shift-Ctrl-Alt Q.
One other possibility I was thinking of but not sure whether it's actually possible: bind another key eg the 'A' key to Shift-Ctrl-Alt Q, then in a macro have:
send KEY_ESC 1 wait 100 send KEY_A 1
(Something I regularly do using Autohotkey on Windows 7.)
-
@spud11 said in Guide: Advanced Controller Mappings:
One other possibility I was thinking...
I'm almost certain xboxdrv can't bind keyboard keys with other keys/key combinations, but if you could find an outside solution to handle that part, it should work well.
-
Something that's always bothered me about launching xboxdrv using
runcommand-onstart.sh
is that it makes using the Runcommand menu itself somewhat impossible. This is because the xboxdrv mapping is made active before the Runcommand menu appears, therefore interfering with the expected control scheme. Over the weekend, I've been experimenting with some ways around this.First, I tried scripting the xboxdrv command not to launch until it detected that the intended emulator/port had launched. This worked well, except the script needed the specific executable name for the software it was looking for, making everything a little more laborous to set up than I felt it needed to be. I was prepared to live with it, until I noticed that AdvanceMame refused to recognized an xboxdrv simulated mouse event unless it was present before it launched. Seeing as how I play many games that rely on analog controls, it was important enough for me to rethink the approach.
What I needed was something that could be discovered from the
runcommand-onstart.sh
script that signals the launch of the Runcommand menu, yet yet also signals it's closing before the emulator/port software is launched. After taking a look at/opt/retropie/supplementary/runcommand/runcommand.sh
, it looked as though it invoked and exitedjoy2key.py
in exactly the way I needed. With a little more experimenting, I came up with the following that uses the xboxdrv example from the first section of my guide.if [ "$2" = "advmame" ]; then sudo killall > /dev/null 2>&1 xboxdrv j2kpid="0" until [ "$j2kpid" -gt "0" ]; do j2kpid=$(pgrep -f joy2key.py) sleep 1 done while s=$(ps -p "$j2kpid" -o s=) && [ "$s" ] && [ "$s" != 'Z' ]; do sleep 1 done /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --evdev /dev/input/by-id/[•] \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 4000 \ --mimic-xpad \ --evdev-absmap ABS_[•]=x1,ABS_[•]=y1,ABS_[•]=x2,ABS_[•]=y2,ABS_[•]=lt,ABS_[•]=rt,ABS_[•]=dpad_x,ABS_[•]=dpad_y \ --evdev-keymap BTN_[•]=a,BTN_[•]=b,BTN_[•]=x,BTN_[•]=y,BTN_[•]=lb,BTN_[•]=rb,BTN_[•]=tl,BTN_[•]=tr,BTN_[•]=guide,BTN_[•]=back,BTN_[•]=start fi &
This waits for
joy2key.py
to launch, gets it's PID and then waits for it to end before launching whatever emulator/port is being launched (advmame in this example). So, in effect, you can now launch a game, use the Runcommand window as intended if needed and xboxdrv will launch afterwards.I've talked with so many people about xboxdrv on here that, unfortunately, a lot of it runs together. However, I do remember a few interested parties looking for a way to accomplish this, so I hope it helps. Granted there might be an easier, more effective way, so if anything comes to mind, please feel free to share.
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.