This is commonly done with virtual pinball machines and I know of several examples in vp forums on how to build something yourself or you can buy a solution from places such as zebsboards.com. FYI, He is out until end of July, so his store isn't running atm, but his forums are UP which also have some good wiring diagrams for all sorts of efforts. I have several components from him as I wanted to focus more on building the cabinet than building the boards I needed for lights and other toys (solenoids, replay knocker, shaker motor etc) that will be a part of my machine.
Sent from my iPad.