Verify Game

Introduction

Console and handheld video games come in many different formats, with many different techniques available to backup those games to a computer, and many different reasons why someone would choose to backup and/or share the games.  As a result, there's a great variety in the quality of these game backups online, ranging from nearly perfect ("1:1") copies to corrupt, improperly formatted, or even maliciously infected game backups.  Because of this, it's important to verify your game backups against trusted sources.  By validating your copy matches that of a known good copy, you can be assured that it is safe to play and as authentic and widely compatible as possible.

There are a number of tools and resources to assist with this.  Clrmamepro and Romcenter are two popular options.  There are many others, but all operate according to the same basic principle: compare your list of games against "DAT" files provided by trusted sources to determine whether your games match the known-good backups.  Unfortunately, they also share another common trait - pretty much all such utilities only support Windows.  Some may work under Linux with Wine, but that's clunky at best.  The only native Linux software I've found for this is ucon64, which is an extremely capable and flexible game backup management utility, but is fairly limited in it's platform support, only supporting older cartridge-based systems (or at least has been - I haven't tested the most recent builds since development resumed).

After years of frustration with this situation, I wrote my own verification script for Linux.  It uses the DAT files provided by No-Intro for cartridge-based games and Redump for disc-based games.  It also includes support for transparently decompressing games if you choose to keep them compressed in Zip files or gzipped or any other common compression format.  Once setup, you can point the script at a directory full of games and it'll tell you which are valid and which are not.  As a Bash script, it should also run under Mac OS X, though this has not been tested.

Note:  I've been using the generic term game backups above, but the rest of this page will be more specific.  Here's a common set of terms that will be used below:

ROM
Generic term referring to game backups, especially cartridge-based games
dump
The process of backing up a cartridge-based game; you would typically 'dump' the cartridge's ROM to a file on your computer
rip
The process of backing up a disc-based game; you would typically 'rip' the disc to an ISO 9660 (.iso) image file
ISO
A standard file format used store copies CD or DVD images on a computer; technically refers to the ISO 9660 format, but may sometimes be used generically to refer to any optical disc image, such as BIN/CUE files
BIN/CUE
A more fully featured but less well defined and supported file format used for optical disc images; BIN/CUE files support multi-track discs, which the ISO format does not, and hence is typically preferred for older consoles such as the PlayStation which commonly used multi-track discs

Return to top

Download  Current Version: 4.1, Released: 08/21/2021

verify_game.sh (22.74 KB) - The Verify Game BASH shell script
verify_game.txz (20.8 MB) - The Verify Game BASH shell script w/ bundled DAT files

The Verify Game changelog is included in the beginning of the script.

Note:  Verify Game requires a DAT file for the system of any game you with to verify.  Eg., if you want to verify NES ROMs, you'll need to first download the NES DAT file from No-Intro and move it to the configured directory.  See Installation for more details.  As of version 4.0, a bundled option is available to download that includes all supported DAT files.

Return to top

Installation

Verify Game requires a few steps to properly configure:

  1. Download verify_game.sh
  2. Edit verify_game.sh and review the $DATDIR veriable; adjust as desired
    • Note: If you use the bundled version, this should not need to be modified.
  3. Move verify_game.sh and the checksums/ directory (for the bundled version) to a directory in your $PATH (eg, /usr/local/bin/)
  4. Ensure that verify_game.sh has the execute bit set (eg, chmod a+x /usr/local/bin/verify_game.sh)
  5. If not using the bundled version:
    • Download the DAT files for your cartridge-based systems from No-Intro's DAT-o-MATIC (if you have a choice, use the Standard DAT format)
    • Download the DAT files for your disc-based systems from Redump.  Note that DAT files for newer systems (Wii/PS3/360 and newer) are restricted and may only be downloaded by verified rippers, but if you search the web for redump dat files and shouldn't be too difficult to find the DAT files for newer systems if needed.
    • Move all downloaded DAT files to the configured $DATDIR directory
  6. Optional:  If you want transparent decompression support, verify that required binaries are available to decompress your ROMs.  You can find the specific needed by searching the script for 'bincheck'.

Return to top

Usage

Execute verify_game.sh -h to display help information.  This will describe the syntax for running the program and list all available options.

You may provide pass one or more ROM or ISO files; if multiple files passed (such as *.nes), it'll check multiple files in parallel up to your number of CPU threads in order to speed up the verification process.

verify_game.sh will attempt to determine the type of file based on simple heuristics such as the file extension and name of parent directory.  If it can find a positive match, it'll verify against that system's DAT file.  If it cannot determine the system automatically, it will abort with the error, "Invalid platform specified, or platform unknown."  This type of error is most common with ISO images since there's no easy way to distinguish between, eg., Xbox and PS2 ISOs since they both use the same extension.  In this situation, use the -p option to specify the platform.  Eg.:

$ verify_game.sh Darkwatch.iso
Error: Invalid platform specified, or platform unknown.
Run 'verify_game.sh -h' for list of supported platforms

$ verify_game.sh -p xbox Darkwatch.iso
Verified XBOX game: Darkwatch (USA).iso


verify_game.sh -h will output the list of supported platforms.

Note:  Only the platforms (systems) listed in the output are supported by Verify Game.  It's not difficult to add additional systems, but you would need to modify the verify_game.sh script to do so.

Return to top

Technical Details

Verify Game begins execution by verifying that all arguments have been passed correctly.  It the determines the input filetype by checking both the extension (case-insensitive match) and name of the parent directory.  Using relatively simple pattern matching, it will try to map the input file to one of the supported platforms.  If successful, it will proceed with verification.  Otherwise, the -p will need to be used to specify the target platform.

Verify Game supports transparent decompression, meaning that if your ROM is compressed, Verify Game will detect this, decompress or unpack the ROM, then attempt to verify the decompressed copy.  Most common (and less common) compression formats should be supported; view the unplite() for additional details.  If using the feature, ROMs will be decompressed to a unique temporary directory $TEMPDIR, set by default to /tmp; you may modify this variable in the script to point to a better location if desired.

Note that if you are batch verifying multiple large compressed games (such as DVD images) AND have a large number of CPU threads, this can consume a LOT of disk space under $TEMPDIR while running.  If you have quad-core processor that supports hyperthreading, for example, Verify Game will perform a rolling decompression and verification of eight ROMS in parallel, meaning eight compressed games will be stored in $TMPDIR during this time.  For cartridge-based games this not be an issue, but some care should be taken when verifying batches of Blu-ray, DVD, and even CD images, depending on your system resources.  You can use the -d and -t options to better tune this for your system if needed, or use a for loop such as the following to process games sequentially rather than in parallel:

for i in *.iso; do verify_game.sh -p xbox "$i"; done

Return to top