[SOLVED] Configure a Wireless controller's index
-
Hello everyone,
Any idea on how to set a specific index for a bluetooth controller?
I have two wired arcade joysticks and a bluetooth gamepad, and every time I turn on the bluetooth gamepad, it gets "index 0", taking over the wired joysticks.
I wanted to force my bluetooth gamepad to be index 2, and keep my joystick1 as index 0, and joystick2 as index 1.
I know I can customize the order under the configuration editor BUT the indexes themselves change as the bluetooth gamepad gets detected and that messes things up for me.
Thank you!
-
You can use @meleu's joystick selection utility, which can re-arrange the indexes by name - https://github.com/meleu/RetroPie-joystick-selection.
-
@mitu I don't think that works (though thank you for the suggestion).
The problem is that my gamepad's number was dynamic so I wouldn't know what number it was until I start the game!Though I managed to solve the problem by creating a runcommand-onstart.sh script:
root@retropie:/opt/retropie# cat /opt/retropie/configs/all/runcommand-onstart.sh
#!/bin/bash # fix player input index order! # on my system, the bluetooth gamepad always gets index 0 when it is active # which messes up the controls for all joystick based games! if [ -e "/dev/input/js2" ] then # Bluetooth controller is currently active! # Change retroarch's config order for player 1 through 3... # wired joystick 1 for player 1, wired joystick 2 for player 2, wireless gamepad for player 3 /bin/cp /opt/retropie/configs/all/base_configs/retroarch.cfg.all-bluetooth_enabled /opt/retropie/configs/all/retroarch.cfg # bluetooth gamepad for player 1, for psx! /bin/cp /opt/retropie/configs/all/base_configs/retroarch.cfg.psx-bluetooth_enabled /opt/retropie/configs/psx/retroarch.cfg else # Bluetooth controller not presently active! # Reset retroarch's config # wired joystick 1 for player 1, wired joystick 2 for player 2 /bin/cp /opt/retropie/configs/all/base_configs/retroarch.cfg.all-bluetooth_disabled /opt/retropie/configs/all/retroarch.cfg # no custom input config for psx! /bin/cp /opt/retropie/configs/all/base_configs/retroarch.cfg.psx-bluetooth_disabled /opt/retropie/configs/psx/retroarch.cfg fi
root@retropie:/opt/retropie#
This is hardcoded to my system but it solves my problem!
It looks for /dev/input/js2 (which is the device for my bluetooth gamepad) and, if it exists, it overwrites the retroarch.cfg global (and the psx) config to map the input_playerX_joypad_index parameter! :)
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.