tochd converter

Convert game ISO and archives to CD CHD for emulation. tochd is a commandline application for the terminal that makes use of the programs 7z and chdman to convert your .iso, .cue and other CD like formats into .chd files. This is a Python 3.10 script written for Linux and won’t probably work on Windows.

tochd --help

Requirements

  • Python 3.10 or newer
  • 7z (available in p7zip package in Archlinux)
  • chdman (available in mame-tools package in Archlinux)

So why do I need this program?

You don’t. Imagine this program as a script (Batch or shell script) that automates some stuff like extraction of files, using correct arguments on the programs it is calling and renames files if necessary. You can perfectly live without it and can use any program to manually extract files from archives such as .zip or .7z files and use the chdman program to convert any file you need. On Windows in example are a few simple .bat files that will do simple automation for you, but they are not as “sophisticated” like my script.

What do I mean by that? tochd will do some additional work over simply converting files. In example it will determine which files can be converted and only process those, rename the output .chd file to the same name of the input archive (this automatic function can be turned off), run multiple instances in parallel or output only the most necessary information in the terminal, such as which job has been successfully completed or is a failure. Also it will handle temporary files and folders (when using an archive such as .zip or .7z as input) and delete them automatically. The keyboard shortcut Ctrl-c in the terminal usually terminates an application, but tochd will respond to that by just killing the current job process and move on to next one.

External article: Have a look at this tutorial The Ultimate ROM File Compression Guide by Retro Game Corpse to learn more about doing it manually or on other platforms.

What are .chd files and the CHD format?

CHD was initially developed by the MAME team to represent hard disks (CHD stands for Compressed Hard Disk) from arcade games like Killer Instinct. Since then it got support for other type of media, such as Laser Disc and CD. More and more emulators are adopting this file format.

Some benefits are:

  • one format to care about, instead working with .cue, .gdi, .bin, .wav or .iso files
  • good compression, sometimes as good as .7z files are

Some disadvantages are:

  • Romhacks often require the .cue and .bin files and won’t work with .chd files
  • some physical devices you are playing on (PS Vita in example) are not allowed to use CHD files with RetroArchievements functionality

How does the program work?

It is just a frontend to automate 7z to extract from archives and chdman to convert to CHD. After installation, just type the command

tochd -q .

to search current directory for known file types and convert each of them to CHD format. New files are created in the same folder as the source files are. The -q option will suppress messages from the other programs and print the current job messages only. With “Ctrl+c” on the keyboard will cancel the current job and start the next one. Check all available options with tochd --help.

Example output

$ cd ~/Downloads/cue
$ tochd -q .
Job 1     Started:	/home/tuncay/Downloads/cue/Vampire Savior (English v1.0).7z
Job 1   Completed:	/home/tuncay/Downloads/cue/Vampire Savior (English v1.0).chd
Job 2     Started:	/home/tuncay/Downloads/cue/3 x 3 Eyes - Sanjiyan Hensei (ACD, SCD)(JPN).zip
Job 2      Failed:	/home/tuncay/Downloads/cue/3 x 3 Eyes - Sanjiyan Hensei (ACD, SCD)(JPN).chd
Job 3     Started:	/home/tuncay/Downloads/cue/Simpsons Wrestling, The (USA).7z
Job 3   Completed:	/home/tuncay/Downloads/cue/Simpsons Wrestling, The (USA).chd
Job 4     Started:	/home/tuncay/Downloads/cue/Shining Wisdom (USA) (DW0355).rar
Job 4   Completed:	/home/tuncay/Downloads/cue/Shining Wisdom (USA) (DW0355).chd

Where can I get the program?

It is a single Python 3.10 script and requires you to have at least that version of Python. No other library or module is required, other than the executable applications 7z and chdman. There are several ways to install:

  1. From Source: Just download the Source code (.zip or .tar.gz) from Releases page and run the “tochd.py” script after making it executable: https://github.com/thingsiplay/tochd/releases . Alternatively get the current state from the repository with
    git clone https://github.com/thingsiplay/tochd
  1. From AUR: If you are on an Arch based Linux system, then you can also install from the AUR: https://aur.archlinux.org/packages/tochd in example with
    yay -S tochd
    or
    pamac install tochd

See also

Here I want to highlight some community projects or guides related to the topic.

  • The Ultimate ROM File Compression Guide [doc]: List of short guides and links on how to convert and handle various CD like formats, not only CHD.
  • namDHC [app]: A popular GUI frontend for chdman on Windows, written in AutoHotkey.