> > I've been posting for a while now making vague allusions to the frontend that I am > > working on. Well I've made a few videos showing my progress for anyone who is > > interested. Keep in mind that it's very rough and very early, but it will give some > > idea of some of the effects that I am going for. > > Since no-one else has responded. I think its cool that you've persisted with this. I > had the idea of doing something similar (sending the composited video frames over > IPC) about a decade ago but never got around to it (much like most of the other crazy > ideas I had: hooking Continental Circus up to me stereoscopic glasses, abstracting > the force-feedback, implementing the native networking over shmem or possibly > sockets). > > Btw, Glmame / Xmame (Sven Goethel) had a similar visualisation a long time ago (a > rendered cab with the game running on it), although that was all in the same process.
Yeah I originally had MAME linked into the same process also but that caused some problems:
- MAME has *alot* of very complex code in it and unfortunately, it crashes sometimes. Especially when you are abusing it like I am (starting and stopping games constantly). I also am not convinced that some drivers don't leak memory in some situations, and the shutdown path is not always that robust. The upshot is that when I was running MAME in the same process (separate thread), it was not uncommon for the frontend to crash.
- It is not possible to run multiple copies of MAME at once in the same process because of the globals that MAME uses; running MAME in separate processes solves this nicely.
So what I did was to move MAME out into a separate process, using a shared memory IPC mechanism; I use "no lock" IPC (compare and swap instructions and memory barriers) with rapid polling (every 1/2 millisecond - uses like 0.3% of a CPU) to ensure that the MAME process cannot screw up the frontend (i.e. grabbing a lock and then dying/hanging) under any circumstances. It works so well that I can sit there and fork off copies of MAME all day long and no matter what happens to them, the frontend is undisturbed.
The video and sound frames are pushed through the shared memory segment like you'd expect. I have instrumentation that can measure the latency this introduces and it's generally not perceptible - about 1/4 millisecond on average, just what you'd expect with a 1/2 millisecond polling interval.
|