This code works, but with a small flaw when you launch a game immediately after it returns to attract mode, but with the game still open, then when you click the exit button the game closes, but while the game is running attract mode continues work below, I don't know if I have explained myself well, does it do it to you too?
wait_for_ESC.exe#include <Misc.au3>
While 1
If _IsPressed ("1B") Then
ProcessClose("OpenBOR.exe")
;MsgBox(0, '', "Button pushed")
Exit
EndIf
WEnd
> OpenBOR
executable cmd
args /c cd C:\attract\EMU\OpenBOR\[name] & start OpenBOR.exe & start C:\attract\EMU\OpenBOR\wait_for_ESC.exe
rompath C:\attract\EMU\OpenBOR
romext <DIR>
system Arcade
info_source thegamesdb.net
nb_mode_wait 3
exit_hotkey Escape
NOTE: ESC-Key of AM doesn't work. So you need an external program like an autoit-script. Create wait_for_ESC.au3 and compile this sourcecode to .exe: