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 465.5k 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.
    • pjftP
      pjft
      last edited by

      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!

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

        @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
        

        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
        • mediamogulM
          mediamogul Global Moderator @pjft
          last edited by mediamogul

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

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

          pjftP 1 Reply Last reply Reply Quote 1
          • pjftP
            pjft @mediamogul
            last edited by

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

            D 1 Reply Last reply Reply Quote 0
            • D
              dudleydes @pjft
              last edited by

              @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 to KEY_#704 whereas in the xboxdrv example, it's mapped to KEY_#720. My controller is model number CECHZC1E, one of the original SIXAXIS controllers. If you have a newer model, then KEY_#720 may be the correct mapping.

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

                @mediamogul Thanks. I've added the code to the runcommand-onstart.sh but it had no effect. A copy of the runcommand.log appears below:

                /opt/retropie/configs/all/runcommand-onstart.sh: line 2: $'\r': command not found
                /opt/retropie/configs/all/runcommand-onstart.sh: line 18: syntax error near unexpected token `&'
                /opt/retropie/configs/all/runcommand-onstart.sh: line 18: `&
                '
                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
                

                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

                  Line 2 & 18 seem to be the problem. Making sure that runcommand-onstart.shis still identical to that last time you launched it, post it's contents and let's have a look.

                  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 reply. Here it is:

                    #!/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
                    

                    Line 2 is the blank line and line 18 is the &. I'm using Notepad ++ which gives line numbers so it is clear.

                    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

                      Line 2 is the blank

                      In a shell script, the first line is reserved for #!/bin/sh, making the second line count as the first and so on. That said, the errors you're getting still aren't jibing with the command given. The only thing I can think of is that Notepad++ may be formatting things unexpectedly. In the command line try:

                      nano /opt/retropie/configs/all/runcommand-onstart.sh
                      

                      From there, look to see if anything is out of place in line 2 & 18 by comparison. If it is, you'll either want to use another text editing program or see if notepad++ can support 'UNICODE UTF-8' through a setting.

                      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
                      • C
                        Chillimonster @spud11
                        last edited by

                        @spud11

                        Thanks for checking, i really appreciate it.

                        I need to dedicate some time to looking at emulating keyboard input for daphne, as i think that is going to be the answer.

                        Chris

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

                          @Chillimonster That's no problem at all. I think you're right - it's likely to be the keys that wind up making the difference. I reckon it'll be more than a week before I start testing Daphne (you've sparked my interest again in getting it working), so if you do get it working, could you please post your config here?

                          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

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

                            @mediamogul said in Guide: Advanced Controller Mappings:

                            nano /opt/retropie/configs/all/runcommand-onstart.sh

                            Hi mediamogul.

                            I've now checked Notepad++ and it is using Unicode UTF-8. I've looked at the code using nano too and removed line 27 which was blank. There doesn't appear to be anything else that stands out. The code appears to be correct and I've tested again and it doesn't work.

                            Given that line 2 is actually line 1, the error $'\r' looks like it relates to "$1" - that is, it can't find or identify the "amiga" system for whatever reason.

                            I can't help but feel it's got something to do with my amiga setup which has individual .uae configs for each game (as per the Amiga wiki but using hard drives for each game, not floppy disks), but could be wrong.

                            I've previously tried some of the other $ commands. Maybe that is the way to go?

                            Or I wonder if there might be some other file that I've changed that is affecting things. I recall somewhere reading that there was another file that might require changing and I made that change. Can't find what it was now.

                            Or maybe one way to test things is just to replace "amiga" with another random system and see if it works for other systems. That would at least rule out that there is an inherent problem with the code.

                            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 can't help but feel it's got something to do with my amiga setup which has individual .uae configs for each game

                              That very well could be. Launch another game the way you have been, then post the contents of /dev/shmruncommand.info.

                              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

                                Okay, thanks. I tried another Amiga game with the same outcome, and once again it doesn't like the& (or & and fi) at the end:

                                /opt/retropie/configs/all/runcommand-onstart.sh: line 2: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 18: syntax error near unexpected token `&'
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 18: `&
                                '
                                Parameters: 
                                Executing: pushd /opt/retropie/emulators/uae4arm/; ./uae4arm -config="/home/pi/RetroPie/roms/amiga/Alien Drug Lords.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
                                

                                Also, I found the other change to which I have referred in my previous comment which I made after following the guide:

                                sudo nano /etc/udev/rules.d/99-xboxdrv.rules
                                
                                SUBSYSTEM=="input", ATTRS{name}=="Microsoft X-Box 360 pad - Keyboard Emulation", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                                

                                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 actually need to see the contents of /dev/shm/runcommand.info. Make sure of course that you have just previously launched a game.

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

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

                                    @mediamogul Oh, sorry. I missed that it was the info file, not the log file, you wanted to see. Will send after I get home from work. 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

                                      Not a problem.

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

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

                                        @spud11

                                        Of course i will.

                                        I'll try and get some time on it over weekend and update the thread accordingly

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

                                          @mediamogul Sorry about the delay. Wound up not getting home to very late. Here is the runcommand.info file:

                                          amiga
                                          uae4arm
                                          /home/pi/RetroPie/roms/amiga/Alien Breed Special Edition '92.uae
                                          pushd /opt/retropie/emulators/uae4arm/; ./uae4arm -config="/home/pi/RetroPie/roms/amiga/Alien Breed Special Edition '92.uae"
                                          

                                          Does this correspond to the "$" inputs 1, 2, 3, 4?

                                          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
                                          • S
                                            spud11 @Chillimonster
                                            last edited by

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

                                            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.