There are a lot of good turn-based RPGs for the SNES. Most of the gameplay consists of selecting things from menus (attack, magic, use item, defend, etc.). Whenever I play one of these on an emulator, I always think of how nice it would be to just click a menu selection with a mouse instead of pressing down, down, right, right, A on a dpad controller. Now with emulators being viable on more mobile devices, I think this even more when doing this with an onscreen virtual dpad or tiny thumb keyboard.
I'm thinking of developing a scriptable interface that would translate mouse clicks to simulated dpad presses. Any given game would need a custom script to support it.
I'm thinking Lua for the scripting language, since it's small and easy to embed (just a handful of C files to include with the project) and I've always found the C-to-Lua glue to be pretty clean to implement.
The interface would provide functions through which the script could determine which menu (if any) is currently active, and where the selection cursor is. This could be done via a couple different methods. Either by directly referencing memory in the SNES memory space (if the scripter knew which memory locations held variables for menu states), or by scanning the SNES display buffer for reference images (with masks) that would be included with the script. The reference images would be things like menu borders and selection cursors.
The interface would also provide, of course, functions to simulate dpad presses.
Developing a script for a game would be a somewhat complex process that would likely involve a fair amount of trial and error. I think after someone had done a couple, though, they would get a process down.
I think Snes9x would be the best place for me to try this, since it appears to be the most solid, portable, open-source SNES emulator available. I haven't done a lot of emulator hacking (mostly just a few MAME modifications), but I have a pretty solid understanding of how they work and how they're generally structured.
Should I try to tackle this, my questions for the dev community here are:
- Do you think users would have any interest in this, assuming it worked well and the games they wanted to play were supported?
- Do you think the more technical users and/or developers would write scripts for games?
- Do you anticipate any insurmountable issues I might encounter that would simply prevent this concept from working?
- Would someone already more familiar with the Snes9x codebase be willing to answer a few questions, and point me in the right direction for where I'd need to add hooks, access buffers, etc.? I could manage without the help, but it always goes much faster if someone can answer things directly. I'd also host the codebase on a public repository (e.g., SourceForge), so if anyone else wanted to contribute, that'd be great.