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)



  • @meleu

    Curious if this can be used with the kid-friendly version of ES?



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

    @meleu

    Curious if this can be used with the kid-friendly version of ES?

    Oh, sorry. I have never used this ES version.

    I know that the "Parse Gamelists Only" option must be off to let the input_selection be shown in RetroPie menu.

    Please, try it and let me know if it works.



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

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

    @meleu

    Curious if this can be used with the kid-friendly version of ES?

    Oh, sorry. I have never used this ES version.

    I know that the "Parse Gamelists Only" option must be off to let the input_selection be shown in RetroPie menu.

    Please, try it and let me know if it works.

    Is there anyway around this?

    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?



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

    Is there anyway around this?

    "This" what? The "Parse Gamelists Only" option?
    Start button on emulationstation -> Other Settings -> Parse Gamelists Only. And turn it off (this is the default, so if you didn't change it, don't worry).

    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?

    I think it requires some coding in runcommand.sh. I'm not feeling so confident to play with RetroPie official code for now... But I'll try it later. ;)



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

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

    Is there anyway around this?

    "This" what? The "Parse Gamelists Only" option?
    Start button on emulationstation -> Other Settings -> Parse Gamelists Only. And turn it off (this is the default, so if you didn't change it, don't worry).

    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?

    I think it requires some coding in runcommand.sh. I'm not feeling so confident to play with RetroPie official code for now... But I'll try it later. ;)

    Looking forward to see what you can accomplish. Great work so far! :)



  • Today another step was taken. I added a dialog to show the current config before start the configuration. So the user can decide to change the config or not.

    And after the configuration process, it'll show the changes that will be made. Again the user can decide to accept it or not.

    Please, update your scripts:

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


  • I forgot to mention: in the dialog that shows the configs, there are alerts for Players with no joysticks.



  • I posted an issue at RetroArch github talking about the problem of the current input configuration method using RGUI. If they implement some simple enhancements, my script will become unecessary (and I hope that! :D ).

    Please, take a look there and post some comments if you think it deserves.



  • Today I've made some improvements:

    • rename the project/script to joystick selection (I think "joystick" is more specific than "input", and the script deals with joysticks only).
    • added an initial menu.
    • during the configuration, let the user decide if he/she wants to keep the current config for each player (usefull when the system has less then 4 joysticks available).
    • an option to restore the defaul settings (input_player1_joypad_index = 0, input_player2_joypad_index = 1, input_player3_joypad_index = 2, input_player4_joypad_index = 3)
    • the jslist is now placed in /opt/retropie/supplementary/. I choose this way cause if the user decides to uninstall RetroPie someday, the jslist will go together.
    • the joystick_selection.sh (former input_selection.sh) is now placed directly in $HOME/RetroPie/retropiemenu/ and is invoked via RetroPie menu only.
    • the install.shwill delete the old input_selection.sh scheme, if it exists (delete the jslist and input_selection.sh, in $HOME/bin; delete the $HOME/bin if it's empty; delete the input_selection.sh entry in RetroPie menu), and of course, install the current scheme.

    Please, update your scripts:

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


  • And now the install.sh creates a gamelist.xml entry for joystick_selection.sh. So there is no problem when the "PARSE GAMELISTS ONLY" is set to "ON".



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

    And now the install.sh creates a gamelist.xml entry for joystick_selection.sh. So there is no problem when the "PARSE GAMELISTS ONLY" is set to "ON".

    Sweet!



  • @opensourcefan said

    Curious if this can be used with the kid-friendly version of ES?

    I just installed it last night on my kid-friendly version and it worked perfectly

    (I know your comment is 2 months old and you've probably tried it yourself by now, but I just wanted to let everyone know that it works for that version)


  • administrators

    Just a heads up - I have implemented joypad selection into the configuration editor now. I am ordering by device path, which seems to match how retroarch sees them in udev mode (at least from my initial testing)



  • @BuZz
    Unfortunately it doesn't works as expected here...
    In my old laptop, Linux always get a non-joystick device as js0. It is the ST LIS3LV02DL Accelerometer (honestly, I didn't even know it exist an accelerometer here!). Neither RetroArch nor SDL recognize it as a joystick. So, my "real" joysticks start from js1 with index 0.

    BTW: Because of this accelerometer at js0 I was unable to use joysticks in retropie_setup. Thanks for implementing that "feature" on __joy2key_dev! Now I can set another device. :-)


  • administrators

    Thanks - I think I just need to perhaps ignore it based on another device flag, but in the case of both of my setups it works (for now)



  • @BuZz
    Another improvement suggestion:
    After setting the controllers for, let's say, NES, I go to the ...nes/retroarch.cfg and the input_playerN_joypad_index variables are after that #include for global configs. Which means that the global config allways takes precedence over the specific config.

    BTW again: your configedit.sh made me realize the usefulness of inifuncs.sh. Really cool!



  • @BuZz
    Improvement suggestion again...
    I was struggling to find a way to check if player1 has a valid index right before start RetroArch. This is useful because if RetroArch starts with an invalid player1 index AND there is no keyboard, then there is no way to access RGUI. And if the RetroPie is NOT accessible via SSH, the user can't exit RetroArch. Unplug the power supply is the only solution, as far as I know.

    I know that the best way is implement this verification in runcommand.sh, but I didn't want to change an "official" script. Other solutions that I found are very inelegant for my taste: edit es_systems.cfg to call a verification script before runcommand; create other entries in systems emulator.cfg to call verification script before retroarch...

    Since you are the man-who-own-that-file, if you think it's usefull, maybe you can implement such feature...

    I was thinking in something like this pseudo-code with a touch of bash (not taking care of precedences for a while):

    if "$command" has a 'retroarch.cfg' string; then
        if 'retroarch.cfg' file has the 'input_player1_joypad_index' string; then
            p1_index = input_player1_joypad_index
            p1_file = "retroarch.cfg"
        elif 'retroarch.cfg' file has '#include ...' entries; then
            for include in include_entry1 include_entry2 etc... ; do
                if "$include" file has the 'input_player1_joypad_index' string; then
                    p1_index = input_player1_joypad_index
                    p1_file = "$include"
                    break
                fi
            done
    
        if "$p1_index" is empty; then
            # it's OK. RetroArch will set it to zero automatically
            return 0
        fi
    
        if "$p1_index" is NOT a valid joystick index; then
            echo "warning: setting input_player1_joypad_index to 0"
            set 'input_player1_joypad_index' to '0' in "$p1_file"
        fi
    fi
    

  • administrators

    @meleu maybe for a later version :)


  • administrators

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

    @BuZz
    Another improvement suggestion:
    After setting the controllers for, let's say, NES, I go to the ...nes/retroarch.cfg and the input_playerN_joypad_index variables are after that #include for global configs. Which means that the global config allways takes precedence over the specific config.

    BTW again: your configedit.sh made me realize the usefulness of inifuncs.sh. Really cool!

    They should go before the include. I'll check



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

    @meleu maybe for a later version :)

    Maybe a custom_command variable to be placed at ...configs/all/runcommand.cfg to let the user execute something before start the emulator...

    please



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.