Has anyone yet investigated the idea of pulling the info from the Mame configs for each game? Even if -listinfo has incorrect data, the settings within each game usually has the correct number of buttons and stick directions. That way your database only includes the fields for games that you actually have.
Using the cfg/*.cfg files would be pretty hard; I've seen people (including me) suggest parsing the info out of them even since I learned of mame a year ago, and very little more than talk.
The new ctrlr/*.ini files are
much easier to parse. These new files, however, aren't part of dos mame yet, and the old cfg/*.cfg files are still the files editted (in both win & dos) when the settings are changed in game (for now, at least).
That being said,
the list I submitted earier is as accurate as the cfg/*.cfg files in number of buttons, type(s) of controler(s) used, ect. My list is an easy to read tab delimited text file (vs .cfg binary files), but doesn't include the actual keyboard/joystick input settings. Any errors in my file will also be in cfg/*.cfg files too, because the information was gleaned from the same driver data used to build the cfg/*.cfg files. (And yes, there are errors in both, but not as many is in -listinfo.)
Also, as I mentioned above, when a button is remapped, it could automatically be updated to the right position on the CP graphic.
My 2 cents.
Yes, this is
the reason to use these cfg/*.cfg files. Except two small things: the new ctrlr/*.ini files, and "default" settings.
There is a special input setting, "CODE_DEFAULT", used in the cfg/*.cfg files that basically means "input settings are not saved here, just use the settings already there". As most inputs are marked as "default" in the cfg/*.cfg files, the input data is actually saved in the default.cfg (again, only if not "default"), then ctrlr/*.ini (if specified, win v.60 only), and finially the standard mame settings.
Mame maps the inputs as follows: standard inputs, over written by ctrlr/*.ini files (if referenced to, win v.60 only), over written by
non-default inputs in cfg/default.cfg file, over written by
non-default inputs in cfg/*.cfg file. So to see changes made in a ctrlr/*.ini file ("ctrlr hotrodse" for example, for us hotrod users), the FE will need to be able to read ctrlr/*.ini files. I suggest (for a windows FE, at least) parsing mame.ini for the ctrlr
name setting, that
name folder/zip file, and
gamename.ini for input settings. Much easier to parse because they are
standardized text files. (cfg/*.cfg files are semi-standardized binary files.)
I also think (hope) the old cfg/*.cfg files will be superseeded by ctrlr/*.ini equivalents, and if this is true, any reading of the old cfg files would need to be changed anyway.
The FE will combine the ctrlr data with mame's standard input settings and do the mapping. Adding reading cfg/*.cfg files, IMO, should not be a priority, because who knows if mame.61 will stop using the .cfg file, until it comes out.
BTW: the reason -listinfo says 2way joysticks are 8way is because, to mame, there is no difference. Even if the input is declared as a "2way" joystick in the driver, mame compiles 2ways and 8ways with the same id:
[snip from source]
#define
IPF_8WAY 0#define IPF_4WAY 0x00080000
#define
IPF_2WAY 0