RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Guide: Advanced Controller Mappings

    Scheduled Pinned Locked Moved Help and Support
    joystickcontrollermappingxboxdrvscummvm
    626 Posts 35 Posters 460.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mediamogulM
      mediamogul Global Moderator @Chillimonster
      last edited by mediamogul

      @Chillimonster

      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?

      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

      C 1 Reply Last reply Reply Quote 0
      • E
        EVEGames @mediamogul
        last edited by EVEGames

        @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.

        mediamogulM 1 Reply Last reply Reply Quote 0
        • C
          Chillimonster @mediamogul
          last edited by

          @mediamogul

          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?

          mediamogulM 1 Reply Last reply Reply Quote 0
          • mediamogulM
            mediamogul Global Moderator @EVEGames
            last edited by mediamogul

            @EVEGames

            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.

            RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

            E 1 Reply Last reply Reply Quote 0
            • mediamogulM
              mediamogul Global Moderator @Chillimonster
              last edited by mediamogul

              @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.

              RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

              C 2 Replies Last reply Reply Quote 0
              • C
                Chillimonster @mediamogul
                last edited by

                @mediamogul

                I'll have a look at mapping the standard keyboard keys to the xboxdrv

                ExarKunIvE 1 Reply Last reply Reply Quote 0
                • ExarKunIvE
                  ExarKunIv @Chillimonster
                  last edited by

                  @Chillimonster

                  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

                  RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
                  RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
                  Maintainer of RetroPie-Extra .

                  mediamogulM 1 Reply Last reply Reply Quote 0
                  • mediamogulM
                    mediamogul Global Moderator @ExarKunIv
                    last edited by mediamogul

                    @ExarKunIv

                    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'.

                    RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                    B 1 Reply Last reply Reply Quote 2
                    • B
                      backstander @mediamogul
                      last edited by

                      Image

                      1 Reply Last reply Reply Quote 2
                      • E
                        EVEGames @mediamogul
                        last edited by

                        @mediamogul Good stuff sir. I'm off to give this a shot. Thank you!!

                        1 Reply Last reply Reply Quote 1
                        • C
                          Chillimonster @mediamogul
                          last edited by

                          @mediamogul

                          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

                          mediamogulM 1 Reply Last reply Reply Quote 0
                          • mediamogulM
                            mediamogul Global Moderator @Chillimonster
                            last edited by mediamogul

                            @Chillimonster

                            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.

                            RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                            1 Reply Last reply Reply Quote 0
                            • S
                              spud11
                              last edited by spud11

                              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:

                              1. 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.)

                              1. 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.

                              1. 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.

                              RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                              mediamogulM C 2 Replies Last reply Reply Quote 0
                              • mediamogulM
                                mediamogul Global Moderator @spud11
                                last edited by

                                @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 in rc.local, but it seems like I remember someone telling me that it wasn't necessary here.

                                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                S 1 Reply Last reply Reply Quote 0
                                • S
                                  spud11 @mediamogul
                                  last edited by

                                  @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.

                                  RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                  mediamogulM 1 Reply Last reply Reply Quote 0
                                  • mediamogulM
                                    mediamogul Global Moderator @spud11
                                    last edited by

                                    @spud11

                                    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.

                                    RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                    S 2 Replies Last reply Reply Quote 1
                                    • S
                                      spud11 @mediamogul
                                      last edited by

                                      @mediamogul Thanks. Once I get home from work in a few hours, I'll do the commandline thing and let you know. Thanks, again.

                                      RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                      1 Reply Last reply Reply Quote 0
                                      • C
                                        Chillimonster @spud11
                                        last edited by

                                        @spud11

                                        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)?

                                        S 2 Replies Last reply Reply Quote 0
                                        • S
                                          spud11 @Chillimonster
                                          last edited by

                                          @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).

                                          RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                          1 Reply Last reply Reply Quote 2
                                          • S
                                            spud11 @mediamogul
                                            last edited by

                                            @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
                                            

                                            RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                            mediamogulM 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.