6t8k / inp2json

Convert MAME INP files to JSON
GNU General Public License v3.0
0 stars 1 forks source link

Support for dkong (was: "Seems to work with other games") #1

Closed mrchrisster closed 3 years ago

mrchrisster commented 3 years ago

Thanks for the script, this is exactly what I was looking for. This is not really an issue, more of a suggestion. I just replaced "nemesis" with "dkong" and converted my dkong inp file, worked great! Instead of throwing an unsupported message, maybe it could "attempt" to convert?

6t8k commented 3 years ago

Hi, glad you're finding the script useful :)

The ckeck that throws the "Unsupported game" message has a good reason: the input mapping differs between games. As indicated in README.md, to add support for another game, it's necessary to look up the corresponding input mapping in the MAME source and add it to BUTTONS in line with the existing "nemesis" entry. Otherwise, generally, the output will not be correct - in this particular case, for "nemesis", JOYSTICK_LEFT is mapped to 0x01, while for "dkong", JOYSTICK_RIGHT is mapped to 0x01, so LEFT and RIGHT will be swapped in the output. The mapping for "dkong" is found here.

In case a game that support is to be added for has identical input mapping to another, already supported game, adding a corresponding tuple to BUTTONS_ALIAS is sufficient (as is already done for "gradius"->"nemesis").

6t8k commented 3 years ago

b26b213 adds support for "dkong".

Prospectively, it would be preferable to make the need to reproduce the input mappings as part of inp2json obsolete by automatically collecting the necessary data from MAME.