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

    Here is a way to select joystick for players 1-4 (global or emu specific)

    Scheduled Pinned Locked Moved Help and Support
    retroarchinputcontrollerjoystickjoypad index
    154 Posts 28 Posters 133.1k 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.
    • mattrixkM
      mattrixk @lilbud
      last edited by

      @lilbud said in Here is a way to select input for RetroArch players 1-4:

      does anyone it have anything to do with grid view?

      Unfortunately not. @jacobfk20 Came out with his Emulationstation Mad a couple of days after I posted my theme, and now I'm working on something else, I haven't had the chance to make any changes to it. I'd like to add support for Grid View, and it probably wouldn't be too hard or take too long, but I just don't have the time at the moment.

      Also, I do my theme coding on a portable Windows version of ES, so I can't install @jacobfk20's mod to try it out , and my Pi pulls it's main duty as a Kodi box in the lounge, so I don't get to keep it at my computer to play with as often as I would like.

      There will be an update for MetaPixel soon, but the 'something special' I mentioned in my last post takes precedence at the moment.

      My ES themes: MetaPixel | Spare | Io | Indent

      1 Reply Last reply Reply Quote 0
      • meleuM
        meleu @mattrixk
        last edited by

        @mattrixk said in Here is a way to select input for RetroArch players 1-4:

        @meleu Cheers for giving MetaPixel a try. Any thoughts or critiques for me?

        Well... I didn't like the font that much...

        • Useful topics
        • joystick-selection tool
        • rpie-art tool
        • achievements I made
        mattrixkM 1 Reply Last reply Reply Quote 0
        • mattrixkM
          mattrixk @meleu
          last edited by

          @meleu said in Here is a way to select input for RetroArch players 1-4:

          Well... I didn't like the font that much...

          Heh, that's a fair enough point. I quite like it myself, but I can see it not being everyone's cup of tea. When I update the theme, I might install another 2 or 3 fonts and then the user can select the one they want. I should be able to make it pretty simple on the user. Do you like the font used in @Rookervik's original Pixel theme?

          Is there anything else? I like it and use it myself, but I haven't really heard what anyone else thinks of it, so I don't know what other people want fixed. I'm going to start making a To-Do list for the next release.

          My ES themes: MetaPixel | Spare | Io | Indent

          1 Reply Last reply Reply Quote 0
          • J
            jacobfk20
            last edited by

            @mattrixk This branch https://github.com/jacobfk20/EmulationStation/tree/Gridview Is windows friendly. It Only has Grid View and is hopefully more stable. Though I don't have a pre compiled version for windows.

            mattrixkM 1 Reply Last reply Reply Quote 0
            • mattrixkM
              mattrixk @jacobfk20
              last edited by

              @jacobfk20 Awesome. I'm not sure when I'll get a chance to try it out though. I've been home with sickness on and off for the last fortnight, so I had a chance to work on MetaPixel and start some other stuff, but I'm back at work now, so my time is limited again.

              My ES themes: MetaPixel | Spare | Io | Indent

              1 Reply Last reply Reply Quote 0
              • meleuM
                meleu
                last edited by meleu

                Hey guys!

                Another step was taken (actually two steps)! Now the joystick-selection tool can configure the joysticks for a specific system too. Another cool feature is the possibility to select the joystick by its name. Let me talk a little more about it...

                OK, the previous version already show the joystick name. But it was just a convenience during the configuration process. In the end the configuration was made using the joystick indexes. The problem is that the index can change depending on the USB port you plug your controller, or the order you pair your Bluetooth controller. If you plug/pair something in a different order, maybe you have to configure it again.

                The advantage of the selection by name method is that there is no need to care about the joystick connection order. You can configure your "Generic USB SNES gamepad" to be the player1 no matter what USB port you use, and it will always be the player1. Or, better yet, configure your "Fancy Bluetooth joypad" to be the player1 no matter what was the order it was paired or how many USB joysticks are connected.

                Oh... If you have controllers with equal names, then, yes, the connection order matters...

                I've made my tests here, and apparently everything is OK. But before merge all this changes to the master branch, I would like to ask you to give me feedback if you find some problem:

                The branch with the latest features:
                https://github.com/meleu/RetroPie-joystick-selection/tree/selectionbyname

                Installation:

                git clone -b selectionbyname https://github.com/meleu/RetroPie-joystick-selection
                cd RetroPie-joystick-selection
                bash install.sh
                

                How it works? Thanks to a new feature added recently in runcommand, we can execute some commands before launch the emulator. So, we can get the joystick names, look for their indexes and put these numbers in retroarch.cfg. The joystick names are stored in the joystick-selection.cfg files in /opt/retropie/configs/SYSTEMNAME/ directory.

                I stole the idea got inspired by what @BuZz did recently on configeditor and changed the dialogs to a more user friendly way to choose joysticks.

                Hey bash hackers, I'm sure you can do this same thing in a better way. I spent some time commenting the code to help other developers to understand, improve or change it completely.

                Thanks to @Zigurana, for telling me to make such tool instead of asking for it, and for show me that I can get the joystick names from SDL library.

                And thanks to @BuZz, for implement runcommand-on{start,end}.sh feature in runcommand (it made possible the selection by name method), and for inifuncs (really useful for this project), and for maintaining the RetroPie project.

                • Useful topics
                • joystick-selection tool
                • rpie-art tool
                • achievements I made
                1 Reply Last reply Reply Quote 2
                • meleuM
                  meleu
                  last edited by

                  Some screenshots

                  Main menu:

                  main-meu

                  Global configuration (with no configs):

                  config-all-unset

                  Global configuration (by name method, all 4 joysticks are set):

                  config-all-configured

                  Systems menu (I have just a few of them installed):

                  system-menu

                  System specific (by name method, some joysticks are set):

                  config-nes

                  Joystick selection screen:

                  joy-select

                  • Useful topics
                  • joystick-selection tool
                  • rpie-art tool
                  • achievements I made
                  1 Reply Last reply Reply Quote 0
                  • meleuM
                    meleu @Rion
                    last edited by

                    @Rion said in Here is a way to select input for RetroArch players 1-4:

                    Also when launching a game and pressing the "a" button using the run command so I can choose what controller is P1 & P2 and so on for that particular game/system?

                    the configuration is made launching the joystick selection tool in retropiemenu, but now it can be done for a particular system.

                    • Useful topics
                    • joystick-selection tool
                    • rpie-art tool
                    • achievements I made
                    1 Reply Last reply Reply Quote 1
                    • M
                      mlengland
                      last edited by

                      Hi @meleu . I was able to install & interact with the script via the Emulation Station GUI.

                      After executing for the first time, the controllers appeared to be set correctly but again once I started a game the "default" controllers went back to port 0 & 1. I went back to your script and it appeared to have reset the player index numbers.

                      This is the same thing that happens if I manually change the input_player1_joypad_index = "0" line in a systems retroarch.cfg file. Basically once I launch the game, the retroarch.cfg file appears to go back to default.

                      If all your script is doing is saving me the manual step of setting the joypad index in each retroarch.cfg file, then it appears my issue is that this file is reset to default on game launch.

                      Thoughts?

                      meleuM M 2 Replies Last reply Reply Quote 0
                      • meleuM
                        meleu @mlengland
                        last edited by

                        @mlengland It seems that you config_save_on_exit is on...
                        Are you used to use RGUI to configure RetroArch stuff?

                        • Useful topics
                        • joystick-selection tool
                        • rpie-art tool
                        • achievements I made
                        1 Reply Last reply Reply Quote 0
                        • M
                          mlengland @mlengland
                          last edited by mlengland

                          @mlengland said in Here is a way to select input for RetroArch players 1-4:

                          Hi @meleu . I was able to install & interact with the script via the Emulation Station GUI.

                          After executing for the first time, the controllers appeared to be set correctly but again once I started a game the "default" controllers went back to port 0 & 1. I went back to your script and it appeared to have reset the player index numbers.

                          This is the same thing that happens if I manually change the input_player1_joypad_index = "0" line in a systems retroarch.cfg file. Basically once I launch the game, the retroarch.cfg file appears to go back to default.

                          If all your script is doing is saving me the manual step of setting the joypad index in each retroarch.cfg file, then it appears my issue is that this file is reset to default on game launch.

                          Thoughts?

                          As a test I turned off global save on exit for RetroArch and then put the controller settings in again per your script. I just reset the system and then took a look at the SNES retroarch.cfg and it stuck!

                          So I booted Emulation Station. Launched a rom. And once again, the SNES controllers wouldn't work. Only the USB port 1 & 2 controllers were recognized.

                          I sudo nano the retroarch.cfg file and your script changes are still showing up. They are in fact sticking. But on game launch for some reason the emu always wants to use the controllers in port 0 & 1 even though the cfg file says otherwise.

                          So, now, I'm stumped...

                          EDIT: @meleu looks like we posted at the same time. Either, or. GUI or terminal. To turn off 'save on exit' I did that via terminal/command line in the ALL folder.

                          meleuM 1 Reply Last reply Reply Quote 0
                          • meleuM
                            meleu @mlengland
                            last edited by meleu

                            @mlengland
                            I think you messed up your retroarch.cfg files while using the config_save_on_exit set to true...
                            If you really really wanna know whats happening I would suggest you to check where the #include line is at your SNES retroarch.cfg (for example). But if you want a fast solution, look if you have the retroarch.cfg.rp-dist files in your systems directory and use it as the retroarch.cfg (to "restore the factory settings").

                            • Useful topics
                            • joystick-selection tool
                            • rpie-art tool
                            • achievements I made
                            M 1 Reply Last reply Reply Quote 1
                            • M
                              mlengland @meleu
                              last edited by

                              @meleu ugh. For some reason the changes were happening after the #input line. I just manually moved them and all is working now!

                              Thank you so much for your help and awesome script.

                              meleuM 1 Reply Last reply Reply Quote 0
                              • meleuM
                                meleu @mlengland
                                last edited by

                                @mlengland said in Here is a way to select input for RetroArch players 1-4:

                                @meleu ugh. For some reason the changes were happening after the #input line.

                                I think you mean #include...

                                Recently the runcommand.sh was changed to always put the #include line at the end of the file, as you can see in this thread: https://retropie.org.uk/forum/topic/3285/i-think-we-finally-have-a-solution-for-rgui-fans

                                • Useful topics
                                • joystick-selection tool
                                • rpie-art tool
                                • achievements I made
                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  mlengland @meleu
                                  last edited by

                                  @meleu I did. Sorry phone typo. A million thanks. Seriously. This was driving me crazy.

                                  1 Reply Last reply Reply Quote 0
                                  • meleuM
                                    meleu
                                    last edited by

                                    I tested a little more and I'm satisfied (for a while). I've just merged the selectionbyname branch into the master.
                                    I updated the first post of this thread talking about the new features and put some screenshots.

                                    Some guys who have shown interest and/or asked to be informed:
                                    @chan , @Synopsis , @briankross , @swd120 , @ralph-Bing , @octubrq , @unibiggle , @lumberg , @white_gecko , @Rion , @mattrixk , @skrapps914 , @mediamogul

                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    mediamogulM edmaul69E 2 Replies Last reply Reply Quote 3
                                    • mediamogulM
                                      mediamogul Global Moderator @meleu
                                      last edited by

                                      @meleu

                                      This is fantastic! It really has been great watching this evolve. On a side note, work has been killing my free time as of late, but I haven't forgotten about our net play game. Until we can arrange a time, I'll be sharpening my Contra skills.

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

                                      1 Reply Last reply Reply Quote 2
                                      • edmaul69E
                                        edmaul69 @meleu
                                        last edited by edmaul69

                                        nm. ran it again and it worked

                                        meleuM 1 Reply Last reply Reply Quote 0
                                        • meleuM
                                          meleu @edmaul69
                                          last edited by meleu

                                          @edmaul69
                                          I glad you get it running, but let me take a few notes about your original post.

                                          1. I merged the selectionbyname branch into the master. In other other words, you don't have to use the -b selectionbyname option in the command line anymore, just
                                          git clone https://github.com/meleu/RetroPie-joystick-selection
                                          
                                          1. After install, there's no need to reboot the system. Only restart the emulationstation to see it in RetroPie menu.

                                          2. when using the selection by name method (and only in this condition) this tool uses the runcommand-onstart.sh to set some configs, but it does nothing in the actual runcommand menu (that one where you can choose the emulator, launch netplay, etc.). [oh. It made me think that would be really cool if there was an runcommand-onmenu.sh to be executed if the user select it from the runcommand menu. But I think it will not happen anytime soon.]

                                          3. the joystick-selection.cfg files are created on demand, and only when the selection by name method is active.

                                          Cheers!

                                          • Useful topics
                                          • joystick-selection tool
                                          • rpie-art tool
                                          • achievements I made
                                          edmaul69E 1 Reply Last reply Reply Quote 0
                                          • edmaul69E
                                            edmaul69 @meleu
                                            last edited by

                                            @meleu there wouldnt by some chance be a way that if the selected controller isnt detected that it would use the one detected is there? The ps 3 controller is the only reason i need this since it is always set as the last controller when wireless. When testing i had to turn on the ps3 controller to exit the game. Its fine if i have to just go into the joystick setup and change in advance. Just curious though. But thank you for this. Finally a way to use the ps3 controller on bluetooth. Both my pi 3's are built inside a console with their own controller ports wired up.

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