If you are into retro gaming, you may have come across files with a “.chd” extension. In most cases, those files have some things in common: they have cryptic names, are (relatively) large, and don’t seem to be useful in anything.
What Are CHD Files?
In short, CHD files are arcade game disk images used by MAME. This explains why they are so big in file size. Nowadays, they have become quite popular among many emulators that use relatively large ROMs. This includes emulators like some of the PlayStation Libretro cores in Retroarch and, by extension, all the popular emulation-oriented distributions for the Raspberry Pi series of microcomputers.
If your CHDs are MAME ROMs, they should (usually) be stored in folders with the same name under MAME’s main ROM folder.
If they are backups of games for the original PlayStation or some other console that used optical discs, they should, in most cases, be placed directly in the emulator’s ROM subdirectory.
In the case of console emulators, CHD files usually contain the whole game, so you can “open them” in the emulator and start playing. In MAME, though, they are only part of the game because MAME primarily emulates arcade machines.
Unlike gaming consoles, arcade games usually had dedicated hardware and software that differed from game to game. The software part of the equation was typically stored in ROM chips. At some point in time, with ROM chips being expensive and games getting larger with more impressive visuals, their developers started using CDs or hard disk drives. They used them to store the most substantial assets of games – graphics, audio, music, animations – while keeping the smaller “core parts” of a game on the ROM chips.
The reason we mention all this is because, CHDs on their own are usually useless with MAME. You will need the actual ROM files that accompany them to be able to use them. The CHD files themselves contain the game’s assets but not the game itself. You will have to find the ROMs that go with your specific CHD file and any extra files related to the hardware on which the game ran. For that, since it remains a legal gray area, we can only say that Google is your friend.
Place those ROMs in MAME’s ROM subdirectory, place your CHDs in the same spot but in sub-subdirectories with their own name, and then try running the ROM with MAME. If you’re not using a command-line but a GUI-based variant of MAME, you might need to run a scan/audit of your ROMs first.
Check CHD Files’ Contents
The best (and, from what we know, only) tool for working with CHD files comes from their source, from MAME itself. It’s called
chdman. Depending on your MAME set up, it’s either already installed, or you can bring it on board with the command:
To check a CHD image and see some information about its structure, use:
Convert Your CHDs
You can use the same tool both to extract the contents of a CHD file and to create one.
Extracting a CHD to a more accessible format, like IMG for hard disk drive backups or a BIN & CUE combination for CD backups, has a point only if you’re going to use those files in a different emulator that doesn’t support the CHD format. In the case of hard disk image files, use:
For CD backups, replace
extractcd in the above command.
If you are using an emulator like PCSX ReARMed or Demul, RetroArch, or some emulator distribution for your Raspberry Pi, theoretically, you only have to place your CHD files in the emulator’s ROM path for it to detect and use them.
Your ROMs folder can look chaotic if it contains backups of more than one games that:
- Were originally in CD format
- Are now stored in BIN & CUE combinations
- Contained multiple audio tracks
That’s because, with the CUE & BIN combination, each track of the original CD is saved as a separate BIN file, so a single game can be split into dozens of files.
The CHD file format was created as a more modern way for storing such ROMs, and thus it excels in every regard. Everything can be contained in a single file, and lossless compression is smartly applied depending on the content for optimal results. For example, typical data might be compressed with the
zlib algorithm, but individual audio tracks are compressed with Flac. This leads to great compression rates with zero data loss, since the types of compression used are “lossless.”
To convert a game split among a CUE and a bunch of BIN files to a single CHD file, use:
Although you can, you don’t have to tweak the compression parameters – the optimal choices will be automatically chosen for you. During the conversion, chdman will present, among other information, the different types of compression it uses in each case.
After the conversion completes, try loading your new CHD file in the same emulator you used initially for loading that game. If it works, delete the original files and move to the next game.
If you keep a lot of retro games around, by converting the largest of them to the CHD format, at least for the emulators that support it, you can end up saving multiple gigabytes of space – gigabytes that you could then use to store even more retro games!
Our latest tutorials delivered straight to your inbox