I see what you're saying. It's pretty impractical, though, because MAME takes so long to load. You'd have to load MAME once to get your control mappings, then load it again to run a game!
Hmm.. good point. Then how about a MAME executable that had all it's innards ripped out and was simply a stub used only to print out the key mappings? It would be cross platform AND quick, no?
Also, the key mappings are exactly the same within the same MAME version, so they can be cached. You run a process once in the beginning and you could have a whole database of key mappings ready to go! Or if you didn't want to run the whole thing at once, whenever you run for that particular game you cache it! MAME has a --version switch already, doesn't it?
Then what would you do with the control mappings once they were sent to stdout? Display plain text, or create a nice picture like CPViewer et al do?
What would you do? Anything you want! If they were output in a standard format, similar even to the old-style ctrlr.ini files:
^\s*(P{1,2,3,4}_BUTTON{1,2,3,4,5,6,7,8})\s+(KEYCODE_A\s+[\||\&]\s+KEYCODE_B)\s*$
(my regex is a little rusty, but you get the idea)
...You could use them in a FE, CP viewer, anything! When a program builds a gamelist, it could very easily run this program to figure out the key mappings for each game. Sure it would take a while, but it only needs to be done once! Compared to the several hours (sometimes days) required to set up an entire front-end, this is a very minor step.
If you're going to patch the executable, you might as well go whole hog and put in the display code.
True, as long as there were still just a way to JUST extract the key mappings. Remember, ideally you want this to be universal, or compartmentalized, in order to extend the functionality as much as possible. The less work that needs to be duplicated, the faster new programs with new functionality could be developed.
Would your patched MAME executable be able to display a static image (like a CP mapping for you NES list that doesn't change every game)?
As far as having a separate viewer from the MAME executable, I'm working on unifying the whole display thing into one patch. That way it should be cross-platform compatible for the DOS and Linux people.
That's a great idea! I think that the work you're doing is sorely needed. Keep up the great work!
-Steve