I know this has been discussed before but I and having problems exiting from the emulators using the controller. I have followed a setup video on youtube and all worked well. I am using a joystick and buttons with a usb interface. Configuring the controller I setup 3 buttons and 2 additional buttons for start and select. I done jstest and buttons 0,1,2 come on when pressed (game buttons), pressing the start button No. 8 comes on and select is No.9. All seems OK.
I went the the retroarch config file and added the 2 lines for a hotkey.
I lost my hotkeys for some reason as well and went into the RetroArch settings on the main menu of the RetroPie. I think it was called RGUI. In the controls if you dig around you can see your hotkey settings and can press the button to reset them to whatever you want. I tried fixing the file as well and couldn’t get it to work but this was way easier once I looked around.
Hopefully that helps.