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

      @ExarKunIv

      OK, looking at the linapple.conf file, I remember two things. First, I mapped the joystick to the specific keyboard keys Linapple uses for control, as seen in my configuration above. Then I had to set the type of joystick emulation that would be used for player 1 in in the linapple.conf file to "keyboard centered", seen in the excerpt below.

      #	Joysticks, those sticks of joy! There may be 2 joysticks at the same time
      # Possible values are:
      #	0	- joystick disabled
      #	1	- use PC joystick #1 or #2, for corresponding joystick
      
      #	2	- Keyboard standard
      #	3	- Keyboard centered
      # When joysticks used as a keyboard, they are stuck to Numpad keys (1-9 - axis movement, 0 - button1, . - button2)
      #  when centered used, axis of joystick will be centered after releasing any cursor (Numpad 1..9) key.
      # otherwise it assumed to be pressed always
      
      #	4	- Use mouse as a joystick. Rather interesting thing, try it. Useful in Fantavision(tm)by Broderbund Software
      
      # Default values are 2 for Joystick 0, and 0 for Joystick 1
      
      	Joystick 0	=	3
      	Joystick 1	=	0
      

      Second, notice that Joystick 1 (Player 2) is set to 0, essentially telling the software that there is no second controller. Only after doing this will the second action button on Player 1 become available. This second button is necessary in many games such as 'Lode Runner' and 'Escape From Castle Wolfenstein'.

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

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

        @mediamogul
        ok cool ill give that a try.

        thanks again for all your help

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

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

          it works :)

          heres my config for my 8BitDo FC30

          if [ "$1" = "apple2" ]
          then
          sudo killall > /dev/null 2>&1 xboxdrv
          sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
          	--evdev /dev/input/event2 \
          	--detach-kernel-driver \
          	--force-feedback \
          	--dpad-as-button \
          	--trigger-as-button \
          	--deadzone-trigger 15% \
          	--deadzone 4000 \
          	--silent \
          	--axismap -Y1=Y1,-Y2=Y2 \
          	--buttonmap tl^toggle=tl \
          	--buttonmap tr^toggle=tr \
          	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
          	--evdev-keymap KEY_#304=a,KEY_#305=b,KEY_#307=x,KEY_#308=y,KEY_#312=lt,KEY_#313=rt,KEY_#310=lb,KEY_#311=rb,KEY_#317=tl,KEY_#318=tr,KEY_#314=back,KEY_#315=start \
          	--ui-axismap X1=KEY_KP4:KEY_KP6,Y1=KEY_KP8:KEY_KP2,X2=KEY_UNKNOWN:KEY_UNKNOWN,Y2=KEY_UNKNOWN:KEY_UNKNOWN \
          	--ui-buttonmap b=KEY_KPDOT,a=KEY_KP0,x=KEY_UNKNOWN,y=KEY_UNKNOWN,lb=KEY_F3,rb=KEY_F4,du=KEY_KP8,dd=KEY_KP2,dl=KEY_KP4,dr=KEY_KP6,start=KEY_PAUSE,back=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN \
          	--ui-buttonmap back+start=KEY_F10,back+b=KEY_F2,back+y=KEY_F8,back+lb=KEY_LEFTALT+KEY_F12,back+rb=KEY_LEFTALT+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 rt+du=KEY_UP,rt+dd=KEY_DOWN,rt+dl=KEY_LEFT,rt+dr=KEY_RIGHT,rt+b=KEY_ESC,rt+a=KEY_ENTER \
          	--ui-axismap tl+x1=REL_X:20,tl+y1=REL_Y:20 \
          	--ui-buttonmap tr+b=BTN_LEFT,tr+a=BTN_RIGHT \
          	--ui-buttonmap guide=void \
          	&
          	fi
          

          did anyone use this to get the Videopac/Odyssey 2 to work?
          that will be my next mission.

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

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

            @ExarKunIv said in Guide: Advanced Controller Mappings:

            it works :)

            Nice!

            did anyone use this to get the Videopac/Odyssey 2 to work?

            The Videopac/Odyssey 2 emulator is a RetroArch core, so you might not need an xboxdrv mapping. I use one to map 0-9 to the right joystick for starting games, but that's about it.

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

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

              @mediamogul

              yes i did see that as i started messing around with it more.

              @mediamogul said in Guide: Advanced Controller Mappings:

              I use one to map 0-9 to the right joystick for starting games

              good to know that it can be done.

              does the mapping have to be done in the RetroArch config?
              i would think it would, but not sure

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

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

                @ExarKunIv

                I use a trick to where I put --evdev-no-grab into an xboxdrv configuration. This allows the physical controller to still have control input that would otherwise be blocked to prevent a conflict with the xboxdrv virtual controller. Then I map every button on the virtual controller to KEY_UNKNOWN except for the right joystick, which I map to the number pad. This way, RetroArch can still make use of the original control scheme with only the right joystick being read as keyboard input.

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

                ExarKunIvE 1 Reply Last reply Reply Quote 3
                • ExarKunIvE
                  ExarKunIv @mediamogul
                  last edited by

                  @mediamogul

                  so cool

                  i will give that a shot and see what i come up with
                  thanks again

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

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

                    here is what i got for now.

                    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                        --evdev /dev/input/event2 \
                        --silent \
                    	--detach-kernel-driver \
                    	--force-feedback \
                    	--mimic-xpad \
                    	--dpad-as-button \
                            --deadzone 15% \
                    	--trigger-as-button \
                    	--evdev-no-grab \
                    	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                    	--evdev-keymap KEY_#304=a,KEY_#305=b,KEY_#307=x,KEY_#308=y,KEY_#312=lt,KEY_#313=rt,KEY_#310=lb,KEY_#311=rb,KEY_#317=tl,KEY_#318=tr,KEY_#314=back,KEY_#315=start \
                    	--axismap -Y1=Y1,-Y2=Y2 \
                            --ui-buttonmap a=KEY_UNKNOWN,b=KEY_UNKNOWN,start=KEY_UNKNOWN,back=KEY_UNKNOWN,x=KEY_UNKNOWN,y=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN \
                    	--ui-axismap x2=KEY_1:KEY_2,Y2=KEY_3:KEY_4 \
                    &
                    

                    i dont get any errors, but still no mapping.
                    the no-grab works. as my left stick works fine. i think im useing the no-grab wrong
                    i'll mess around with it more tomrrow.

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

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

                      @ExarKunIv

                      RetroArch may be prioritizing the virtual xboxdrv controller as player one.

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

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

                        @mediamogul

                        so i need to use this im guessing?

                        
                        input_remapping_directory = "/opt/retropie/configs/fba/"
                        
                        input_player1_joypad_index = "1"
                        input_player2_joypad_index = "0"
                        input_player2_analog_dpad_mode = 1
                        
                        #include "/opt/retropie/configs/all/retroarch.cfg"
                        
                        

                        sorry for asking all the questions. this config stuff for me is very confusing

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

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

                          @ExarKunIv

                          Not a problem. If it is that RetroArch is confusing the controller order and if we're still talking about videopac/Odyssey², then your additions are right, but they should be made in /opt/retropie/configs/videopac/retroarch.cfg which would in turn mean that the first line would be:

                          input_remapping_directory = "/opt/retropie/configs/videopac/"
                          

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

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

                            @mediamogul

                            ok cool

                            i will give that a shot and see if i get anything to build on

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

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

                              i think this looks right from what you said

                              # Settings made here will only override settings in the global retroarch.cfg if placed above the #include line
                              
                              
                              input_device = "Xbox 360 Wireless Receiver (XBOX)"
                              input_driver = "udev"
                              input_r_y_plus_axis = "+4"
                              input_l3_btn = "9"
                              input_r_x_minus_axis = "-3"
                              input_l_btn = "4"
                              input_load_state_btn = "4"
                              input_start_btn = "7"
                              input_exit_emulator_btn = "7"
                              input_l_y_minus_axis = "-1"
                              input_up_btn = "13"
                              input_r_y_minus_axis = "-4"
                              input_a_btn = "1"
                              input_b_btn = "0"
                              input_reset_btn = "0"
                              input_down_btn = "14"
                              input_l_x_plus_axis = "+0"
                              input_l_y_plus_axis = "+1"
                              input_r_btn = "5"
                              input_save_state_btn = "5"
                              input_r2_axis = "+5"
                              input_r3_btn = "10"
                              input_right_btn = "12"
                              input_state_slot_increase_btn = "12"
                              input_key_1 = "3"
                              input_menu_toggle_btn = "3"
                              input_select_btn = "6"
                              input_enable_hotkey_btn = "6"
                              input_l_x_minus_axis = "-0"
                              input_y_btn = "2"
                              input_left_btn = "11"
                              input_state_slot_decrease_btn = "11"
                              input_r_x_plus_axis = "+3"
                              input_l2_axis = "+2"
                              
                              input_remapping_directory = "/opt/retropie/configs/videopac/"
                              
                              input_player1_joypad_index = "1"
                              input_player2_joypad_index = "0"
                              input_player2_analog_dpad_mode = 1
                              
                              #include "/opt/retropie/configs/all/retroarch.cfg"
                              
                              

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

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

                                ok this is a good head turner

                                i add this to my videopac as we said

                                input_remapping_directory = "/opt/retropie/configs/videopac/"
                                
                                input_player1_joypad_index = "1"
                                input_player2_joypad_index = "0"
                                input_player2_analog_dpad_mode = 1
                                
                                #include "/opt/retropie/configs/all/retroarch.cfg"
                                

                                and it switchs my 8BitDo to player 2

                                if i change it to this

                                input_remapping_directory = "/opt/retropie/configs/videopac/"
                                
                                input_player1_joypad_index = "0"
                                input_player2_joypad_index = "1"
                                input_player2_analog_dpad_mode = 1
                                
                                #include "/opt/retropie/configs/all/retroarch.cfg"
                                

                                its player 1 again

                                and here is what i got when i ran the script

                                pi@retropie:~ $ xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/
                                Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com>
                                Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
                                This program comes with ABSOLUTELY NO WARRANTY.
                                This is free software, and you are welcome to redistribute it under certain
                                conditions; see the file COPYING for details.
                                
                                
                                Your Xbox/Xbox360 controller should now be available as:
                                  /dev/input/js1
                                  /dev/input/event3
                                
                                Press Ctrl-C to quit
                                Shutdown complete
                                
                                

                                not really sure where to go from here.

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

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

                                  @ExarKunIv

                                  That appears to indicate a successful launch of xboxdrv. Are you saying that it stays on that screen indefinitely? Post your script and we'll take a look.

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

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

                                    @mediamogul

                                    it says up until i exit a game, turn off my controller, or press ctrl c

                                    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                        --evdev /dev/input/event2 \
                                        --silent \
                                    	--detach-kernel-driver \
                                    	--force-feedback \
                                    	--mimic-xpad \
                                            --deadzone 15% \
                                    	--evdev-no-grab \
                                    	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                    	--evdev-keymap KEY_#304=a,KEY_#305=b,KEY_#307=x,KEY_#308=y,KEY_#312=lt,KEY_#313=rt,KEY_#310=lb,KEY_#311=rb,KEY_#317=tl,KEY_#318=tr,KEY_#314=back,KEY_#315=start \
                                    	--axismap -Y1=Y1,-Y2=Y2 \
                                            --ui-buttonmap a=KEY_UNKNOWN,b=KEY_UNKNOWN,start=KEY_UNKNOWN,back=KEY_UNKNOWN,x=KEY_UNKNOWN,y=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN \
                                    	--ui-axismap x2=KEY_1:KEY_2,Y2=KEY_3:KEY_4 \
                                    &
                                    

                                    is that i manually add

                                    the shutdown complete was just from me exiting the game.
                                    other then no errors coming up i get no mapping down. i still need my usb keyboard in to press 1

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

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

                                      @ExarKunIv

                                      I've only ever known the screen to stay like that when the '&' is left off the tail end of the xboxdrv launch script. If that were the case, pressing 'Ctrl-C' would stop xboxdrv and allow things to move forward without the map being active, which would explain why it's not accessible once the emulator is up. You've posted the command itself, but can you post it in context with how it's being launched from runcommand-onstart.sh?

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

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

                                        @mediamogul

                                        if [ "$1" = "Videopac" ]
                                        then
                                        sudo killall > /dev/null 2>&1 xboxdrv
                                        sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \
                                            --evdev /dev/input/event2 \
                                            --silent \
                                        	--detach-kernel-driver \
                                        	--force-feedback \
                                        	--mimic-xpad \
                                                --deadzone 15% \
                                        	--evdev-no-grab \
                                        	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                        	--evdev-keymap KEY_#304=a,KEY_#305=b,KEY_#307=x,KEY_#308=y,KEY_#312=lt,KEY_#313=rt,KEY_#310=lb,KEY_#311=rb,KEY_#317=tl,KEY_#318=tr,KEY_#314=back,KEY_#315=start \
                                        	--axismap -Y1=Y1,-Y2=Y2 \
                                                --ui-buttonmap a=KEY_UNKNOWN,b=KEY_UNKNOWN,start=KEY_UNKNOWN,back=KEY_UNKNOWN,x=KEY_UNKNOWN,y=KEY_UNKNOWN,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,lb=KEY_UNKNOWN,rb=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN \
                                        	--ui-axismap x2=KEY_1:KEY_2,Y2=KEY_3:KEY_4 \
                                        &
                                        fi
                                        

                                        sorry for the delay
                                        busy nite

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

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

                                          @ExarKunIv

                                          Everything appears to be OK. The only thing I can even guess is that there might be something else in runcommand-onstart.sh that may be conflicting in some way.

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

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

                                            @mediamogul

                                            ok ill pull out the other configs and see that i get

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

                                            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.