You can try to reset the input configuration from terminal window, run :

sudo ~/RetroPie-Setup/retropie_setup.sh

Then go:
Manage Packages -> Core Packages -> emulationstation -> Configuration or Configuration / Tools -> emulationstation

and choose to Clear/Reset Emulation Station input configuration.