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

    How can I control 2 players with one keyboard (RetroArch)?

    Scheduled Pinned Locked Moved Help and Support
    40 Posts 6 Posters 27.9k 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.
    • TheStrayMongrelT
      TheStrayMongrel @meleu
      last edited by

      @meleu Yeah thats right, 2 joysticks and 6 buttons for each player. No ipac, running directly to the GPIO with the Adafruit keyboard utility converting button presses (https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons). They button presses are definitely registering as I've got it set up and working well in mame4all. I also have Neo Geo working okay with the 2 players.

      Remember trying to config retroarch and coming up against "gamepad A, gamepad B" etc... but not being able to map specific keyboard strokes ah la mame4alls tab menu, which was a stumbling block (probably need to look further into this really).

      @rbaker thinking about it i dont really have any of the other libretro emulators working as such (cant recall if Neo Geo is or not?), just mame4all.

      So thinking of workarounds last night and Im guessing that the way to go is to ditch my control system for mame4all, and get retroarch working, then reconfigure mame4all as allocating buttons in that is really easy. But i guess a question is that within Retroarch the config of how to get "gamepad 2 button a, or gampad 1 button c" (sorry thats probably not the exact syntax, cant recall exactly) to match up with my my mapped keyboard presses.

      Thanks for your help guys.

      btw, went through the keyboard config when i first started up Retropie and all worked fine.

      1 Reply Last reply Reply Quote 0
      • TheStrayMongrelT
        TheStrayMongrel
        last edited by

        @rbaker Dont have my config file handy but its very similar to the one you posted in this thread.

        https://retropie.org.uk/forum/topic/1914/has-anyone-got-a-keyboard-working-for-player-2-in-pifba/2

        [Keyboard]
        #Get codes from /usr/include/SDL/SDL_keysym.h
        A_1=306
        B_1=32
        X_1=308
        Y_1=120
        L_1=122
        R_1=304
        START_1=49
        SELECT_1=53
        LEFT_1=276
        RIGHT_1=275
        UP_1=273
        DOWN_1=274
        QUIT=27
        #player 2 keyboard controls, disabled by default
        A_2=97
        B_2=115
        X_2=113
        Y_2=107
        L_2=105
        R_2=119
        START_2=114
        SELECT_2=102
        LEFT_2=100
        RIGHT_2=103
        UP_2=114
        DOWN_2=102

        meleuM rbakerR 2 Replies Last reply Reply Quote 0
        • meleuM
          meleu @TheStrayMongrel
          last edited by

          @TheStrayMongrel are you using pifba or the libretro fba?
          I thought you were using the libretro one.

          For pifba you need the to reinstall from source, as mentioned on the thread you linked.

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

            Sorry yeah i am using Libretro, the games i want to get going dont work on piFBA. Sorry getting myself a little tied in knots here, that config i just posted is for piFBA isnt it.
            edit: lr-fba-next to be exact.

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

              @TheStrayMongrel the fba2x.cfg is for pifba only.

              @rbaker said that RetroArch already works with one keyboard for 2 players. I never tried it but I think it's perfectly doable (I'm away from my raspi now to make some tests).

              Is your problem with fba only? Can you play SNES games with 2 players, for example?

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

                Yeah @meleu thats right, @rbaker did say that, thats why i cant work out why its not working... and if i've done something screwy with the config.

                I did try Donkey Kong Country last night briefly and 2 player wasnt working on that... so guessing no. Not tested any further than that though as Mame is where i concentrate most of my time.

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

                  @TheStrayMongrel I asked that to suggest you to change the title of this thread.
                  Maybe "how can I control 2 players with one keyboard (RetroArch)?" fits better.

                  I'm at work now and can't help you at this very moment, sorry. But with a more descriptive title, maybe someone else can give a look here. It shouldn't be that much complicated.

                  • Useful topics
                  • joystick-selection tool
                  • rpie-art tool
                  • achievements I made
                  TheStrayMongrelT 2 Replies Last reply Reply Quote 0
                  • TheStrayMongrelT
                    TheStrayMongrel @meleu
                    last edited by

                    @meleu Yeah no worries, I'm at work too so thats fine. Thanks for the help. Will look to change the title now.

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

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • meleuM
                        meleu @TheStrayMongrel
                        last edited by

                        @TheStrayMongrel go to the first post of the thread and edit it.

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

                          @TheStrayMongrel It's your retroarch config that will determine the correct settings for your libretro emulations. Here is the section from mine that has 2 player working in all emulators. It is set up for a neo-geo control panel.

                          input_player1_a = "alt"
                          input_player1_b = "ctrl"
                          input_player1_y = "space"
                          input_player1_x = "x"
                          input_player1_start = "num1"
                          input_player1_select = "num5"
                          input_player1_l = null
                          input_player1_r = null
                          input_player1_left = "left"
                          input_player1_right = "right"
                          input_player1_up = "up"
                          input_player1_down = "down"
                          
                          input_player2_a = "s"
                          input_player2_b = "a"
                          input_player2_y = "q"
                          input_player2_x = "k"
                          input_player2_start = "num2"
                          input_player2_select = "num6"
                          input_player2_l = null
                          input_player2_r = null
                          input_player2_left = "d"
                          input_player2_right = "g"
                          input_player2_up = "r"
                          input_player2_down = "f"
                          

                          any changes to fba2x.cfg will do nothing as @meleu said. You must edit retroarch.cfg

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

                            @TheStrayMongrel
                            @rbaker said in How can I control 2 players with one keyboard (RetroArch)?:

                            You must edit retroarch.cfg

                            He meant /opt/retropie/configs/all/retroarch.cfg. ;-)

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

                              Thanks @rbaker. The plot thickens though, everything in my retroarch.cfg looks in order. Here is a screen grab of my key allocations and the retroarch.cfg. As mentioned they keys work fine in mame4all so its not like the arcade button pressers arent registering as keyboard strokes. Any other ideas?

                              dankcushionsD 1 Reply Last reply Reply Quote 0
                              • dankcushionsD
                                dankcushions Global Moderator @TheStrayMongrel
                                last edited by

                                @TheStrayMongrel said in How can I control 2 players with one keyboard (RetroArch)?:

                                Thanks @rbaker. The plot thickens though, everything in my retroarch.cfg looks in order. Here is a screen grab of my key allocations and the retroarch.cfg. As mentioned they keys work fine in mame4all so its not like the arcade button pressers arent registering as keyboard strokes. Any other ideas?

                                wrong quote symbols on at least one. all quotes in retroarch.cfg should be "" not the slanty kind. that single one is probably making it ignore the rest of the .cfg. hopefully that's the problem :)

                                TheStrayMongrelT 1 Reply Last reply Reply Quote 1
                                • TheStrayMongrelT
                                  TheStrayMongrel @dankcushions
                                  last edited by

                                  @dankcushions Thanks for that. Just checked in a shell and the quotes on the "a" are consisant with the rest, must have just been a characteristic of me editing the file in filezilla. Here is a screen grab of it again in the terminal. Bugger, i was really hoping it was that.

                                  rbakerR 1 Reply Last reply Reply Quote 0
                                  • rbakerR
                                    rbaker @TheStrayMongrel
                                    last edited by

                                    @TheStrayMongrel You said earlier that you were using an adafruit utility. I am not familiar with it. Does a normal keyboard work in two player?

                                    Do this with a single keyboard connected:

                                    1, Clean install, Plug a keyboard in and boot the lot up.
                                    2, Configure the Keyboard using autodetect.
                                    3, Edit retroarch.cfg with all your player 1 and 2 choices, hotkeys etc.

                                    This will prove that you have two player functionality with a keyboard. I have just tried it and it works. It's how I configured my ipac2. Once you have proved it, you can then start using your adafruit package. In my case, I then used the ipac2 after configuration in this way. The key for me was to establish full keyboard functionality for two players first then simply replace it with an encoder.

                                    If it fails after the keyboard has worked, the adafruit is to blame.

                                    1 Reply Last reply Reply Quote 0
                                    • TheStrayMongrelT
                                      TheStrayMongrel
                                      last edited by

                                      Okay so @rbaker, tried what you suggested and did a fresh install, configured the keyboard and then added 2 player controls through the retroarch.cfg... but nothing. I have actually always been running @Floob 's attract mode disk image so i guess I have to consider that a variable and the possibility that something broke (in regards to the config I'm trying to get running) when that was being created... very long shot i know with him being a guru and all.
                                      Just downloading the 4.0 image and will see how that goes with the same procedure.

                                      rbakerR 1 Reply Last reply Reply Quote 0
                                      • rbakerR
                                        rbaker @TheStrayMongrel
                                        last edited by rbaker

                                        @TheStrayMongrel I would say that it the problem. I believe that attract mode was an experimental build. You should use the fully updated version. I reckon if you had revealed that at the start, you would be up and running now. You = Adafruit + Attract Mode Build. Me = Ipac + Version 3.8.1

                                        One final thought, have you checked that your config edits are actually being saved?

                                        1 Reply Last reply Reply Quote 0
                                        • TheStrayMongrelT
                                          TheStrayMongrel
                                          last edited by

                                          @rbaker Unfortunately not, just tried it on a brand spanking new 4.0 image. Install/allocate keys/retroarch.cfg config/setup wifi/transfer 2 games (using lr-fba-next)/reboot... 1 player works fine but nothing on 2... ahhh. Your suggestion really has broken it down to the most basic of fundamentals in regards to troubleshooting the issue... racking my brain to think of what else it might be.

                                          rbakerR dankcushionsD 3 Replies Last reply Reply Quote 0
                                          • rbakerR
                                            rbaker @TheStrayMongrel
                                            last edited by

                                            @TheStrayMongrel I am out of ideas now. For me, you plug in a keyboard and it is detected. It allows you to configure player 1 only. You then edit the config to add the "extra" keys you desire for player 2. You save and then you must reboot for the changes to take effect. You then have the most basic form of two player controls. I cannot think what you must be doing that is different to me. Is your syntax correct etc?

                                            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.