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 485.0k 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

      @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
                                      • ExarKunIvE
                                        ExarKunIv
                                        last edited by ExarKunIv

                                        ok i pulled everything out of my runcommand-onstart.sh

                                        and still got nothing. so i ran cat /proc/bus/input/devices
                                        and got this

                                        cat /proc/bus/input/devices
                                        I: Bus=0005 Vendor=3810 Product=0009 Version=0100
                                        N: Name="8Bitdo FC30 Pro"
                                        P: Phys=b8:27:eb:47:c7:78
                                        S: Sysfs=/devices/platform/soc/3f201000.uart/tty/ttyAMA0/hci0/hci0:11/0005:3810:0009.0003/input/input8
                                        U: Uniq=e4:17:d8:7a:6a:7d
                                        H: Handlers=js0 event0
                                        B: PROP=0
                                        B: EV=1b
                                        B: KEY=ffff0000 0 0 0 0 0 0 0 0 0
                                        B: ABS=30627
                                        B: MSC=10
                                        

                                        the event code is different. so i went in and changed it in my script

                                        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/event0 \
                                            --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
                                        

                                        sadly nothing, but i can test it my controller using evtest /dev/input/event0
                                        and i get reading, but nothing showing any mapping. :(
                                        so it still seems that the --evdev-no-grab \ is working too well

                                        edit
                                        i know why the event number changed so no big on there

                                        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

                                          update

                                          my mapping works, i move my right joystick and i get KEY_1, KEY_2 ect..and when i exit the evtest /dev/input/event1 goes away showing that it see that i have exited the same, and the --evdev-no-grab \ works as i can move with in the game just fine....as long as i have a usb keyboard to press 1 for me.

                                          for some reason it will not see my mapping as a valid key press

                                          now im confused.

                                          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

                                            for some reason it will not see my mapping as a valid key press

                                            Ah, OK. I think I know what's wrong. Take a look at the final part of section 3A of the guide if you haven't already. It tells how to set a udev rule so that RetroArch will see the xboxdrv vitualized keyboard as being a real keyboard.

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