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

                              @spud11 said in Guide: Advanced Controller Mappings:

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

                              It does and I was hoping to see something wrong here that would explain your issues, but everything seems to be in order. I won't lie, I'm starting to run out of ideas here myself. One thing you can try is to add:

                              #!/bin/bash
                              
                              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 \
                              &
                              

                              to it's own separate script and in turn launch it from runcommand-onstart.sh with:

                              if [ "$1" = "amiga" ]
                              then
                              sh /path/to/new/script.sh
                              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
                              • E
                                EctoOne
                                last edited by

                                Sorry to interrupt, I didn't read all of the lasts post. It is about setting up xboxdrv to work with uae4arm and the possibility that launching uae files might cause some trouble right? If so, I have no problems with the same setup. Although I replaced uae4arm with amiberry. So if needed I could copy the controller setup part from the guide I used.

                                The only thing that I can't figure out, is how to get custom controls within uae4arm/amiberry to work. Which would be great if I could map the X, Y Buttons to whatever the game needs. But from what I've found that seems to be a bug with amiberry (never tried it with uae4arm), so I have to wait for an update to that.

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

                                  @EctoOne said in Guide: Advanced Controller Mappings:

                                  If so, I have no problems with the same setup.

                                  On paper, there should be nothing preventing this from working on any setup. There has to be some other factor at play that is not being accounted for, but I'll be hornschwaggled if I can see it.

                                  Which would be great if I could map the X, Y Buttons to whatever the game needs.

                                  Almost any computer game responds to keyboard input. You could always map the keys to the controller.

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

                                    @mediamogul said in Guide: Advanced Controller Mappings:

                                    Almost any computer game responds to keyboard input. You could always map the keys to the controller.

                                    Yes I know that. It works for something like ScummVM where you can map the start button to F5. Because that's the key most ScummVM games use to access the menu. But for Amiga games it's more different what keys are needed. Example I want to use X as Spacebar for Turrican but on The Clue! I want X to be F1 to be able to open the menu.
                                    Uae4arm has a menu to map buttons on its own but I can't get it to work. And I don't know if that's an uae4arm/amiberry problem or if there is a conflict with my setup.

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

                                      @EctoOne

                                      Ah, I gotchya. I have a similar need for some individual system games. If you use if [ "$3" = "/path/to/rom" ] in your if/else statement, you can launch your mappings based on individual ROMs rather than have them applied to whole systems.

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

                                        @mediamogul I've now given that one a go too:

                                        #!/bin/sh
                                        
                                        if [ "$1" = "amiga" ]
                                        then
                                        sh /opt/retropie/configs/amiga/joystick.sh
                                        fi
                                        

                                        joystick.sh is:

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

                                        Unfortunately, there is no output .log file .info file.

                                        It seems that the runcommand-onstart.sh will work, but only if there is no if/then statement.

                                        I'll have a quick go at replacing "amiga" with another system and see what eventuates.

                                        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

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

                                          @spud11 Tried with "c64" instead of "amiga" and same results as for amiga - separate script no output in dev/shm and a similar output if the sudo statement appears directly in the runcommand statement.

                                          Perhaps I could somehow include reference to the script in the .uae files instead? I don't 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

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

                                            @EctoOne You seem to have a similar problem to me. I'm using amiberry too. Although the author thought he had got custom controls to work from the f12 menu, I haven't been able to get that working either. Apparently, he is thinking of "going" libretro, but it hasn't happened yet.

                                            What I do know is that if I use runcommand-onstart.sh to install xboxdrv (but without the if/then statement), my "amiga joystick" does appear in the uae4arm menu (ie press f12) and I can select that joystick and all works well in game after "resuming" the game.

                                            Also, it is possible to manually bulk change all the individual game .uae scripts to default to the "amiga joystick" for player 1. I use a Windows program called "Find and Replace " to achieve that: http://findandreplace.sourceforge.net

                                            That will work, but obviously because there is no if/then statement in runcommand-onstart.sh, my controls are all screwed up for every other emulator/core which is self-defeating.

                                            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.