It is currently Wed May 22, 2013 5:41 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Sep 20, 2011 9:15 pm 
Offline
Snes9x White Belt

Joined: Tue Sep 20, 2011 3:09 am
Posts: 3
(tl;dr overview in bold)

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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2011 10:42 pm 
Offline
Hero of Hyrule | Official Port Recruiter

Joined: Mon May 24, 2004 5:06 pm
Posts: 2490
Location: 255.255.255.255
I think it's a good idea, but consider this:

* where are you gonna have the buffers to scroll your mouse/device through the menus (eg, the spell/item you want is on page 2 or 3 or a bit further down the list, or something)?
* what about selecting change/parry in final fantasy games?
* in the case of FF2/4, how about equipping items in battle?

_________________
Image

Unofficial Test Monkey For:
* Snes9X GX (Wii)
* Snes9X EX (Android)
* Snes9X 64-bits

ZSNES|Ben Heck|NSRT|Bob Smiley


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2011 11:09 pm 
Offline
Snes9x White Belt

Joined: Tue Sep 20, 2011 3:09 am
Posts: 3
adventure_of_link wrote:
I think it's a good idea, but consider this:

* where are you gonna have the buffers to scroll your mouse/device through the menus (eg, the spell/item you want is on page 2 or 3 or a bit further down the list, or something)?
* what about selecting change/parry in final fantasy games?
* in the case of FF2/4, how about equipping items in battle?

Good point! I hadn't thought of these.

The scripting interface will need to provide functions to add auxiliary GUI elements to the screen (I'd think buttons would generally do the job) for things like page up/down, change, equip, etc.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2011 12:08 pm 
Offline
Official Win32 Porter/Dev
User avatar

Joined: Thu Aug 30, 2007 10:15 pm
Posts: 450
You might want to take a look at snes9x-rr, which already implemented lua scripting (albeit for TASing purposes).
AFAIK it's currently only up to v1.52, but it might be a good reference.
If you don't already know: the main snes9x repository is here.

As for questions and help: simply post them here, I'm sure we can help you out.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2011 4:19 pm 
Offline
Snes9x White Belt

Joined: Tue Sep 20, 2011 3:09 am
Posts: 3
OV2 wrote:
You might want to take a look at snes9x-rr, which already implemented lua scripting (albeit for TASing purposes).
AFAIK it's currently only up to v1.52, but it might be a good reference.
If you don't already know: the main snes9x repository is here.

As for questions and help: simply post them here, I'm sure we can help you out.

Cool, taking a look at snes9x-rr. That'll be a great starting reference, since it's binding some of the same things I will (memory reads, joypad setting, etc.).

Nope, I wasn't aware of the github repo. I've been building from the tar on ipher's site.

I'll be back here with any questions or problems I run into. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group