Weird. I tried this a while back and it didn't work. I was using my typical Logitech F310 and a Rock Candy Wired controller. (Granted that the rock candy controller would disconnect if you sneezed on it.) They didn't work together.
This is highly dependant on the game - some games support 2 player consecutively (like Pac-Man or Super Mario Bros), others support 2 players simultaneously (like the Street Fighter games). It's not something that can be configured in the emulator.
If you have just one gamepad (joystick + buttons) but the game expects 2 players, then you can't change it - the 2nd pair of controls would insert the coin (Select) and also use Start to enter the game.
I found the problem. Mame seems to define a controller + a keyboard as possible inputs. Since my controller is a device that is mapped through RetroPad the event gets fired twice: once through the keyboard emulation and once through RetroPad. If the mapping is even different in the retroarch.cfg in can cause some strange events overlapping each other.
Solution: I changed the MAME input configuration to only receive one input (RetroPad). That solved it :)
If you require 2 players with joystick and up to 8 buttons on each control (equivalent to SNES controller) you could hook up directly to the gpio using mkarcadejoystick module that is in the drivers in Retropie.
@tonythetiger not everyone knows the answer to everything and a lot of times people dont provide enough info for anyone to help. All help here is done in peoples free time and with how many posts get posted in a day some posts can get lost at the bottom of the pile. It would be cool if you posted your solution to be able to help others who have this same problem.
After doing more reasurch I found that my problem is that I need to configure my second player for PiFBA.
This is true and once again, if you read the guide it will tell you how and with what file. Please do not ask any further questions until you have read https://retropie.org.uk/forum/topic/3/read-this-first. It is obvious that you have ignored it despite it being printed at the top of the page and despite agreeing to it when you signed up.
I was facing the same issue and what solved the problem for me was:
From the main menu of EmulationStation, go in Retropie, then: Configuration Editor, then:
-1 configure basic libretro emulator options
-28 configure additional options for snes
-7 choose Joypad order.
From there, (I don't know why) my setup was (0 0 2 3) so it meant that my second pad was actually a clone of the first. Just change one of the two "0" for a "1", it means that you simply dedicate another Usb joypad instead.