Which version of retropie are you using? You’ll need to run the controller that doesn’t work through retroarch-joyconfig (if youre using retropie 3.0 it is an option in the retropie menu) and it will create an autoconfig file that should work with retroarch emulators. There will be some separate configurations that might need to be done manually for some emulators but retroarch covers for most of them.
See this page:
And this video: