If I remember, you can make xpadder config working only if a selected application is active, lot of options in this application.
You can too use a script to load your Xpadder config, load the emul and close automaticlly xpadder after the emulator close.
Or you can edit this autoit script
Local $joy,$coord,$h,$s,$msg
$joy = _JoyInit()
If $CmdLine[0] == 1 Then
Run ( '"snes9x.exe" -fullscreen "' & $CmdLine[1] & '"' )
$coord=_GetJoy($joy,0)
While $coord[7] <> 1
$coord=_GetJoy($joy,0)
Sleep(500)
WEnd
WinClose ( "Snes9X")
$lpJoy=0 ; Joyclose
EndIf
exit 0
;======================================
; _JoyInit()
;======================================
Func _JoyInit()
Local $joy
Global $JOYINFOEX_struct = "dword[13]"
$joy=DllStructCreate($JOYINFOEX_struct)
if @error Then Return 0
DllStructSetData($joy, 1, DllStructGetSize($joy), 1);dwSize = sizeof(struct)
DllStructSetData($joy, 1, 255, 2) ;dwFlags = GetAll
return $joy
EndFunc
;======================================
; _GetJoy($lpJoy,$iJoy)
; $lpJoy Return from _JoyInit()
; $iJoy Joystick # 0-15
; Return Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV
; Buttons down
;
; *POV This is a digital game pad, not analog joystick
; 65535 = Not pressed
; 0 = U
; 4500 = UR
; 9000 = R
; Goes around clockwise increasing 4500 for each position
;======================================
Func _GetJoy($lpJoy,$iJoy)
Local $coor,$ret
Dim $coor[8]
DllCall("Winmm.dll","int","joyGetPosEx", _
"int",$iJoy, _
"ptr",DllStructGetPtr($lpJoy))
if Not @error Then
$coor[0] = DllStructGetData($lpJoy,1,3)
$coor[1] = DllStructGetData($lpJoy,1,4)
$coor[2] = DllStructGetData($lpJoy,1,5)
$coor[3] = DllStructGetData($lpJoy,1,6)
$coor[4] = DllStructGetData($lpJoy,1,7)
$coor[5] = DllStructGetData($lpJoy,1,8)
$coor[6] = DllStructGetData($lpJoy,1,11)
$coor[7] = DllStructGetData($lpJoy,1,9)
EndIf
return $coor
EndFunc
This code can close snes with the bouton 7.
I m 100/100 agree with you, Using xpadder is really binding, And I need often to remake a config because I forget to close it before making the setting.
But there is too much emuls without possible escape key, The easiest way for me is to use this application and use the same boutton on ALL emuls to quit, to avoid conflict. For the emulator, seeing first the emulate escape key or the boutton X is same for it, if the 2 controls do the same thing.