I’m not exactly sure what you mean by switching modes on the iPac 4. I have an older 2009 iPac 4, so maybe things have changed since then. I built a four-player arcade cabinet and mapped each player to unique keys, then added those key mappings into MAME. That setup has worked well for me.
As for getting multiple controllers to work from a single keyboard, I’ve had some success using Keyboard Splitter (
https://github.com/djlastnight/KeyboardSplitterXbox). You can set up four Xbox controllers using one keyboard. Just start Keyboard Splitter, launch your game, and your keyboard will act like four separate controllers.
I used to have a JTAG Xbox 360 loaded with games and Xbox Live Arcade titles on a hard drive. A long time ago, I got the red ring of death, so I just tossed the hard drive in a drawer. Recently, I discovered Xenia Canary along with Xenia Manager, which makes it easy to install and manage everything. I pulled out that old hard drive, and it detected all my games and ran them on my main gaming PC just as well as the original Xbox 360. I was pretty excited, I could play games like Marvel vs. Capcom 2 and 3, and even Street Fighter V.
After that, I found Keyboard Splitter, which helped since Xenia doesn’t really support mapping more than one gamepad easily. But when I tried to move everything over to my MAME machine running Windows 7, it didn’t work out. The software won’t install properly, and even when I get things running, nothing scales correctly on my CRT monitor. At this point, it feels pretty much impossible for me to get PC or Xbox 360 games running the way I want on that cabinet.