I can definitely see about moving some of the controls around. When I was testing it, I just had a lot of "wasted space" around the edges, so I figured I could use that for the controls and instructions. I guess I should rethink that.
You're correct that I'm scanning for the save type. Auto-detection is something I want to get in at some point, but I haven't quite gotten around to it yet. I was considering using a database for the save types as well, but I didn't know if such a database existed. I was just planning on pre-computing it by the same way I'm currently detecting it, which as you say has problems.
(I will use 'save-code' to mean the SRAM_V123 strings embedded in ROM images, and 'save-type' to mean the actual non-volatile storage configuration the game expects)
So, there's a couple of ways you can go:
- you can go the full auto-detection path. EEPROM access and size is easy to detect, I think it's fairly reliable to detect SRAM access, but unfortunately you can't dynamically detect Flash configuration - the first question the game asks the hardware is 'which Flash storage protocol do you want' and there's no way for the emulator to figure out how to answer that question ahead of time.
- You can go the full static-detection path, based on scanning for save-codes. This is pointless, because you can't determine whether the game wants 6 or 14-bit EEPROM data, and you still can't determine the Flash storage protocol. Also, there are games that contain two different save-codes but only work with one save-type, and of course there's Top Gun which contains all the different save-codes, but will ignore the A button at the main-menu if it finds any any non-volatile storage present.
- You can go full database-mode. This is what bsnes intends to do eventually, but it's kind of hampered by the fact there is no (known) complete database of save types.
- You can go a hybrid system. VBA does something like this: if the game is listed in vba-over.ini, use that save-type. Otherwise, guess based on the save-code: SRAM is easy, EEPROM starts in an 'unknown size' mode and automatically configures itself as soon as the game pokes at the emulated hardware, Flash picks some reasonable defaults and lets the user change them if they don't work. This obviously gives you really good compatibility but is horribly complicated to build.
The database I have at the moment only contains known-good configuration for the ROM images known to have two-or-more save-codes, plus one or two other games mentioned by users on the bsnes forums. It occurs to me that if you had some kind of UI where users could change the emulated storage configuration until it worked, you could have some kind of 'submit configuration' button, and the database might be built up that way.
You're correct that I'm scanning for the save type. Auto-detection is something I want to get in at some point, but I haven't quite gotten around to it yet. I was considering using a database for the save types as well, but I didn't know if such a database existed. I was just planning on pre-computing it by the same way I'm currently detecting it, which as you say has problems.