Difference between revisions of "Guides:MAME - chdman"
(→Usage) |
|||
Line 73: | Line 73: | ||
== Usage == | == Usage == | ||
− | The tool itself is called chdman depending on how you installed it, it may be accessible by typing chdman into your terminal. I compile MAME to custom location so I will need to execute chdman from the current directory by including a ./ before the command | + | The tool itself is called chdman depending on how you installed it, it may be accessible by typing chdman into your terminal. I compile MAME to custom location so I will need to execute chdman from the current directory by including a ./ before the command. Substitute as necessary for your own system. |
+ | |||
+ | Firstly lets take a look at the usage summary for chdman | ||
+ | ''' | ||
+ | <nowiki> | ||
+ | $ ./chdman -help | ||
+ | chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) | ||
+ | Usage: | ||
+ | ./chdman info: displays information about a CHD | ||
+ | ./chdman verify: verifies a CHD's integrity | ||
+ | ./chdman createraw: create a raw CHD from the input file | ||
+ | ./chdman createhd: create a hard disk CHD from the input file | ||
+ | ./chdman createcd: create a CD CHD from the input file | ||
+ | ./chdman createld: create a laserdisc CHD from the input file | ||
+ | ./chdman extractraw: extract raw file from a CHD input file | ||
+ | ./chdman extracthd: extract raw hard disk file from a CHD input file | ||
+ | ./chdman extractcd: extract CD file from a CHD input file | ||
+ | ./chdman extractld: extract laserdisc AVI from a CHD input file | ||
+ | ./chdman copy: copy data from one CHD to another of the same type | ||
+ | ./chdman addmeta: add metadata to the CHD | ||
+ | ./chdman delmeta: remove metadata from the CHD | ||
+ | ./chdman dumpmeta: dump metadata from the CHD to stdout or to a file | ||
+ | ./chdman listtemplates: list hard disk templates | ||
+ | |||
+ | For help with any command, run: | ||
+ | ./chdman help <command> | ||
+ | </nowiki> | ||
+ | ''' | ||
+ | |||
+ | The first thing you may note is the version number, this build of MAME was compiled around the time of the MAME 0.218 code freeze. Your version will differ. | ||
+ | ''' | ||
+ | <nowiki> | ||
+ | chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) | ||
+ | </nowiki> | ||
+ | ''' | ||
+ | |||
+ | After reviewing the version, you can take a look at the rest of the avialable options. At the bottom of all the options chdman tells us we can get further help on each of these commands. | ||
+ | ''' | ||
+ | <nowiki> | ||
+ | For help with any command, run: | ||
+ | ./chdman help <command> | ||
+ | </nowiki> | ||
+ | ''' | ||
+ | |||
+ | So lets get help on the verify command to see how we would use it to confirm the chd image we may want to use is valid for this version of MAME. | ||
+ | |||
+ | '''Note:''' CHDs may change between versions of MAME, they may be redumped or recreated or copied to bring the original data up to a new version of the format. | ||
+ | |||
+ | ''' | ||
+ | <nowiki> | ||
+ | $ ./chdman help verify | ||
+ | chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) | ||
+ | Usage: | ||
+ | ./chdman verify [options], where valid options are: | ||
+ | --input, -i <filename>: input file name (required) | ||
+ | --inputparent, -ip <filename>: parent file name for input CHD | ||
+ | </nowiki> | ||
+ | ''' | ||
+ | |||
+ | We wont cover parent CHDs (--inputparent) yet, but we will verify a standard CHD in the next test. You will need to obtain a CHD ''(upload a test chd here slacker)'' to use next | ||
+ | |||
+ | ''' | ||
+ | <nowiki> | ||
+ | $ ./chdman verify --input <chdfile.chd> | ||
+ | chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) | ||
+ | Raw SHA1 verification successful! | ||
+ | Overall SHA1 verification successful! | ||
+ | </nowiki> | ||
+ | ''' | ||
+ | |||
+ | It is worth mentioning here that CHDs must be told to be --compressed when they are created. The default create action for chdman (ignoring the name) is to build an uncompressed chd file. These cannot be verified. There are other property differences between compressed and uncompressed chds we will cover later. | ||
+ | |||
+ | |||
+ | If you attempt to run a verify on an uncompressed image, MAME will let you know there was nothing to do. | ||
+ | |||
+ | ''' | ||
+ | <nowiki> | ||
+ | $ ./chdman verify --input <uncompressed.chd> | ||
+ | chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) | ||
+ | No verification to be done; CHD is uncompressed | ||
+ | Fatal error occurred: 0 | ||
+ | </nowiki> | ||
+ | ''' | ||
+ | |||
+ | |||
== Examples == | == Examples == |
Revision as of 23:53, 26 January 2020
Compressed Hunks of Data Manager
Introduction
A Compressed Hunks of Data file or CHD for short is a standard format developed by the MAME project storing, not surprisingly compressed hunks of data. The format was originally developed as a format to image later 200x arcade machines that had begun shipping with internal hard drives. Beyond that some hardware systems also began shipping with interchangeable discs (e.g. NAOMI) and a format was needed to capture that.
The CHD format provided a solution for both of the above scenarios. The format itself has undergone multiple iterations to add support for various hdd/disc features. For reference the current chd hashes registered in MAME 0.217 are version 5.
Once imaged the dump is a standard format that all emulator authors can implement.
If you have been around the scene for a while (from the late 90s) you will be aware of how many different disc image formats took hold for a short while mostly due to the fact they supported various features other formats didn't. Some example formats were mdf, nrg, img, iso, bin etc. Emulator authors are required to add support for all these formats or provide a limited number of formats and force users to convert from one format to another during use.
Machine Support
We can take a look at the supported image formats for a couple of systems by querying MAME with -listmedia. Let's look at a couple of consoles to start with that have cdrom drives
Sony PlayStation (USA)
$ ./mame64 psu -listmedia SYSTEM MEDIA NAME (brief) IMAGE FILE EXTENSIONS SUPPORTED ---------------- --------------------------- ------------------------------- psu memcard1 (memc1) .mc memcard2 (memc2) .mc quickload (quik) .cpe .exe .psf .psx cdrom (cdrm) .chd .cue .toc .nrg .gdi .iso .cdr
Sega Saturn (USA)
$ ./mame64 saturn -listmedia SYSTEM MEDIA NAME (brief) IMAGE FILE EXTENSIONS SUPPORTED ---------------- --------------------------- ------------------------------- saturn cdrom (cdrm) .chd .cue .toc .nrg .gdi .iso .cdr cartridge (cart) .bin
You'll notice neither of these systems support mdf/mds format.
The mdf/mds format was developed and use by a very popular tool during the early 2000s called Alcohol 120%.
Another popular tool of the early 2000's CloneCD was the only tool for a very long time to support sub channel data dumping and became popular with groups for dumping pc titles. The format from CloneCD was ccd/img or ccd/img/sub when sub channel data was dumped. Again not supported in either system above although dumps exist.
You will notice the nrg format is in the list of compatible file extensions, this was a proprietary format from the tool Nero Burning ROM, it is interesting that its supported. We need to find out why and update information here.
We can see that chd is supported on both systems, so if we can convert our discs to chd we will remain compatible with MAME. You will remember we mentioned this was used as a form to capture hard disk images originally. That is true but it can also create blank images for use with machines where a hdd may be managed, like the ct486. Lets have a look at the output of -listmedia for this machine.
PC/AT 486 with CS4031 chipset
$ ./mame64 ct496 -listmedia SYSTEM MEDIA NAME (brief) IMAGE FILE EXTENSIONS SUPPORTED ---------------- --------------------------- ------------------------------- ct486 floppydisk1 (flop1) .dsk .ima .img .ufi .360 .d77 .d88 .1dd .dfi .hfe .imd .ipf .mfi .mfm .td0 .cqm .cqi floppydisk2 (flop2) .dsk .ima .img .ufi .360 .d77 .d88 .1dd .dfi .hfe .imd .ipf .mfi .mfm .td0 .cqm .cqi harddisk (hard) .chd .hd .hdv .2mg .hdi printout (prin) .prn
The harddisk option does have the ability to attache a chd formatted file to it along with a number of other formats but we will focus on chd in this document.
Usage
The tool itself is called chdman depending on how you installed it, it may be accessible by typing chdman into your terminal. I compile MAME to custom location so I will need to execute chdman from the current directory by including a ./ before the command. Substitute as necessary for your own system.
Firstly lets take a look at the usage summary for chdman
$ ./chdman -help chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) Usage: ./chdman info: displays information about a CHD ./chdman verify: verifies a CHD's integrity ./chdman createraw: create a raw CHD from the input file ./chdman createhd: create a hard disk CHD from the input file ./chdman createcd: create a CD CHD from the input file ./chdman createld: create a laserdisc CHD from the input file ./chdman extractraw: extract raw file from a CHD input file ./chdman extracthd: extract raw hard disk file from a CHD input file ./chdman extractcd: extract CD file from a CHD input file ./chdman extractld: extract laserdisc AVI from a CHD input file ./chdman copy: copy data from one CHD to another of the same type ./chdman addmeta: add metadata to the CHD ./chdman delmeta: remove metadata from the CHD ./chdman dumpmeta: dump metadata from the CHD to stdout or to a file ./chdman listtemplates: list hard disk templates For help with any command, run: ./chdman help <command>
The first thing you may note is the version number, this build of MAME was compiled around the time of the MAME 0.218 code freeze. Your version will differ.
chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed)
After reviewing the version, you can take a look at the rest of the avialable options. At the bottom of all the options chdman tells us we can get further help on each of these commands.
For help with any command, run: ./chdman help <command>
So lets get help on the verify command to see how we would use it to confirm the chd image we may want to use is valid for this version of MAME.
Note: CHDs may change between versions of MAME, they may be redumped or recreated or copied to bring the original data up to a new version of the format.
$ ./chdman help verify chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) Usage: ./chdman verify [options], where valid options are: --input, -i <filename>: input file name (required) --inputparent, -ip <filename>: parent file name for input CHD
We wont cover parent CHDs (--inputparent) yet, but we will verify a standard CHD in the next test. You will need to obtain a CHD (upload a test chd here slacker) to use next
$ ./chdman verify --input <chdfile.chd> chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) Raw SHA1 verification successful! Overall SHA1 verification successful!
It is worth mentioning here that CHDs must be told to be --compressed when they are created. The default create action for chdman (ignoring the name) is to build an uncompressed chd file. These cannot be verified. There are other property differences between compressed and uncompressed chds we will cover later.
If you attempt to run a verify on an uncompressed image, MAME will let you know there was nothing to do.
$ ./chdman verify --input <uncompressed.chd> chdman - MAME Compressed Hunks of Data (CHD) manager 0.217 (mame0217-611-ga7fec751ed) No verification to be done; CHD is uncompressed Fatal error occurred: 0