david2012
Posts: 2
Joined: Sat Sep 07, 2013 11:32 pm

RetroPie Keyboard and Controller Issue

Sat Sep 07, 2013 11:50 pm

I am trying to get my 360 wired controller to be the controller for player 1 and my keyboard to be the controller for player 2. However, the only way I can get both working on a 2 player game is if the keyboard is Player 1. If I try to change ".../all/retroarch.cfg" so the keyboard is player 2 and the 360 controller is player 1, for some reason it treats them as if both are player 1.

In the comments of the skeleton config file, it says you can force which joypad is used for which player by using:

Code: Select all

input_player1_joypad_index = 0
My keyboard is joypad 0 and my 360 controller is joypad 1, so in my .../all/retroarch.cfg file I have

Code: Select all

input_player1_joypad_index = 1
and

Code: Select all

input_player2_joypad_index = 0
It seems like that should do it, but it still doesn't work. I also added these lines to the .../snes/retroarch.cfg file just in case, but it didn't help.

Does anyone have any ideas?

napoleon.starer
Posts: 4
Joined: Sun Sep 08, 2013 1:23 pm

Re: RetroPie Keyboard and Controller Issue

Sun Sep 08, 2013 9:25 pm

I had similar issues with setting up my controllers and the various config files involved for controllers and specific emulators.

I would recommend removing the player 1 and player 2 configs from both the SNES config and the ALL config, and then re-map the controllers using the following method, which will put them in the ALL config and let the joystick configuration tool do the work:

The RetroArch contains a joystick configuration that you can use to configure 1 or more controllers. The controller configuration is stored in /home/pi/RetroPie/configs/all/retroarch.cfg, and the joystick configuration application can be used to append to that location for as many controllers as you need. For example I used two USB SNES controller, which I configured by doing the following:

For controller #1, run the following command:

Code: Select all

/home/pi/RetroPie/emulators/RetroArch/tools/./retroarch-joyconfig >> /home/pi/RetroPie/configs/all/retroarch.cfg
Follow the prompts, which have you press various buttons on your controller, for example Up, Down, Left, Right, Start, Select, X, Y, A, B, L, and R. Eventually you will get to some configuration options that your controller may not have such as L2 and R2. Just press “left” and you will deal with this later.

For controller #2, run the following command:

Code: Select all

/home/pi/RetroPie/emulators/RetroArch/tools/./retroarch-joyconfig –p 2 –j 1>> /home/pi/RetroPie/configs/all/retroarch.cfg
Follow the prompts on the second controller as specified earlier.

The result is something like the following being written to the configuration file for each controller:

Code: Select all

input_player1_joypad_index = “0″
input_player1_a_btn = “0″
input_player1_b_btn = “1″
input_player1_y_btn = “3″
input_player1_x_btn = “2″
input_player1_start_btn = “7″
input_player1_select_btn = “6″
input_player1_l_btn = “4″
input_player1_r_btn = “5″
input_player1_up_axis = “-1″
input_player1_down_axis = “+1″
input_player1_left_axis = “-0″
input_player1_right_axis = “+0″
input_player1_l2_btn = “-0”
input_player1_r2_btn = “-0”
input_player1_l3_btn = “-0”
input_player1_r3_btn = “-0”

input_player2_joypad_index = “1″
input_player2_a_btn = “0″
input_player2_b_btn = “1″
input_player2_y_btn = “3″
input_player2_x_btn = “2″
input_player2_start_btn = “7″
input_player2_select_btn = “6″
input_player2_l_btn = “4″
input_player2_r_btn = “5″
input_player2_up_axis = “-1″
input_player2_down_axis = “+1″
input_player2_left_axis = “-0″
input_player2_right_axis = “+0″
input_player2_l2_btn = “-0″
input_player2_r2_btn = “-0″
input_player2_l3_btn = “-0″
input_player2_r3_btn = “-0″
Note that the specific output depends on the controller your use; your numbers will be different than what is listed here.

The next thing you have to do is edit this generated configuration to do two things:

Remove the bindings for buttons that you do not have on your controller
Add a configuration to allow you to exit the currently running ROM and return to the ROM selection screen
For example if you do not use the following buttons:
  • L2
    R2
    L3
    R3
    Up Axis
    Left Axis
    Down Axis
    Right Axis
…you would comment out those lines using the “#” character in /home/pi/RetroPie/configs/all/retroarch.cfg:

Code: Select all

input_player1_joypad_index = “0″
input_player1_a_btn = “0″
input_player1_b_btn = “1″
input_player1_y_btn = “3″
input_player1_x_btn = “2″
input_player1_start_btn = “7″
input_player1_select_btn = “6″
input_player1_l_btn = “4″
input_player1_r_btn = “5″
#input_player1_up_axis = “-1″
#input_player1_down_axis = “+1″
#input_player1_left_axis = “-0″
#input_player1_right_axis = “+0″
#input_player1_l2_btn = “-0”
#input_player1_r2_btn = “-0”
#input_player1_l3_btn = “-0”
#input_player1_r3_btn = “-0”

input_player2_joypad_index = “1″
input_player2_a_btn = “0″
input_player2_b_btn = “1″
input_player2_y_btn = “3″
input_player2_x_btn = “2″
input_player2_start_btn = “7″
input_player2_select_btn = “6″
input_player2_l_btn = “4″
input_player2_r_btn = “5″
#input_player2_up_axis = “-1″
#input_player2_down_axis = “+1″
#input_player2_left_axis = “-0″
#input_player2_right_axis = “+0″
#input_player2_l2_btn = “-0″
#input_player2_r2_btn = “-0″
#input_player2_l3_btn = “-0″
#input_player2_r3_btn = “-0″
Reference: http://arcadepi.wordpress.com/

splixson
Posts: 13
Joined: Sun Dec 09, 2012 8:02 am

Re: RetroPie Keyboard and Controller Issue

Wed Sep 18, 2013 10:50 pm

@david2012

Did you ever get a fix for your problem? I too would like to use a gamepad for player 1 and a keyboard for player 2. I'm just not sure how to configure it. I managed to get the gamepad working but the keyboard seems to control player1 as well as player 2.

Anyone any ideas?

david2012
Posts: 2
Joined: Sat Sep 07, 2013 11:32 pm

Re: RetroPie Keyboard and Controller Issue

Sun Sep 29, 2013 8:37 pm

I tried a few more things, still with no success.

My best guess right now is that they didn't actually implement the "you can override which joypads are being used" part correctly and it just always assigns the "js0" input device to player 1 in addition to whatever device you tell it to be player 1. If you could somehow force the controller to be js0 and the keyboard to be js1, I bet it would work, but I haven't been able to find anything out about how the device list gets populated.

Are there any Linux gurus out there that know how to do that?

StooPot
Posts: 6
Joined: Sun Apr 07, 2013 11:17 pm

Re: RetroPie Keyboard and Controller Issue

Thu Apr 17, 2014 1:21 am

I know this is an ancient post but if I have found it while having the same problem then others may too.

There seems to be a duplication/clash of keys assigned for controls on the keyboard and those for the joystick.

The keys set for the player 2 keyboard and player 1 joystick can be chosen in the retroarch.cfg file but I found that whatever I set these keys to, the arrow keys on the keyboard still lead to movement and the a and x keys to buttons etc meaning there must be another config file interfering with the controls.

The solution I found was to edit the dgenrc file in the same /configs/all directory and to comment out all of the key_pad1 lines.

Hopefully this will help someone fulfil their retro dreams :D

mohamnag
Posts: 1
Joined: Wed Mar 19, 2014 2:14 pm

Re: RetroPie Keyboard and Controller Issue

Sun May 25, 2014 4:07 pm

yes even after a looooong time this is an issue. even removing the lines in dgenrc did not help.

LAGosaurusRex
Posts: 1
Joined: Thu May 29, 2014 11:26 am

Re: RetroPie Keyboard and Controller Issue

Thu May 29, 2014 11:32 am

napoleon.starer answered this post forever ago and it seems like no one listened to him. Though, his command was a little off; instead of

Code: Select all

/home/pi/RetroPie/emulators/RetroArch/tools/./retroarch-joyconfig –p 2 –j 1>> /home/pi/RetroPie/configs/all/retroarch.cfg


Which didn't work for me because there isn't a /tools/ file. Instead, I used:

Code: Select all

./bin/retroarch-joyconfig >> /home/pi/RetroPie/configs/all/retroarch.cfg
Now I have no issues and my controllers dpad keys control as they should.

mimotoalpina
Posts: 3
Joined: Thu Dec 11, 2014 9:50 pm

Re: RetroPie Keyboard and Controller Issue

Sat Jan 31, 2015 2:41 pm

Hi there, let's see if I can make myself understand.

We have the same problem as the first post: both the controller and the keyboard work in single player mode but if we want to play simulteanously the keyboard controls both players.

I've tried to use the commands suggested with the new file structure:

Code: Select all

cd /opt/retropie/emulators/RetroArch/installdir/bin
sudo ./retroarch-joyconfig -p2 -j 1 >> /opt/retropie/configs/all/retroarch.ccfg
But I get "Couldn't find joystick #1"

I've tried -j 2 too. Any ideas?

Thank you

fluxb0x
Posts: 2
Joined: Fri Feb 20, 2015 6:31 pm

Re: RetroPie Keyboard and Controller Issue

Sat Feb 21, 2015 8:50 pm

Same issue here !! I have a fresh install of RetroPie on my raspberry pi2 and can't play with my keyboard and my usb controller at the same time, they both control the player 1.

First I have tried a game without my usb controller plugged in and I found a very strange thing. The start input is set to enter on the keyboard but when I play a SNES game, the start input is set to space. The escape input is working great. I have also enable the input_menu_toggle = f1 and in the game the F1 does not work at all.

I think the emulator does not read this /opt/retropie/configs/all/retroarch.cfg file. I try to find the configuration file used without success.

Any idea ?

Please we need some help here !

fluxb0x
Posts: 2
Joined: Fri Feb 20, 2015 6:31 pm

Re: RetroPie Keyboard and Controller Issue

Mon Feb 23, 2015 12:29 pm

@david2012

Which SNES emulators did you installed ? Did you use the binaries or sources installation ?

mheyman
Posts: 7
Joined: Sun May 31, 2015 5:44 am

Re: RetroPie Keyboard and Controller Issue

Fri Jun 05, 2015 6:46 am

Has anyone figured this out?

When I have a keyboard and an Xbox One controller plugged in, both seem to only control player one. No one controls player 2.

I'm running RetroPie 3.0 on a Raspberry Pie 2.

Cannikin
Posts: 1
Joined: Sun May 29, 2016 6:38 am

Re: RetroPie Keyboard and Controller Issue

Sun May 29, 2016 6:43 am

I think I found a solution! I wanted keyboard to be player 1 and joypad to be player 2. After both were set up from the Configure Input menu, I added these to /opt/retropie/configs/all/retroarch.cfg:

Code: Select all

input_player1_joypad_index = -1
input_player2_joypad_index = 0
I saw some other config somewhere mention a -1, unrelated to this same problem, so I figured I'd give it a shot and see what happened. It worked like a charm!

Hope this saves someone else some pain and suffering. :)

Mcbublick
Posts: 4
Joined: Mon Oct 24, 2016 5:58 pm

Re: RetroPie Keyboard and Controller Issue

Sat Nov 19, 2016 11:47 am

-1
for the first
0
for the second

Worked for me as well
Thank You !

Return to “Gaming”