How to Handle Quit and Pause



This page details a procedure for mapping Pause and Escape to the joystick directionals in MAME.  There are basically three situations in which this could be beneficial: 


This method only works in MAME (R36B12 or newer) (or in programs that allow AND sequences as inputs, e.g. MAME).

This method should be considered a "hardware hack" (and therefore used at one's own risk) because it is not a feature that any encoder maker specifically designed into their products.  I can't see how it would cause problems, but it might.

This method may not work with all versions of a product in the event of firmware differences between products.

This method can not be used with Matrix-Mode encoders.

If it could work with Matrix-Mode encoders, it will not work with Gamepad Hacks because most gamepads disable up and down from registering simultaneously in the firmware.  And even if it could work with keyboard hacks, typically we allow Up and Down to produce ghosting on a keyboard hack to gain additional inputs, so it can't be used here.

The KeyWiz disables simultaneous Up and Down inputs on the P1 Joystick in it's firmware.  The P2 Joystick can be used and P1 Left and Right can be used.  There generally isn't much advantage in using one pair of Joystick directionals over another.

It is possible (and preferable) to use this method in addition to the standard MAME key assignments so that either the control panel or the keyboard can exit MAME.


As a quick verification that this MIGHT work, perform the following test:



Connect both directional inputs to individual buttons.   This schematic shows how to connect the P2 Joystick Up and Down directionals to a single button.  Wiring the other directionals would be similar:

Click the image to enlarge or better yet, right-click and open in a new window, or download and print out the Word or PDF versions, as I will refer to them in the discussion that follows.

The diodes are required so that the encoder still reads the single UP inputs correctly and does not interpret UP as "UP and DOWN" and pauses or ends the game, etc.

The diodes above would be 1N4148 switching diodes (others might work also, but I know these are okay) available from allelectronics for 15 for $1.  RandyT's adapters could be used in place of the diodes, if desired.

Once the wiring is completed, you just have to make the changes to MAME as shown under TESTING (if not previously accomplished.)


This could be expanded to support 3 or 4 inputs per button press, but it's generally not recommended.  (Could be useful for some of the combo moves in fighter games, I suppose).

I can hear the wheels turning.  Someone out there is thinking "Gosh, can't I use this same method with my 10-input encoder and combine all the possible combinations to end up 82 available inputs (10+9+8+...1).  The answer is "In theory yes, but you wouldn't want to".  Here's why:

Lilwolf from BYOAC pointed out the following regarding inputs still registering:  MAME (since R36B13) supports NOT sequences so you can prevent the dual use buttons from affecting your game inputs.   This wouldn't matter for Escape and Pause, who cares if the charater stutters before you quit the game, but could be useful if you were using a combined Up and Down input for Start or some other function.  In this case, the button mapping above would be changed as follows:

START1                           "KEYCODE_1 | KEYCODE_UP KEYCODE_DOWN"