O'Reilly logo

Gaming Hacks by Simon Carless

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Keep Your ROMs Tidy and Organized

Keep your mass of homebrew emulated games tidy and safe.

One of the joys of collecting ROMs and disc images—even freeware and homebrew ones—is that your collection will soon grow. With that accumulation comes the issue of how to keep them in order. You might even have multiple copies of the same file with different naming conventions from different sources!

With ROM management tools and game databases such as the TOSEC database, you can autorename, checksum, and organize your game image files easily and efficiently.

ROM Management Tools

Your first step is to pick a tool to use. Most of the best ROM managers are available for Windows, but there are decent managers for other systems too. We’ll concentrate on the two leading Windows-based managers, CLRMamePro (http://www.clrmame.com/) and ROMCenter (http://www.romcenter.com/). Both are extremely fully featured.

Tip

CLRMamePro, although originally named after MAME, which deals only with arcade games, actually works for multiple DAT files—even those not for MAME.

Unfortunately, these two utilities have different datafiles, which makes metadata compatibility a little tricky. We’ll discuss that later. For now the place to start is MrV2K’s web-based CLRMame tutorial (http://www.mameworld.net/easyemu/clrmameguide.htm).

The .DAT files used in these management tools are basically standalone text files. You can download and import new versions and even customize your own copies. Their complexity varies greatly, but at the most basic level, they include the correct filename, the correct size, and the correct CRC checksum for each included game. The tools compare ROMs by checking their file sizes and CRCs. These checksums are alphanumeric values that are guaranteed to be unique for each individual ROM. This allows the system to detect duplicates, even if the filenames have changed.

Because running the tool may cause complex chains of renaming and deletion operations, you may want to back up your entire directory before starting up. Although these utilities generally behave well, most ROM files are small enough that it makes sense to keep your old configuration in case you like things better that way.

After you have the correct DAT file to scan against the ROMs you currently have on your hard drive, run the Scanner option from the main menu of CLRMamePro to cross-check everything against your master DAT. There are several scanning criteria, including whether to check if the ROMs are completely missing, whether there are duplicates, and whether certain files are unnecessary.

At the end of checking, a detailed error report tells you exactly which ROMs failed their CRC check, which have partial missing files, and which need renaming and deleting because of duplicates. Some people suggest that you perform a simple name/case/duplicates check before performing a deeper CRC scan; you’re much more likely to have duplicate ROMs than corrupted ones.

If you don’t have a suitable DAT file, you can hook existing emulators into CLRMamePro, though this works only with command-line emulators such as MAME. This clever part of the program uses the command-line Information options for the emulator to derive and retrieve information about existing ROMs on your machine. It can then create its own database file from scratch.

Analyzing DAT File Details

Many experts recommend the CLRMamePro format as the master format. Let’s explore the DAT file for a real game to see how it works. Here’s the metadata for a freely distributable Neo Geo homebrew game, an adaptation of a famous bat-and-ball game you might have heard of:

game (
    name neopong10
    description "NeoPong (v1.0, non-MAME)"
    year 2002
    manufacturer "NeoDev"
    cloneof neopong
    romof neopong
    rom ( name pong0_p1.rom size 131072 crc 31b724d7 )
    rom ( name pong_s1.rom merge pong_s1.rom size 131072 crc cd19264f )
    rom ( name sfix.sfx merge sfix.sfx size 131072 crc 354029fc )
    rom ( name sp-s2.sp1 merge sp-s2.sp1 size 131072 crc 9036d879 )
    rom ( name sp-s.sp1 merge sp-s.sp1 size 131072 crc c7f2fa45 )
    rom ( name usa_2slt.bin merge usa_2slt.bin size 131072 crc e72943de )
    rom ( name sp-e.sp1 merge sp-e.sp1 size 131072 crc 2723a5b5 )
    rom ( name asia-s3.rom merge asia-s3.rom size 131072 crc 91b64be3 )
    rom ( name vs-bios.rom merge vs-bios.rom size 131072 crc f0e8f27d )
    rom ( name sp-j2.rom merge sp-j2.rom size 131072 crc acede59c )
    rom ( name sm1.sm1 merge sm1.sm1 size 131072 crc 97cf998b )
    rom ( name pong0_m1.rom size 131072 crc 9c0291ea )
    rom ( name 000-lo.lo merge 000-lo.lo size 65536 crc e09e253c )
    rom ( name pong0_v1.rom size 524288 crc debeb8fb )
    rom ( name pong0_c1.rom size 1048576 crc d7587282 )
    rom ( name pong0_c2.rom size 1048576 crc fefc9d06 )
)

As you might have noticed, many ROMs are variants of other ROMs. This goes for translations and modifications as well as officially released commercial games, which often reuse individual chips on a cartridge or ROM board. The cloneof field here allows you to track all the myriad ripoffs of a particular title (in the previous case, a slight variant of NeoPong; a better example is that of the mess of Pac-Man variants). This allows easy organization and grouping within ROM managers, among other things.

Most cleverly of all, the merge command within certain of the ROM files allows multiple clones to use the same ROM files if only a few ROMs differ between clones. This can save a lot of space by eliminating useless redundancy.

If you’d like to know a lot more about the various formats, the LogiqX site has an exemplary FAQ section (http://www.logiqx.com/FAQs/DatFAQs.shtml) which goes into much greater detail, especially regarding more complex maneuvers such as adding samples and resource files to your database.

Emulator DAT Conversion with DatUtil

Because it stores versions of its databases for both CLRMamePro and ROMCenter versions, LogiqX (http://www.logiqx.com/) is one of the best places to look for emulator-compatible DAT files. Since the guys at LogiqX don’t merge updates between the databases by hand when things change, they must have some way to convert between the different database formats.

It comes in the form of DatUtil (http://www.logiqx.com/Tools/DatUtil/DatUtil.shtml), a four-year-old project. This DOS command-line utility converts between multiple formats. It even performs clever comparisons of two different DAT files that may have slightly altered content, spewing out the differences to a logfile.

The DatUtil executable also comes with the C source code, should any ninja coders wish to make custom alterations. You may never need to convert DAT files if you stick with something like CLRMamePro all the way, but if a newer, better ROM naming manager ever supersedes it, it’s nice to know that you’ll have a way to convert your legacy databases.

Analyzing the Best Master ROM Databases

There are several different ROM databases to explore. The ROMCenter page (http://www.romcenter.com/) has a good sampling. However, the most famous two are the previously mentioned LogiqX (http://www.logiqx.com/) and the TOSEC team (http://www.tosec.info/).

LogiqX is one of the preferred sources for MAME DATs, especially because of their involvement in CAESAR, the Catalogue of Arcade Emulation Software—the Absolute Reference (http://caesar.logiqx.com/). They have fewer files in the more obscure formats outside the most popular emulation platforms, but the DAT files they do have for the latest versions of MAME, Kawaks, Nebula, and others (http://www.logiqx.com/Dats/Dats.shtml) are impressively up to date.

On the other end of the spectrum, TOSEC’s work in sorting out and compiling massive databases of ROMs is impressive. They’re the only people with details on more obscure formats; they keep a list of all Amiga public-domain software or Intellivision ROMs, for example. The TOSEC team is slowly moving from simple, static DAT files to an ambitious web site where you can create DAT files from a master database on the fly—a laudable, if much more complex work. The TOSEC authors explain:

Eventually [TOSEC 2.0’s Database Generator] will fully replace the “solid” data archives we use now and will give you the possibility to generate and download combined and custom dats, making it possible to make dats only containing the files you want them to contain.

It’s also worth pointing out that the TOSEC team makes an effort to separate public-domain and redistributable software from ROMs that may have more dubious right issues. This is great news if you want to use ROM database software with legitimate ROMs. For example, the ROMCenter TOSEC page (http://www.romcenter.com/datafiles/tosec/list.php) has specific, standalone DAT files for legitimate Atari Jaguar and Atari Lynx PD/demonstration software.

It’s likely that TOSEC 2.0 will continue this, making it possible to create custom DATs of every single public domain or freely distributable ROM for any console or computer on the fly. That would be an amazing accomplishment.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required