The technique in all the tutorials, using:
retroarch-joyconfig -o ~/RetroPie/config/all/retroarch.cfg
–never worked for me.
The only thing I’ve found that works reliably is running retroarch-joyconfig without the write-to-file feature. It’ll run you through the list of buttons. Press them as they come up. There will be more buttons than you have. For the extra ones, hit any button. At the end, it’ll spit out a long list of numerical values. Write these down (pencil and paper).
Then you need to open up ~/RetroPie/config/all/retroarch in a GUI text editor. You can do this on the pi by plugging in a keyboard, hitting F4, then typing:
Open the file manager and browse to the file.
plug the sd card into a card reader on another computer. Same deal. Browse to the file.
Under the joypad input section, it’ll give you the option to enter in numerical values for all the buttons a controller might have. Get rid of the “#” from all the buttons you have on your controller, then enter the corrosponding numerical value you wrote down on paper.
For a second controller, copy + paste the whole thing right after it, but change the “player1” part of each line to “player2”.
I hope this helps you both.