First of all if you are using an image file when you first start emulation station and set up your button config that's what you get. All are set up (for the most part) correctly. For each system. Except for advmame or pi-mame.
These can be set up as follows:
1. load a game
2. Press TAB
3. Input general
4. Set up the controller the way you want it
Doing this will affect ALL games
For individual games:
1. load a game
2. Press TAB
3. Input for this game
4. Set up the controller the way you want it
This will set up the controls for the current running game ONLY
As for any retroarch cores you have to bring up the retroarch gui and configure from there.
Remember the "default" layout for setting up your controller is a Super Nintendo D-pad. Thus when the configuration says press the "X button" it does not mean YOUR X button it means the button you want X to be.
https://github.com/retropie/RetroPie-Setup/wiki/RetroArch-ConfigurationWhen I setup my Genesis 6-button controller I set it up wrong the first time. If you look at the wiki above and set your controller to what the have it works fine. I have never seen an X-Pad controller. What is the EXACT game pad are you using? I might be able to map them out correctly for you.
Also Understand this is NOT an Attract Mode Problem and has
everything to do with RetroPie itself. Check the retropie forum as they may have some better information for you.