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

                @mediamogul said in Guide: Advanced Controller Mappings:

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

                Oh really, that sounds like a solution but it also sounds like a lot more work. If the custom controls within uae4arm where working, i could map the buttons on the fly and to see what's best and then simply save the config file. But thanks for the hint, i might give it a shot.

                @spud11
                This is a copy of the guide i used (Can't provide a link, because it also contains games)

                And this is my runcommand-onstart.sh (scummvm settings removed to avoid confusion):

                #!/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 Configuraions - Standard controller mappings 
                LogiF710="/opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null \
                	--evdev /dev/input/event3 \
                	--silent \
                	--detach-kernel-driver \
                	--deadzone=4000 \
                	--deadzone-trigger 15% \
                	--force-feedback \
                	--mimic-xpad \
                	--trigger-as-button \
                	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                	--evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_TL2=lt,BTN_TR2=rt,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_SELECT=back,BTN_START=start,BTN_MODE=guide \
                	--calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767"
                
                
                ### Extended Configurations
                ### Specific emulator configuration or any other parameters you will need only for some emulators
                amiga="--axismap -Y1=Y1,-Y2=Y2 \
                	--buttonmap tl^toggle=tl \	
                        --buttonmap rt^toggle=rt \
                	--ui-axismap tl+x1=REL_X:5,tl+y1=REL_Y:5 \
                	--ui-buttonmap tl+a=BTN_LEFT,tl+b=BTN_RIGHT \
                	--ui-buttonmap start=KEY_P,back=void \
                	--ui-buttonmap rt+a=KEY_ENTER,rt+b=KEY_ESC,rt+x=KEY_SPACE,rt+y=KEY_F1,rt+du=KEY_UP,rt+dd=KEY_DOWN,rt+dl=KEY_LEFT,rt+dr=KEY_RIGHT \
                	--ui-buttonmap guide=KEY_F12,guide+start=KEY_Q \
                	--ui-axismap x2=void"
                
                fourway="--four-way-restrictor"
                
                invert="--ui-buttonmap du=KEY_DOWN,dd=KEY_UP"
                
                ### Kill Command
                xboxkill="sudo killall >/dev/null 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
                
                    amiga)
                        $xboxkill
                        joycommand="$LogiF710 $amiga &"
                        eval $joycommand
                    ;;
                esac
                
                

                Beware that i'm using a Logitech F710 controller, so you can't probably just copy paste that. This mapping toggles mouse/joystick function when pressing the left analog stick and also toggles cursor keys on the digipad when pressing RT/R2 (instead of holding RT/R2)

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

                  @spud11

                  I'm curious as to whether or not any if/then statements will run on your setup. Try adding the test below to your runcommand-onstart.sh and then look to see if the two test sentences were written in runcommand.log after running a game.

                  test=yes
                  if [ "$test" = "yes" ]
                  then
                  echo "This is only a test." >> /dev/shm/runcommand.log
                  fi
                  if [ "$1" = "amiga" ]
                  then
                  echo "This is also only a test." >> /dev/shm/runcommand.log
                  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
                  • S
                    spud11 @mediamogul
                    last edited by

                    @mediamogul The runcommand-onstart.sh looks like this:

                    #!/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
                    test=yes
                    if [ "$test" = "yes" ]
                    then
                    echo "This is only a test." >> /dev/shm/runcommand.log
                    fi
                    if [ "$1" = "amiga" ]
                    then
                    echo "This is also only a test." >> /dev/shm/runcommand.log
                    fi
                    

                    And the runcommand.log is this:

                    /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

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

                      @EctoOne Hi EctoOne. I've seen a guide similar to the one you've provided. Thanks for that. I think most of the characteristics in the guide I've got, but will look at more closely.

                      Also, I'm familiar with your runcommand-onstart.sh. I recall the script it's based on had a "per rom" setting (as mediamogul has pointed out) as a possible way of getting xboxdrv working. (It was for mame games, and I think you've got a residual "per rom" setting from the original script in your script - rom="${3##*/}" too).

                      I agree "per rom" would be a lot of work unless it could be automated in some way, but that does assume we're able to get xboxdrv with "if/then" working at all with the amiga. At this stage, it doesn't appear that the if/then statement works at all, for whatever reason, as mine at least "hangs" straight away on the first line being the "if" statement $'\r'.

                      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 E 2 Replies Last reply Reply Quote 0
                      • mediamogulM
                        mediamogul Global Moderator @spud11
                        last edited by

                        @spud11

                        I'm somewhat stumped. I'll continue to give it thought, but I really can't see a reason why this isn't working. The fact that you're getting script errors regarding information that is not even in your script is really odd. You might try looking around for other instances online where similar statements are read incorrectly and what might cause such a thing.

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

                          @spud11
                          I'm not sure what the rom thing is about in my script. I just copied it, entered the F710 buttons and made some changes to the mapping.

                          But I noticed that in my script are no if/fi parts compared to yours. Maybe you should go and try mine.

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

                            @mediamogul Will do. 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

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

                              @spud11 Thanks, EctoOne. I will have a go with your script too and I'll let you know. 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
                              • S
                                spud11 @EctoOne
                                last edited by

                                @EctoOne Hi. I adapted your script as below which I think should work:

                                #!/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 Configuraions - Standard controller mappings 
                                DragonRise="/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 \
                                	--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 configuration or any other parameters you will need only for some emulators
                                amiga="--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 \"
                                
                                fourway="--four-way-restrictor"
                                
                                
                                ### 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
                                
                                    amiga)
                                        $xboxkill
                                        joycommand="$DragonRise $amiga &"
                                        eval $joycommand
                                    ;;
                                esac
                                

                                I ended up with the following output:

                                /opt/retropie/configs/all/runcommand-onstart.sh: line 5: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 8: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 11: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 14: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 15: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 19: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 36: Amiga Joystick Player 1 (xboxdrv): command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 37: --evdev-absmap: command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 38: --evdev-keymap: command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 39: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 41: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 42: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 45: $'\r': command not found
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 49: syntax error near unexpected token `$'in\r''
                                /opt/retropie/configs/all/runcommand-onstart.sh: line 49: `case $1 in
                                '
                                Parameters: 
                                Executing: pushd /opt/retropie/emulators/uae4arm/; ./uae4arm -config="/home/pi/RetroPie/roms/amiga/Alien Breed Tower Assault.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
                                

                                I'll trawl the forums and see if I can find any information about the error $'\r'. Thanks.

                                I'll probably need to think of options other than using runcommand-onstart. Possibly even recompiling the emulator itself.

                                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

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

                                  @spud11
                                  I'm no tech expert but seeing you getting even more errors with my script let's me think that either your xboxdrv version is different or something went wrong during the installation.

                                  Edit: From what I've found is that \r seems to be caused by Windows newline characters. You said that you're using Notepad++ so that would make sense if you copy/pasted my script. So you should try to ssh into your Pi with putty. Use nano to edit the file (mentioned above by @mediamogul), delete everything, and copy it back in using middle mouse button. Or delete the file and make a new one with nano.

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

                                    @EctoOne Thanks for that tip. I'll try that later.

                                    That might explain why earlier on, I was finding that the xboxdrv script was working 100% in rc.local only when the whole script was on one line, but didn't seem to work when I had used \ and enter at the end of each line.

                                    I'll try the copy/paste way with nano first and then, if that doesn't work, I'll manually type it all back in with nano. A bit laborious but best way to ensure the script works.

                                    Just checked the WinSCP documentation too:

                                    "Text/ASCII Transfer Mode
                                    For this reason, file transfer clients and servers support a text/ASCII transfer mode.
                                    When transferring a file in this mode, the file gets (ideally) converted from a format native to a source system, to a format native to a target system.
                                    For example, when uploading a text file using text mode from Windows to Unix system, the file line endings get converted from CR+LF to LF.
                                    Opposite to the text/ASCII transfer mode is a binary transfer mode that transfer the file as is (binary identical).
                                    WinSCP by default uses the binary transfer mode for all regular file transfers. "

                                    I've also at various times copied the runcommand-onstart.sh from Windows to the Pi and made the file executable, so based on the above, the transfer is likely to have been in binary transfer mode by default, meaning that /r new line errors are very possible.

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

                                      You, Sirs, are Gods! Thank you to you both for your patience and help. EctoOne, you were ultimately correct. It had to do with the "newline" issue as between Windows and Unix.

                                      To help anyone else with a similar issue, what I did was, via Putty, I deleted the old runcommand-onstart.sh and created a new one and made it executable. Then I typed:

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

                                      and manually typed in the whole code with the if/then statement:

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

                                      Xboxdrv now works as it should with the uae4arm emulator. I have a runcommand-onend.sh file as well which terminates xboxdrv automatically.

                                      I have now altered the default settings in WinSCP from "binary" to "text", but decided that, from a pure troubleshooting perspective, it would just be easier to manually enter the details with putty, rather than copy and paste from another file or use WinSCP to transfer the file or edit.

                                      Also, there is one other thing. I've got samba shares operating as well in Windows and regularly transferred files including the runcommand-onstart.sh (which I'd sometimes created in Windows with Notepad++ during this troubleshooting process) from Windows to the raspberry pi. I'm sure that would also have led to the "newline" issue too.

                                      Sometimes it's just better to use the raspberry pi's native editors, I suppose. Thanks, guys.

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

                                        @spud11

                                        Glad to see you got it going.

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

                                          Hey quick question, is it possible to map 2 controllers with Xboxdrv for two players to be able to play? It might have been discussed in the thread but I didn't find it. I found mappings for the 2nd player though so I'm assuming it's possible just wasn't sure how to pull it off.

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

                                            @Hubz

                                            Sure. You'd just string two commands together instead of having just one. A quick example for Intellivision would look like

                                            if [ "$1" = "intellivision" ]
                                            then
                                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                            	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
                                            	--detach-kernel-driver \
                                            	--force-feedback \
                                            	--dpad-as-button \
                                            	--trigger-as-button \
                                            	--deadzone-trigger 15% \
                                            	--deadzone 4000 \
                                            	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
                                            	--silent \
                                            	--axismap -Y1=Y1,-Y2=Y2 \
                                            	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                            	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
                                            	--ui-axismap X1=KEY_S:KEY_D,Y1=KEY_E:KEY_X,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4,lt+X2=KEY_5:KEY_6,lt+Y2=KEY_7:KEY_8,rt+X2=KEY_9:KEY_0,rt+Y2=KEY_MINUS:KEY_EQUAL \
                                            	--ui-buttonmap b=KEY_LEFTSHIFT,a=KEY_UNKNOWN,x=KEY_LEFTCTRL,y=KEY_LEFTALT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_E,dd=KEY_X,dl=KEY_S,dr=KEY_D,start=KEY_PAUSE \
                                            	--ui-buttonmap back=cycle-key:KEY_F6:KEY_F5 \
                                            	--ui-buttonmap back+start=KEY_F1,back+b=KEY_F12,back+y=KEY_F11,back+a=KEY_PAUSE \
                                            	--ui-buttonmap lt+a=KEY_A,lt+b=KEY_B,lt+x=KEY_X,lt+y=KEY_Y,lt+lb=KEY_L,lt+rb=KEY_R,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_T,lt+back=KEY_E \
                                            	--ui-buttonmap guide=void \
                                            	&
                                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                            	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.4:1.0-event-joystick \
                                            	--detach-kernel-driver \
                                            	--force-feedback \
                                            	--dpad-as-button \
                                            	--trigger-as-button \
                                            	--deadzone-trigger 15% \
                                            	--deadzone 4000 \
                                            	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
                                            	--silent \
                                            	--axismap -Y1=Y1,-Y2=Y2 \
                                            	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                            	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
                                            	--ui-axismap X1=KEY_J:KEY_K,Y1=KEY_I:KEY_M,X2=KEY_KP1:KEY_KP2,Y2=KEY_KP3:KEY_KP4,lt+X2=KEY_KP5:KEY_KP6,lt+Y2=KEY_KP7:KEY_KP8,rt+X2=KEY_KP9:KEY_DOT,rt+Y2=KEY_0:KEY_ENTER \
                                            	--ui-buttonmap b=KEY_RIGHTSHIFT,a=KEY_UNKNOWN,x=KEY_RIGHTCTRL,y=KEY_RIGHTALT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_I,dd=KEY_M,dl=KEY_J,dr=KEY_K,back=KEY_UNKNOWN,start=KEY_PAUSE \
                                            	--ui-buttonmap back+start=KEY_F1,back+b=KEY_F12,back+y=KEY_F11,back+a=KEY_PAUSE \
                                            	--ui-buttonmap lt+a=KEY_A,lt+b=KEY_B,lt+x=KEY_X,lt+y=KEY_Y,lt+lb=KEY_L,lt+rb=KEY_R,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_T,lt+back=KEY_E \
                                            	--ui-buttonmap guide=void \
                                            	&
                                            fi
                                            

                                            You can even have both those commands set to run by default and have others run for individual games using elif. Adding a map command to the example above that will only launch for 'Masters of The Universe: The Power of He-Man' would look like:

                                            if [ "$1" = "intellivision" ] && [ "$3" = "/home/pi/RetroPie/roms/intellivision/Masters of the Universe-The Power of He-Man! (1983) (Mattel).int" ]
                                            then
                                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                            	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
                                            	--detach-kernel-driver \
                                            	--force-feedback \
                                            	--dpad-as-button \
                                            	--trigger-as-button \
                                            	--deadzone-trigger 15% \
                                            	--deadzone 4000 \
                                            	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
                                            	--silent \
                                            	--axismap -Y1=Y1,-Y2=Y2 \
                                            	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                            	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
                                            	--ui-axismap X1=KEY_S:KEY_D,Y1=KEY_E:KEY_X,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4,lt+X2=KEY_5:KEY_6,lt+Y2=KEY_7:KEY_8,rt+X2=KEY_9:KEY_0,rt+Y2=KEY_MINUS:KEY_EQUAL \
                                            	--ui-buttonmap b=KEY_LEFTSHIFT,a=KEY_2,x=KEY_LEFTCTRL,y=KEY_LEFTALT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_E,dd=KEY_X,dl=KEY_S,dr=KEY_D,start=KEY_PAUSE \
                                            	--ui-buttonmap back=cycle-key:KEY_F6:KEY_F5 \
                                            	--ui-buttonmap back+start=KEY_F1,back+b=KEY_F12,back+y=KEY_F11,back+a=KEY_PAUSE \
                                            	--ui-buttonmap lt+a=KEY_A,lt+b=KEY_B,lt+x=KEY_X,lt+y=KEY_Y,lt+lb=KEY_L,lt+rb=KEY_R,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_T,lt+back=KEY_E \
                                            	--ui-buttonmap guide=void \
                                            	&
                                            elif [ "$1" = "intellivision" ]
                                            then
                                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                            	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
                                            	--detach-kernel-driver \
                                            	--force-feedback \
                                            	--dpad-as-button \
                                            	--trigger-as-button \
                                            	--deadzone-trigger 15% \
                                            	--deadzone 4000 \
                                            	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
                                            	--silent \
                                            	--axismap -Y1=Y1,-Y2=Y2 \
                                            	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                            	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
                                            	--ui-axismap X1=KEY_S:KEY_D,Y1=KEY_E:KEY_X,X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4,lt+X2=KEY_5:KEY_6,lt+Y2=KEY_7:KEY_8,rt+X2=KEY_9:KEY_0,rt+Y2=KEY_MINUS:KEY_EQUAL \
                                            	--ui-buttonmap b=KEY_LEFTSHIFT,a=KEY_UNKNOWN,x=KEY_LEFTCTRL,y=KEY_LEFTALT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_E,dd=KEY_X,dl=KEY_S,dr=KEY_D,start=KEY_PAUSE \
                                            	--ui-buttonmap back=cycle-key:KEY_F6:KEY_F5 \
                                            	--ui-buttonmap back+start=KEY_F1,back+b=KEY_F12,back+y=KEY_F11,back+a=KEY_PAUSE \
                                            	--ui-buttonmap lt+a=KEY_A,lt+b=KEY_B,lt+x=KEY_X,lt+y=KEY_Y,lt+lb=KEY_L,lt+rb=KEY_R,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_T,lt+back=KEY_E \
                                            	--ui-buttonmap guide=void \
                                            	&
                                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                            	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.4:1.0-event-joystick \
                                            	--detach-kernel-driver \
                                            	--force-feedback \
                                            	--dpad-as-button \
                                            	--trigger-as-button \
                                            	--deadzone-trigger 15% \
                                            	--deadzone 4000 \
                                            	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
                                            	--silent \
                                            	--axismap -Y1=Y1,-Y2=Y2 \
                                            	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                            	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
                                            	--ui-axismap X1=KEY_J:KEY_K,Y1=KEY_I:KEY_M,X2=KEY_KP1:KEY_KP2,Y2=KEY_KP3:KEY_KP4,lt+X2=KEY_KP5:KEY_KP6,lt+Y2=KEY_KP7:KEY_KP8,rt+X2=KEY_KP9:KEY_DOT,rt+Y2=KEY_0:KEY_ENTER \
                                            	--ui-buttonmap b=KEY_RIGHTSHIFT,a=KEY_UNKNOWN,x=KEY_RIGHTCTRL,y=KEY_RIGHTALT,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_I,dd=KEY_M,dl=KEY_J,dr=KEY_K,back=KEY_UNKNOWN,start=KEY_PAUSE \
                                            	--ui-buttonmap back+start=KEY_F1,back+b=KEY_F12,back+y=KEY_F11,back+a=KEY_PAUSE \
                                            	--ui-buttonmap lt+a=KEY_A,lt+b=KEY_B,lt+x=KEY_X,lt+y=KEY_Y,lt+lb=KEY_L,lt+rb=KEY_R,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_T,lt+back=KEY_E \
                                            	--ui-buttonmap guide=void \
                                            	&
                                            fi
                                            

                                            So basically it dictates that if the system is Intellivision and the ROM is He-Man, then it will launch the He-Man map command. Otherwise, if the system is Intellivision with no specified ROM, it will always fall back to the default one and two player map commands.

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

                                            H 1 Reply Last reply Reply Quote 1
                                            • 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.