How about running p1 and p2s buttons (5,6,7) to p3 and p4 (2,3,4) in parallel but having a switch control the ground, basically you would flip a switch and it would "give" the buttons to p3&4.
I don't really know if that made any sense but I've done the same thing on my CP, but using 2 joysticks and switching between them.
Basically its more of just a config in MAME.
A switched ground is also really good to keep little kids from actually pressing any buttons when "playing" next to you.