In order to make all my emulators cab friendly, I was thinking of writing a script to help remap some keys. Like I think I have the Load button on my cab set to the letter L. For one emulator, the load command might be something like Ctrl+L (not remappable) for example. For another emulator it might be something like F1. So what I need to do is change the L key press into something else, determined by what emulator is in focus. Now for all emulators, I was able to map my controls, obviously, but the admin buttons are not so easy (Exit, Reset, Pause, Config, Save, and Load)
So what I think my script will need to do is this:
Determine what emulator is currently running and currently in focus.
Remap the keys to the appropriate key presses for that particular emulator.
Poll every say 5 seconds (is that overkill?) to see what emulator is currently running at that time.
I wish all emulators were as flexible as MAME where you can define controls for EVERYTHING! But sadly, we are not so lucky...
Now, I found a few links out there on how to tell what Window is in focus. And I've also found some links for how to remap key presses. So I am not looking for information on how to script those per say. I guess I just have a few questions.
Has anyone done something similar in the past? It seems like anyone who has multiple emulators, beyond MAME, would run into this same problem. How have others solved it? Or if you've written a script for yourself to do something similar, do you think you could provide me with it so that I have somewhere to start?
Do you think having a script running and checking for what emulator is running, like every 5 seconds, would affect the performance of the computer? It seems like it'd be a simple script for the computer, and wouldn't take up a lot of processor, but I thought I'd ask to see what others thought. Perhaps one of these scripting languages would have a "WhenWindowInFocusChanges" type event that I could use instead of polling every 5 seconds. I haven't gotten to look into this too in depth yet. I thought I would check to see what others have done. No need to start from scratch if I don't have to!
Thanks!