Thanks to LusiD, RandyT, and UrebelScum for help with this.
Here?s the problem: you have wired up your encoder and used all available inputs, but you would like to have ESCAPE and PAUSE on your panel, and you don?t want to have to remember Shift Codes, etc.
The solution - Since a joystick can?t be both Up and Down at the same time, wire a button to both the Up and Down inputs on your encoder/gamepad hack. Now set UI Cancel in MAME to ?both UP and Down?. You now have an Escape button that can?t be activated accidentally.
The same thing can be done for Pause using the Right and Left joystick inputs.
Warnings/Notes: This works for MAME, but won?t work for programs that won?t allow multiple keypresses per input, or assignable inputs.
I don?t recommend doing this for other inputs (especially action inputs) as the player might ?stutter? a little as the inputs are processed. Pause and Escape should be fine, though.
This will only work (realistically) with direct-mode (common-ground) circuits. This means this will work with almost all keyboard encoders, but will not work with many gamepads, although some should be okay.
MAME reads many gamepad UP buttons as J1 Y-axis +. I believe that this will still work with MAME, although I haven?t confirmed it, yet. Also, even if MAME allows it, many gamepads do not allow UP and Down to register at the same time, either through the software driver or the firmware. So this may not work for some gamepads even if MAME allows it.