For my emulated console games, I use AHK to make the pause pause button on my control panel double as a shift button to alter the meaning of the 1-player start and 2-player start buttons to work as the save and load buttons. So holding down pause + player1 will trigger the emulator's save-state function, and holding down pause + player2 will trigger the emulator's load-state function. This is working for for all of my console emulators.
Since more recent versions of MAME won't work with AHK, and I wasn't aware of MAME's ability to map functions to a combination of key presses, I thought it was impossible to duplicate this in MAME - have the pause + player-start buttons to call save/load. I have just learned that, in general, anything in MAME which allows button remapping can be mapped to a button combination instead of a single button.
While technically this does work for the save and load functions in MAME, the problem is that save & load bring up a prompt for which slot to save-to/load-from, which accepts a single key input. Since you are already holding down two keys, it will pick either "P" (my pause button), or other times "1" (if I'm saving) or "2" (if I'm loading), and then immediately disappears, satisfied that it collected your desired save slot. It also sometimes works the way I want it to: it ignores the two currently-depressed keys, and the prompt stays up, and I can then hit another button to select my save slot.
Does anybody have an idea how I can make save/load ignore the fact that the "p" and "1" (or "2") buttons are being pressed at the time the prompt comes up? I've tried different orders of pressing and depressing the buttons, with different timings between the actions, but nothing reliably gets me to use the select-your-slot prompt.