MAMEWah Tools

I use MAMEWah as my front-end on my arcade cabinet. It is very customizable and very powerful.

Sometime around release 1.62 it gained the ability to have game-specific settings. With this ability, it is possible to mix games from more than one emulator into a single game list.

Putting arbitrary games into a list isn’t supported via any MAMEWah functionality, per se. But we can make changes to the game lists behind MAMEWah’s back and it will dutifully display the changed lists.

I’ve written three little Perl scripts that I use to manipulate the .lst files that MAMEWah generates in the \mamewah\files directory. I’m providing them here for those who want to do this kind of thing.

Here’s a download link.

Feel free to try these scripts out and send me feedback. But PLEASE BACKUP YOUR .LST LISTFILES BEFORE USING THESE SCRIPTS!!! I can’t guarantee that they will work for all users and all releases of MAMEWah.

filter-mamewah-list.pl

This tool takes a MAMEWah .lst file and filters it against a list of roms given in a separate file. This tool was written to allow the quick recreation of a specific list of games. If you have a list of roms, this tool will filter an emulator-#.lst file such that it only contains the games in that list.

The -unique option will work through a list of games and remove duplicate game names. It works by stripping the game names at the first left parenthesis “(” and using some heuristics to choose among the different like-named game names.

The -duphints option is a helper to the -unique option. It allows you to tell the script which rom to choose for a given gamename. The rom and gamenames are provided by a text file that has lines of the form “Game name=romname”, one per line. This is useful when you’ve played a particular clone of a game and always want the script to choose that particular clone in the future (to preserve your high score, for instance).

Here’s the help text printed by the -h command line argument:

filter-mamewah-list.pl [options] {-ftr <filter file> | -unique} -src <MAMEWah source list>

Takes a MAMEWah list and pulls out only items that match those in the filter
list.

Options:
   -unique
      Remove duplicate entries in the game list by comparing game names.

   -rewrite
      Rename the output list to that of the MAMEWah source list upon finish.

   -duphints <hints file>
      A file of "hints" that tell the script which specific rom to choose
      when it has to choose between alternatives.

make-mamewah-filter.pl

This tool takes a MAMEWah .lst file and pulls out only the rom names. It’s useful for creating a rom list that the previous tool can use.

Here’s its help text:

make-mamewah-filter.pl -ftr <filter file> -src <MAMEWah source list> [-h]

Takes a MAMEWah list and creates a filter list including all roms that are
present.

merge-mamewah-lists.pl

This is the most powerful of the tools. It will take two MAMEWah .lst files and create a third that is the combination of the two.

By default it will simply merge the two lists, favoring the information in the first list when a rom exists on both. This would only be useful when the roms on both game lists are run by the same emulator.

The -inis flag instructs the script to create game-specific .ini files for every game on list2 that isn’t on list1. This is helpful when merging lists of games from two different emulators. You must provide it a template file from which the script will generate the .ini files. The form of the template file should be the following:

### [ini_unique_gamename].ini (mamewah v1.62) ###

### Execution Settings ###
pre_emulator_app_commandlines
emulator_commandline d:\emulation\pacmame-0.58\pacmame.exe [ini_gamename]{autodosbox}
post_emulator_app_commandlines

I’ve put in place two special MAMEWah-like tags. The [ini_gamename] tag will get replaced when the .ini file is created by the name of the rom corresponding to the game. The [ini_unique_gamename] tag will get replaced by the uniqified name (specified by the -uniqifier option).

The -uniqifier option provides for a different way of dealing with romnames that are present on both lists. You can give it a string to add to the front of the romname that will act to make it unique. Obviously, the new unique name will not correspond to a real romname, so this option is best used in conjunction with the -inis option so that a .ini file will be created. The .ini file can have the real romname on its commandline via the [ini_gamename] tag.

Here’s the help text:

merge-mamewah-lists.pl [options] <MAMEWah list1> <MAMEWah list2> <output list>

Merges two MAMEWah lists into a third.

Options:
   -uniqifier <string>
      Change the name of any game that is on both lists by adding  to
      the front.  When creating game-specific .ini files, the uniqified name
      will be used for the .ini filename.

   -inis <ini file template filename>
      Create a set of game-specific .ini files for the games on list2 using
      the file specified as a template.

      The string [ini_gamename] will be replaced with the rom name anywhere
      it exists in the template.

      The string [ini_unique_gamename] will be replaced with the rom name as
      uniqified anywhere it exists in the template.

Here are a couple of examples of use:

Example 1: merging MisfitMAME and PacMAME lists

I run both MisfitMAME and PacMAME on my cab in addition to MAME itself. As of the versions that I have (0.62 and 0.58 respectively) there are 304 PacMAME games and 433 MisfitMAME games. But they have 199 games in common, for a total of 538 different games between them.

I wanted to just combine these two emulators into one “Alternate Arcade Games” list. The issues are the following:

  • I want MisfitMAME to be the “main” emulator. The PacMAME games will be the exceptions to the MisfitMAME list rule. They will be run via game-specific .ini files.
  • When a rom shows up on both lists, it is actually the same game. So the script will just take the one on the Misfit list.

The following use of the tool will accomplish what I want:

merge-mamewah-lists.pl -inis pacini-template.txt misfit-0.lst pacmame-0.lst out.lst

pacini-template.txt is the example given above. The out.lst file contains all games from both list files, and a .ini file was created for every game that needs to be run via PacMAME.

Example 2: merging MAME and Daphne lists

Merging MAME and Daphne is a pretty natural idea. Getting all “Arcade Games” into one list is probably something most people think of.

The issues are the following:

  • Obviously, MAME will be the “main” emulator and Daphne games will be run via game-specific .ini files.
  • When a romname shows up on both lists, the games are actually different. So both games need to show up in the list. A uniqifier will be necessary.

The following use of the tool will accomplish what I want:

merge-mamewah-lists.pl -inis daphneini-template.txt -uniqifier daphne_ mame-0.lst daphne-0.lst out.lst

Here’s the daphneini-template.txt file:

### [ini_unique_gamename].ini (mamewah v1.62) ###

### Execution Settings ###
pre_emulator_app_commandlines
emulator_commandline d:\emulation\Daphne\daphne.exe [ini_gamename] vldp -framefile "d:\emulation\daphne\framefile\[ini_gamename].txt" -fullscreen -nohwaccel{nodosbox}{nosafelaunch}
post_emulator_app_commandlines

The [ini_gamename] tags will get replaced with the real romname that Daphne wants to see, while the .ini filename will have the uniqifier daphne_ prepended to it.