Force Keyboard to Always Be Last Player
-
It is not a keyboard problem. Its a ps3 bluetooth problem. The ps3 controller when on bluetooth will always be the last controller. I have no clue why but thats the problem. If it is in retroarch emulators that is your problem and you want it to always be first you can go into /opt/retropie/configs/all/retroarch-joypads/Name Of Your Controller.cfg (official controller is SonyPLAYSTATION(R)3Controller.cfg) and add the line:
Input_player1_joypad_index= "0"
That should fix that at least for retroarch libretro emulators.
-
If you guys want an user-friendly way to change RetroArch joystick order, here is a very easy method:
https://github.com/meleu/RetroPie-joystick-selection@mattrixk I'm not sure if it solve your problem, because it's made for RetroArch only.
-
Actually doing it my way you might need to try numbers other than 0. Keep trying count up one number until it works
-
@edmaul69 , @meleu : Thank you both for your answers. I'm only using the Retroarch emulators** so both your answers are useful to me.
@edmaul69 : That's an interesting thought. I was focused on keeping the keyboard as the last player, but I never thought of keeping the PS3 controllers as the first and second players.
So, the first part: [Input_player1_joypad_index=] sets the player order? eg [Input_player2_joypad_index=] would set what controller to use for the second player?
And the [= "0"] sets which controller to use for that player?
How do I know which controller corresponds to which number?
I am also curious... let's call my 2 PS3 controllers as PS3-a and PS3-b. PS3-a is my main one (I like the colour more), so I would set it as Player 1 (P1), then set PS3-b as P2. But what if PS3-a was flat, so I had to use PS3-b, would PS3-b still be set as P2, or would it default to P1?
I also have a couple of 8bitdo controllers on the way, so if I set them as P3 and P4, would they default to P1 and P2 if I don't turn on the PS3 controllers?
@meleu : That looks great, I'll definitely have to give that a try. I have a feeling most of my questions to @edmaul69 will apply to your script as well regarding what happens if I only turn on the controller for say, P3: will it remain as P3, or will it become P1? And if I then turn on the controller that is set as P1, will it become P2, or will it push the other one out of the P1 spot?
(I'm afraid I'm making this more confusing that it needs to be)
Actually, could I just simply set the keyboard as player 8 with [Input_player8_joypad_index= "#"]*** and be done with it? Or can I not set the keyboard this way?
** For now. I tried using the ppsspp emulator for PSP games, but I somehow broke the keybinding and now I can't even get to the 'reset keys' function. I'll have to delete and reinstall the emulator, but at the moment I can't be fudged and have other things to do with my time.
*** where # equals the number for the keyboard -
@mattrixk said in Force Keyboard to Always Be Last Player:
How do I know which controller corresponds to which number?
If you installed the RetroPie-joystick-selection I said before, it installed a usefull tool to get these numbers. Look at this example
[prompt]$ /opt/retropie/supplementary/jslist 0:Twin USB Joystick 1:Twin USB Joystick 2:ipega Extending Game Controller 3:8Bitdo Zero Game Pad
PS3-a is my main one (I like the colour more), so I would set it as Player 1 (P1), then set PS3-b as P2. But what if PS3-a was flat, so I had to use PS3-b, would PS3-b still be set as P2, or would it default to P1?
I'm not sure what you mean with "flat", but if you turn off your P1 controller, the controller set as P2 won't be the P1 automatically.
I also have a couple of 8bitdo controllers on the way, so if I set them as P3 and P4, would they default to P1 and P2 if I don't turn on the PS3 controllers?
Maybe yes. But it's better to check the joystick index after adding/removing bluetooth controllers (or execute the joystick_selection tool, that you'll find at RetroPie menu in emulationstation if you install it ;-) )
(...) what happens if I only turn on the controller for say, P3: will it remain as P3, or will it become P1? And if I then turn on the controller that is set as P1, will it become P2, or will it push the other one out of the P1 spot?
(I'm afraid I'm making this more confusing that it needs to be)Yeah! You've made it! LOL
Keep in mind a few facts:
- The joystick index number is setted when you connect your joysticks to the system.
- The retroarch configuration is made using these index numbers, and this configuration is hardcoded.
- If you reboot your system and connect your joysticks in a diferent order, maybe they'll get diferent indexes, but the retroarch configs won't know it. Retroarch only care about the index numbers.
-
Thanks for all the info @meleu I'll have to have a go at your script when I get a chance in the next few days.
When I used the term 'flat', I was referring to the controller being out of battery power and having to be recharged.
What I get from what you are saying is that each time I restart RetroPie I should turn on all the controllers I want to use, and then run your script, just to make sure every controller is where I want it to be? And then if I change which controllers I want to use (eg turn off PS3 controllers and turn on 8bitdo controllers), I should just run the script again?
If so, that sounds perfectly reasonable and something I am more than willing to do, as it doesn't really sound like much of a hassle. As I said in the original post, I use the Pi mainly for Kodi, and I don't get into RetroPie as often as I'd like, so I wouldn't have to do this too often.
-
@mattrixk said in Force Keyboard to Always Be Last Player:
(...) each time I restart RetroPie I should turn on all the controllers I want to use, and then run your script, just to make sure every controller is where I want it to be?
Yep! You're right!
And then if I change which controllers I want to use (eg turn off PS3 controllers and turn on 8bitdo controllers), I should just run the script again?
Yes again!
I'm working on a way to let the users configure the "controllers x players" using the controller names and avoid this little confusion with the indexes. But before I can work on my code I need 1) to be off from my job; 2) put my kids to sleep; 3) make my wife (note my fingers doing quotation marks) "satisfied". So, it can take some time until I release these improvements...
-
@meleu Heh, my situation is much like yours. Get home from work, collect, feed, bath and bed for the kid, make dinner for and spend time with late-working wife, then have maybe an hour to myself at some time after 10:30pm.
All that means I probably won't get the chance to put this into practice for a few days, but I'm looking forward to giving it a try. Thanks for your help on this.
-
I tried your script last night and it worked perfectly. Thank you. It was exactly what I needed.
This is the kind of thing that should be core functionality.
-
This post is deleted! -
@mattrixk
I have the C120 Pro remote, which might not have the same id numbers.I found this post that helped solve the same issue as yours, where it would register as player 1 and the other controls were 2+.
From the post: "The following code deactivates the joystick part."
https://ubuntuforums.org/showthread.php?t=2283297Use this to find the usb interface/vendor/model id numbers:
udevadm info -q all -n /dev/input/js0 | grep -Ei '(ID_USB_INTERFACE_NUM|ID_VENDOR_ID|ID_MODEL_ID)'
Create rule using:
sudo nano /etc/udev/rules.d/99-persistent-joystick.rules
and add the following in (replacing bInterfaceNumber, idVendor and idProduct with yours):
SUBSYSTEM=="usb", ATTR{bInterfaceNumber}=="03", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="3451", RUN+="/bin/sh -c '/bin/echo -n %k >/sys${DEVPATH}/driver/unbind'"
Reboot, and you should see that js0 is no longer shown by using
ls -l /dev/input/
and that controller 1 shows up as controller 1 when activated.
This may not be the proper way to do things, but the best I've found so far using it with PS3 controllers. If there's a better way, I'd be open to hearing it.
Hope this helps.
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.