First of all, I've already tried to come up (without success) to do something similar to aid AngerFist's project (run 8~9 FCEUX with predefined ROMs in one click and control all emulators through 1 app / keyboard). Inactive forum thread
here.
The difficulties I had were:
- if the emulator uses
DirectInput, you need to use background input, otherwise they only process input if they are focused (the window itself).
- multiple emulators / games will decrease performance, which leads to desynchronization. (
Wiki: DesyncHelp)
- losing the unique features of emulators because of input driven solution (bye TASEditor)
1. Communicating with the emulators
The probably fastest method as feos suggested was linked in that thread: using IPC
http://en.wikipedia.org/wiki/Inter-process_communication.
There's a LUA WinApi
http://github.com/stevedonovan/winapi with a few examples on making asynchronous NamedPipes.
This way you could communicate in a server (your program) - clients (the emulators) network. Also note that many emulators supports LUA scripting and you can rely on others like TCP.
However, performance is a must and I would suggest using
ØMQ with many
language bindings and you should have freedom in creating network communication.
2. Initial setup
- You need to launch the N (number of) emulators using parameters to open ROM and movie (winapi.spawn_process() @ LUA WinApi)
- You need to check every client finished and no errors happened
- Rewind to last finished position. Refer to
http://www.fceux.com/web/help/fceux.html?LuaScripting.html for example.
The communication is up to you, I used a client.lua script on the emulators with predefined functions for example, to restart emulator when it's crashed or something bad happened.