#1149
petrockblog
Keymaster

I am thinking about two ways right now:

Software approach: You can configure RetroArch such that it uses a combination of a hotkey together with a certain button of the game pad the exit the emulator. There is an entry in the wiki about that at https://github.com/retropie/RetroPie-Setup/wiki/Does-anybody-know-if-there%27s-a-way-to-edit-the-retroarch.cfg-to-give-me-the-ability-to-exit-an-emulator-by-using-the-controller%3F. I have not tried that on my own yet, but I would be curious to know if it works as intended!

Hardware approach: You could attach a momentary push button to one of the GPIO pins, just as the RetroPie GPIO adapter does. You could then poll the state of the button, e.g., with SNESDev (https://github.com/petrockblog/SNESDev-RPi) and perform certain action, when certain events have happened. SNESDev has implemented a three state automaton with this functionality:

• press and hold: send “r” key (for rewind function of RetroArch)
• press and release three times: send “ESC”
• press and release five times: shutdown

I hope that helps!?