Most of what you need should be outlined here: https://github.com/retropie/retropie-setup/wiki/retroarch-configuration
It goes over controls and talks about the defaults. Look for the video Tutorial links. There is one on testing joysticks that shows haoe to test joypads and get button numbers. they are done better than I can explain in words.