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.4k 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 @spud11
      last edited by mediamogul

      @spud11

      The only thing I'm unsure of is whether the --four-way-restrictor configuration actually works when the joystick is mapped to the keyboard... from the manual, it looks as though it only applies to analog configurations

      I've tested it with keyboard, mouse, as well as normal controller input and the four-way restrictor has always worked for me. If the map is active and the restrictor is set, chances are that everything is performing as it should. The feel of some games are just more obvious than others. Try a game of 'Ms Pac-Man' with and without the restrictor and see if you get hung up on the corners without. If there is a problem, I'd guess it has to do with setting the controls in the TAB menu, as that shouldn't be necessary.

      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 Hi. Thanks for that. I'll give Ms Pacman a go after work and see how that goes and let you know.

        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

          I'll give Ms Pacman a go after work

          Just remember that eating ghosts in a video game can be fun, but in real life it's disrespectful.

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

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

            @mediamogul Hi. Thanks so much for helping me - I've eaten some ghosts! Four way restrictor mode definitely appears to work!

            I looked at the code again and realised I was probably making a meal of things (pun definitely intended). I went into TAB in game, and into the Input (general) sub-menu, wrote down all of the keys and then just mapped those keys directly to the joystick buttons in xboxdrv. The code now looks like this:

            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
            --silent \
            --detach-kernel-driver \
            --deadzone=4000 \
            --deadzone-trigger 15% \
            --force-feedback \
            --mimic-xpad \
            --trigger-as-button \
            --ui-buttonmap 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.2:1.0-event-joystick \
            --device-name "Player_3_-_4-Way_Joystick_xboxdrv" \
            --evdev-absmap ABS_X=x1,ABS_Y=y1 \
            --four-way-restrictor \
            --evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start \
            --ui-axismap X1=KEY_DOWN:KEY_UP,Y1=KEY_RIGHT:KEY_LEFT \
            --ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,back=KEY_5,start=KEY_1 \
            &
            

            The joystick buttons now correspond to Player 1's default keys in TAB. The ui-axismap settings reflect the fact that joystick 3 is on the side of the arcade table (ie in portrait mode, rather than landscape), so I needed to change the axes around after some trial and error.

            My /etc/udev/rules.d/990xboxdrv file looks like this:

            SUBSYSTEM=="input", ATTRS{name}=="Player_3_-_4-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
            

            Now there are only 2 other things I need to do and that is to get Player 2 up and running properly and then to transcribe the new code into runcommand-onstart.sh and list all of the relevant 4-way joystick games.

            With the first thing, I've tried to change the 99-xboxdrv.rules file so that it also gives me Player 2 but the second part of the code below does not work:

            SUBSYSTEM=="input", ATTRS{name}=="Player_3_-_4-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
            SUBSYSTEM=="input", ATTRS{name}=="Player_4_-_4-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="2"
            

            Could you please assist me with this? Should there be an entirely different file for the second keyboard? I just guessed the "2" at the end. Or is it as simple as adding an "&" at the end of the line or something similar?

            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

              I believe keeping it as "1" should still work. If that doesn't work, try creating a second file.

              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. That definitely worked, and I've added a couple more lines to it:

                SUBSYSTEM=="input", ATTRS{name}=="Player_3_-_4-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                SUBSYSTEM=="input", ATTRS{name}=="Player_4_-_4-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                SUBSYSTEM=="input", ATTRS{name}=="Player_3_-_8-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                SUBSYSTEM=="input", ATTRS{name}=="Player_4_-_8-Way_Joystick_xboxdrv", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                

                My runcommand.onstart.sh now looks like this:

                #!/bin/sh
                ## Uncomment one or all of the following if you need to find some information about the emulator or roms
                ## Name of the emulator
                #echo $1 >> /dev/shm/runcommand.log
                
                ## Name of the software used for running the emulation
                #echo $2 >> /dev/shm/runcommand.log
                
                ## Name of the rom
                #echo $3 >> /dev/shm/runcommand.log
                
                ##Executed command line
                #echo $4 >> /dev/shm/runcommand.log
                
                
                ### The FUN begins
                #Get ROM name striping full path
                rom="${3##*/}"
                
                ### Set variables for your joypad and emulator
                ### Basic Configurations - Standard controller mappings 
                
                basic="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                --silent \
                --detach-kernel-driver \
                --deadzone=4000 \
                --deadzone-trigger 15% \
                --force-feedback \
                --mimic-xpad \
                --trigger-as-button \
                --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void"
                
                ### Extended Configurations
                ### Specific emulator configurations or any other parameters you will need only for some emulators
                
                ### Joystick settings for Amiga games
                amiga1="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \
                	--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"
                
                amiga2="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \
                	--device-name "Amiga_Joystick_Player_2_xboxdrv" \
                	--evdev-absmap ABS_X=y1,ABS_Y=x1 \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                ### Settings for Arcade games that require 4-Way Restricted Joysticks
                joy1restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \
                	--device-name "Player_1_-_4-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--four-way-restrictor \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                joy2restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \
                	--device-name "Player_2_-_4-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--four-way-restrictor \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                joy3restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \
                	--device-name "Player_3_-_4-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--four-way-restrictor \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                joy4restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \
                	--device-name "Player_4_-_4-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--four-way-restrictor \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                ### Settings for Arcade games that use 8-Way Unrestricted Joysticks
                	joy1unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \
                	--device-name "Player_1_-_8-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                joy2unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \
                	--device-name "Player_2_-_8-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                joy3unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \
                	--device-name "Player_3_-_8-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                joy4unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \
                	--device-name "Player_4_-_8-Way_Joystick_xboxdrv" \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                
                ### Settings for mame-libretro Arcade games in landscape mode - joysticks emulating virtual keyboards
                joy1="--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \
                	--ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,back=KEY_5,start=KEY_1"
                
                joy2="--ui-axismap X1=KEY_D:KEY_G,Y1=KEY_R:KEY_F \
                	--ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6,start=KEY_2"
                
                ### Settings for mame-libretro Arcade games in folder 'Arcade-Vertical' in portrait/cocktail mode - joysticks emulating virtual keyboards
                joy3="--ui-axismap X1=KEY_DOWN:KEY_UP,Y1=KEY_RIGHT:KEY_LEFT \
                	--ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,back=KEY_5,start=KEY_1"
                
                joy4="--ui-axismap X1=KEY_F:KEY_R,Y1=KEY_G:KEY_D \
                	--ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6,start=KEY_2"
                
                ### Kill Command
                xboxkill="sudo killall xboxdrv"
                
                ### Execute the driver with the configuration you need
                # $1 is the name of the emulation, not the name of the software used
                # it is intellivision not jzintv
                case $1 in
                
                	mame-libretro)
                	case $rom in
                "amidar.zip"|"atetris.zip"|"anteater.zip"|"armorcar.zip"|"astrob.zip"|"astrof.zip"|"bagman.zip"|"ballbomb.zip"|"barrier.zip"|"blkhole.zip"|"btime.zip"|"carjmbre.zip"|"carnival.zip"|"cavelon.zip"|"checkman.zip"|"chinhero.zip"|"circusc.zip"|"ckong.zip"|"commando.zip"|"congo.zip"|"crush.zip"|"dazzler.zip"|"devilfsh.zip"|"digdug.zip"|"digdug2.zip"|"digger.zip"|"disco.zip"|"dkong.zip"|"dkong3.zip"|"dkongjr.zip"|"dommy.zip"|"dorodon.zip"|"mrdo.zip"|"puckman.zip"|"mspacman.zip")# Configuration used only for these ROMs
                				$xboxkill
                				joycommand="$basic $joy3restricted $joy3 & $basic $joy4restricted $joy4 &"
                				eval $joycommand
                			;;
                			*) # Configuration for every other ROM in respect of this emulator
                				$xboxkill
                				joycommand="$basic $joy3unrestricted $joy3 & $basic $joy4unrestricted $joy4 &"
                				eval $joycommand
                			;;
                		esac
                	;;
                
                	amiga)
                		$xboxkill
                		joycommand="$basic $amiga1 & $basic $amiga2 &"
                		eval $joycommand
                	;;
                
                esac
                

                The only thing I can't get to work is the code for the remaining joystick unrestricted games under the command *). When starting Mustache Boy (for example), the runcommand.log says that xboxdrv did not start for some reason. (I was generally hoping just to use the normal xpad driver for these games and so I initially just had sudo killall xboxdrv as the code, but that did not work, so I have set up xboxdrv 8 way joystick configurations instead which don't work either):

                xboxdrv: no process found
                Parameters: 
                Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so --config /opt/retropie/configs/mame-libretro/retroarch.cfg "/home/pi/RetroPie/roms/arcade-vertical/mustache.zip" --appendconfig /dev/shm/retroarch.cfg'|'"/home/pi/RetroPie/roms/arcade-vertical/mustache.zip.cfg"
                

                Have you encountered this problem? Thank you.

                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 mediamogul

                  @spud11

                  the runcommand.log says that xboxdrv did not start for some reason.

                  That output should point to the problem. Can you post the error 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 Hi mediamogul. Could I ask where the output would have been saved please? The usual statements came up on screen briefly for both joysticks (ie the js/event number etc). Or would you prefer I just enter the code into the commandline? Thanks.

                    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

                      I would first look at /dev/shm/runcommand.log, but if there's nothing there, entering it into the command line should indeed show the error.

                      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 Hi. I've now tested both with the script and the commandline. I think I removed a space before one of the # and that caused the problem. Everything seems to be working now (touch wood). I found the best way to test was to test both the restricted code and the unrestricted code in a shoot 'em up. It's clear as daylight that the code is working when you can't do diagonals in a shoot 'em up. Thanks for your advice on this.

                        Lr-mame2003 doesn't seem to have a "native" key for exiting the emulator. It relies on Retroarch. In Retroarch, I've got the "exit from emulator" set up to operate when I hold down the space key and press escape on the keyboard. As I've only got 6 buttons on Joystick 3 and, so far, I've mapped buttons 5 and 6 to "coin" (key 5) and "start" (key 1), respectively, I was wondering if it were possible to map button 5 to both keys 5 and 1 and then map button 6 to space and escape, so I can exit without the keyboard. From reading through most of the thread again, I can't see anything that really resembles what I want to do.

                        I've looked at your examples where you've mapped 2 buttons on the joystick (basically a modifier) to a key on the keyboard. But I want to do the opposite - press one button and it presses 2 keys.

                        Looking at the manual for xboxdrv, there seems to be "cycle" and "sequence" commands. The sequence one looks most likely, but I'm not sure it can be used to press a key while holding down another key.

                        Worst case, I suppose I could just remap the emulator keys via TAB so that if I press the 1 key it both gives me a coin and starts the game and then just map xboxdrv accordingly. I have done that before, but I don't think that's going to resolve the "exit from emulator" issue with lr-mame2003, and so I was hoping for a more elegant xboxdrv solution if there is one please.

                        Or perhaps I'm missing something obvious. It is getting quite late here.... Thanks.

                        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 mediamogul

                          @spud11

                          I want to do the opposite - press one button and it presses 2 keys.

                          Using the 'A' button as an example, you would map keys 1 and 5 to it with:

                          --ui-buttonmap a=KEY_1+KEY_5
                          

                          I'm glad to see all this is starting to turn your way. With all your controls coexisting in various ways, your setup has been uniquely complicated.

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

                          S 1 Reply Last reply Reply Quote 1
                          • H
                            Hubz
                            last edited by

                            Hey finished my Atari ST Mapping and it works pretty good if someone else would like to try it.

                            atarist="--axismap -Y1=Y1,-Y2=Y2
                            --ui-axismap x2=REL_X:10,y2=REL_Y:10
                            --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP
                            --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT,back+start=KEY_RIGHTALT+KEY_Q
                            --ui-buttonmap lt=BTN_LEFT,rt=BTN_RIGHT,back=KEY_F12,start=KEY_1,y=KEY_RIGHTCTRL,a=KEY_SPACE,b=KEY_ENTER,x=KEY_ESC,lb=KEY_Y,rb=KEY_N
                            --ui-buttonmap guide=void,tl=void,tr=void
                            --ui-axismap x2=void"

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

                              @Hubz

                              You've got some nice touches in there. One of my favorite options for using an external mapper like this is the ability to map 'start+select' to exit everything. The result is an almost perfect unified console feeling that normally can't be had, given the wild west of software options available throughout RetroPie. Nice job!

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

                              1 Reply Last reply Reply Quote 1
                              • H
                                Hubz
                                last edited by

                                Thanks! I came from tinkering for years with Hyperspin and Launchbox, and while Launchbox has a few features I miss, it's hard to beat the customization you can do with Retropie as well as the stability of the Linux environment.

                                1 Reply Last reply Reply Quote 1
                                • D
                                  dunnieboy
                                  last edited by dunnieboy

                                  @mediamogul

                                  Ok .. so i have everything working. I have a question regarding the evdev line.

                                  I add and subtract keyboards and controllers all the time.

                                  Using something like --evdev /dev/input/event2 does not always work because depending on the connection order the event number can change.

                                  Is there a way to ensure the identity of a device somehow ? I have had to change my scripts to correspond with my event number manually within my scripts and would love to not have to worry about that.

                                  Thanks

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

                                    @dunnieboy

                                    If a controller doesn't have a unique event name (obtained in the first section of the guide), then you should be able to specify it's path found at /dev/input/by-path/. As long as the controller is plugged into that same USB port every time, the event path should be accessible. For example, when my Logitech RumblePad is connected to the upper left USB port, it's event can always be accessed at /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick.

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

                                    D 1 Reply Last reply Reply Quote 0
                                    • D
                                      dunnieboy @mediamogul
                                      last edited by

                                      @mediamogul right .. but as I am using wireless controllers ... by_path wont work right ?

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

                                        @dunnieboy

                                        It might still create a unique event path of it's own. I've never tested it with a Bluetooth controller. If the event name and path are not an option, I'm afraid event numbers are the only other recourse.

                                        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 @mediamogul
                                          last edited by

                                          @mediamogul Thanks for this. I've adapted that and all seems to work as intended. Just now a matter of adding all 208 games that are 4 way restricted. Then I'll turn to some of the other emulators like Daphne, I think.

                                          It most definitely is a complicated setup I've got. I really appreciate your help and patience. What a great community the Retropie community is.

                                          #!/bin/sh
                                          ## Uncomment one or all of the following if you need to find some information about the emulator or roms
                                          ## Name of the emulator
                                          #echo $1 >> /dev/shm/runcommand.log
                                          
                                          ## Name of the software used for running the emulation
                                          #echo $2 >> /dev/shm/runcommand.log
                                          
                                          ## Name of the rom
                                          #echo $3 >> /dev/shm/runcommand.log
                                          
                                          ##Executed command line
                                          #echo $4 >> /dev/shm/runcommand.log
                                          
                                          
                                          ### Code begins
                                          ### Get ROM full path
                                          rom="${3##*/}"
                                          
                                          ### Set variables for joysticks and emulators
                                          ### Basic Configurations - Standard controller mappings
                                          
                                          basic="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                          --silent \
                                          --detach-kernel-driver \
                                          --deadzone=4000 \
                                          --deadzone-trigger 15% \
                                          --force-feedback \
                                          --mimic-xpad \
                                          --trigger-as-button \
                                          --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void"
                                          
                                          ### Extended Configurations
                                          ### Specific emulator configurations or any other parameters you will need only for some emulators
                                          
                                          ### Player 1 and 2 joystick settings for Amiga games - only change is to the axes which have been swapped; not mapped to UAE4ARM's default keyboard settings
                                          amiga1="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \
                                          	--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"
                                          
                                          amiga2="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \
                                          	--device-name "Amiga_Joystick_Player_2_xboxdrv" \
                                          	--evdev-absmap ABS_X=y1,ABS_Y=x1 \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          ### Settings for Arcade games that require 4-Way Restricted Joysticks
                                          joy1restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \
                                          	--device-name "Player_1_-_4-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--four-way-restrictor \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          joy2restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \
                                          	--device-name "Player_2_-_4-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--four-way-restrictor \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          joy3restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \
                                          	--device-name "Player_3_-_4-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--four-way-restrictor \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          joy4restricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \
                                          	--device-name "Player_4_-_4-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--four-way-restrictor \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          ### Settings for Arcade games that use 8-Way Unrestricted Joysticks
                                          joy1unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.3:1.0-event-joystick \
                                          	--device-name "Player_1_-_8-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          joy2unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.1:1.0-event-joystick \
                                          	--device-name "Player_2_-_8-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          joy3unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \
                                          	--device-name "Player_3_-_8-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          joy4unrestricted="--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \
                                          	--device-name "Player_4_-_8-Way_Joystick_xboxdrv" \
                                          	--evdev-absmap ABS_X=x1,ABS_Y=y1 \
                                          	--evdev-keymap BTN_TRIGGER=y,BTN_THUMB=a,BTN_THUMB2=back,BTN_PINKIE=x,BTN_TOP=b,BTN_TOP2=start"
                                          
                                          ### Settings for mame-libretro Arcade games in landscape mode - joysticks emulating virtual keyboards
                                          ### The joystick buttons have been mapped to the emulator's default keys. In lr-mame 2003 in game, press TAB to determine default keys.
                                          ### Player 1's default keys are: Buttons 1-4 (LCTRL, LALT, SPACE, LSHIFT), Start (1), Coin (5), Movement (Arrow keys)
                                          ### Player 2's default keys are: Buttons 1-4 (a, s, q, w), Start (2), Coin (6), Movement (g, d, r, f)
                                          ### For Joystick 1 (Player 1), Buttons 1 to 4 are for fire and jump and so on.  Button 5 will start Player 1; Button 6 will start Player 2; Holding Button 5 and pressing Button 6 together will exit emulator in line with Retroarch hotkey
                                          ### For Joystick 2 (Player 2), Buttons 1 to 4 are for fire and jump and so on.  Button 5 will start Player 2; Button 6 does nothing; Holding Button 5 and pressing Button 6 together will exit emulator in line with Retroarch hotkey
                                          joy1="--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \
                                          	--ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,back=KEY_5+KEY_1,start=KEY_6+KEY_2,back+start=KEY_SPACE+KEY_ESC"
                                          
                                          joy2="--ui-axismap X1=KEY_D:KEY_G,Y1=KEY_R:KEY_F \
                                          	--ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6+KEY_2,start=KEY_UNKNOWN,back+start=KEY_SPACE+KEY_ESC"
                                          
                                          ### Settings for mame-libretro Arcade games in folder 'Arcade-Vertical' in portrait/cocktail mode - joysticks emulating virtual keyboards
                                          ### The joystick buttons have been mapped to the emulator's default keys. In lr-mame 2003 in game, press TAB to determine default keys.
                                          ### Player 1's default keys are: Buttons 1-4 (LCTRL, LALT, SPACE, LSHIFT), Start (1), Coin (5), Movement (Arrow keys)
                                          ### Player 2's default keys are: Buttons 1-4 (a, s, q, w), Start (2), Coin (6), Movement (g, d, r, f)
                                          ### Because Joysticks 3 and 4 are in portrait (not landscape) mode, the axes needed to be mapped differently (eg for Joystick 3, left and right became down and up).
                                          ### For Joystick 3 (Player 1), Buttons 1 to 4 are for fire and jump and so on.  Button 5 will start Player 1; Button 6 will start Player 2; Holding Button 5 and pressing Button 6 together will exit emulator in line with Retroarch hotkey
                                          ### For Joystick 4 (Player 2), Buttons 1 to 4 are for fire and jump and so on.  Button 5 will start Player 2; Button 6 does nothing; Holding Button 5 and pressing Button 6 together will exit emulator in line with Retroarch hotkey
                                          joy3="--ui-axismap X1=KEY_DOWN:KEY_UP,Y1=KEY_RIGHT:KEY_LEFT \
                                          	--ui-buttonmap a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_SPACE,y=KEY_LEFTSHIFT,back=KEY_5+KEY_1,start=KEY_6+KEY_2,back+start=KEY_SPACE+KEY_ESC"
                                          
                                          joy4="--ui-axismap X1=KEY_F:KEY_R,Y1=KEY_G:KEY_D \
                                          	--ui-buttonmap a=KEY_A,b=KEY_S,x=KEY_Q,y=KEY_W,back=KEY_6+KEY_2,start=KEY_UNKNOWN,back+start=KEY_SPACE+KEY_ESC"
                                          
                                          ### Kill xboxdrv command
                                          xboxkill="sudo killall xboxdrv"
                                          
                                          ### Execute the driver with the configuration you need
                                          ### $1 is the name of the system emulation (eg mame-libretro), not the name of the emulator (eg not lr-mame2003), nor the name of the folder (eg not "arcade", not "mame-libretro", not "arcade-vertical"
                                          ### $1 - The system (eg: atari2600, nes, snes, megadrive, fba, etc).
                                          ### $2 - The emulator (eg: lr-stella, lr-fceumm, lr-picodrive, pifba, etc).
                                          ### $3 - The full path to the rom file.
                                          ### $4 - The full command line used to launch the emulator.
                                          ### This information can be obtained from /dev/shm/runcommand.info
                                          case $1 in
                                          
                                          	mame-libretro)
                                          	case $rom in
                                          			"afighter.zip"|"alibaba.zip"|"amidar.zip"|"armwrest.zip"|"astinvad.zip"|"atetris.zip"|"anteater.zip"|"armorcar.zip"|"astrob.zip"|"astrof.zip"|"bagman.zip"|"ballbomb.zip"|"barrier.zip"|"blkhole.zip"|"blasto.zip"|"blockade.zip"|"btime.zip"|"carjmbre.zip"|"carnival.zip"|"cavelon.zip"|"chameleo.zip"|"checkman.zip"|"chinhero.zip"|"circusc.zip"|"ckong.zip"|"commando.zip"|"congo.zip"|"crush.zip"|"dazzler.zip"|"devilfsh.zip"|"digdug.zip"|"digdug2.zip"|"digger.zip"|"disco.zip"|"dkong.zip"|"dkong3.zip"|"dkongjr.zip"|"dommy.zip"|"dorodon.zip"|"mrdo.zip"|"puckman.zip"|"mspacman.zip") # Configuration used only for these ROMs
                                          				$xboxkill
                                          				joycommand="$basic $joy3restricted $joy3 & $basic $joy4restricted $joy4 &"
                                          				eval $joycommand
                                          			;;
                                          			*) # Configuration for every other ROM in respect of this emulator
                                          				$xboxkill
                                          				joycommand="$basic $joy3unrestricted $joy3 & $basic $joy4unrestricted $joy4 &"
                                          				eval $joycommand
                                          			;;
                                          		esac
                                          	;;
                                          
                                          	amiga)
                                          		$xboxkill
                                          		joycommand="$basic $amiga1 & $basic $amiga2 &"
                                          		eval $joycommand
                                          	;;
                                          
                                          esac
                                          

                                          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 @Hubz
                                            last edited by

                                            @Hubz Hi. I've added about 30 or so of the Arcade games that use 4 way restricted joysticks. Probably sometime during the next week I'll get to the remaining ones and will post them all. You'll see in my most recent message to mediamogul where I include the block of code, how far I've got.

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