Greera
Posts: 1
Joined: Tue Aug 25, 2020 4:45 pm

Does the version of chdman used to create CHD need to match with MAME?

For games that need to use CHDs, I created a long time ago their CHDs with chdman using the original optical images. Despite they were created using and old version of chdman (back when they were played using MESS), they still work on the most recent version of MAME. I tried to create a new CHD with a recent version, but the only difference between the files is their checksum. The file size stays the same, so if the compression hasn't changed I don't see any reason not to keep using the old CHD.

But I may be wrong, so I would like to know if it's recommended to create the CHD every time a new MAME version is released using its corresponding chdman.

Thanks in advance.
User avatar
Tafoid
Posts: 351
Joined: Thu Nov 06, 2014 12:50 pm
Location: USA
Contact: Website

Re: Does the version of chdman used to create CHD need to match with MAME?

Greera wrote: Wed Aug 26, 2020 1:36 pm For games that need to use CHDs, I created a long time ago their CHDs with chdman using the original optical images. Despite they were created using and old version of chdman (back when they were played using MESS), they still work on the most recent version of MAME. I tried to create a new CHD with a recent version, but the only difference between the files is their checksum. The file size stays the same, so if the compression hasn't changed I don't see any reason not to keep using the old CHD.

But I may be wrong, so I would like to know if it's recommended to create the CHD every time a new MAME version is released using its corresponding chdman.

Thanks in advance.

CHDMAN has not changed version for quite a few years and outside of some small fixes it has been largely the same over that same period. There are 2 difference hashes when viewing a CHD file via chdman info -i example.chd

SHA1 = data + metadata
DATA SHA1 = data only

So, if you simply change the compression, the SHA1 stored should not change from previous creation. The only way that hash will change is if you change the metadata which include items such as CHS params, HDD ATA ID, etc. It is possible your older CHDs were made not taking in account or failed to save the complete metadata (there have been fixes for Naomi and similar GDROM dumps) which newer versions needed to be used and sources for those discs needed to be reacquired/redumped.

Beyond that, if they work for you, there shouldn't see any issues unless you see them. Version 4 and 5 CHDs are compatible with current MAME.
User avatar
cuavas
Posts: 125
Joined: Tue Nov 11, 2014 1:04 pm
Location: Sydney, Australia
Contact: Website

Re: Does the version of chdman used to create CHD need to match with MAME?

The CHD format has been updated from time to time to support additional functionality. Originally, it only supported hard disk images, but it now supports optical media (CD-ROM, GD-ROM), and it can act as an A/V container for LaserDisc or video tape content. Eventually, the format may need to be extended to support things like raw scrambled DVD sector dumps and packet-based data tape formats like Ultrium LTO. Additional compression algorithms have been added at various times. The current version of chdman (as of MAME 0.224) creates version 5 CHD files, but it supports older version 3 and version 4 CHD files. Likewise, MAME 0.224 can use CHD files in versions 3, 4 and 5 of the CHD format.

CHD files contain both the data from the media, and metadata describing the media. Newer read-only CHD files contain an SHA1 digest of the combined data and metadata, and an additional SHA1 digest of the data only. Older CHD versions only contained an SHA1 of the data. You can view CHD file details using the chdman tool, for example the disk image MAME expects for Killer Instinct:

Code: Select all

$ chdman info -i roms/kinst/kinst.chd
chdman - MAME Compressed Hunks of Data (CHD) manager 0.224 (mame0224)
Input file:   roms/kinst/kinst.chd
File Version: 4
Logical size: 131,076,608 bytes
Hunk Size:    4,096 bytes
Total Hunks:  32,002
Unit Size:    512 bytes
Total Units:  256,009
Compression:  zlib (Deflate)
CHD size:     95,627,918 bytes
Ratio:        73.0%
SHA1:         81d833236e994528d1482979261401b198d1ca53
Data SHA1:    a37a2c5e52ea936a715210d237874dd573bb002f
Metadata:     Tag='GDDD'  Index=0  Length=34 bytes
              CYLS:419,HEADS:13,SECS:47,BPS:512.
The data SHA1 digest will be the same for any CHD file containing the same data. The overall SHA1 digest of the data and metadata will change if any of the metadata changes (e.g. the cylinder/head/sector geometry for the disk in this case), or if the file is recreated with a newer version of chdman that supports additional metadata. Neither of the SHA1 digests shown here are affected by the compression algorithm used – they’re calculated on the uncompressed data stored in the container.

In situations where a newer version of chdman supports more metadata, MAME will expect a CHD file created with the correct version of chdman. For example, CHD version 5 supports important GD-ROM metadata that was not supported in older versions, so we’ve recreated most or all of the GD-ROM CHD images as version 5 to accurately preserve GD-ROMs.

In other cases, we haven’t recreated all the images in the software lists in the latest CHD format. For example, a lot of CD-ROM images in the software lists are still version 4 CHD files. Version 5 actually does support additional CD-ROM metadata, so if you recreate these CD-ROM CHDs from the best available dumps using the latest version of chdman, you’ll get a different overall SHA1 digest of the data and metadata, and it won’t match the software list.

The short answer to your question is that there’s no reason to recreate your CHD images if the ones you have work. If you’re using software lists, it’s best to get your CHDs from the usual sources to ensure they match what MAME expects.

Return to “MAME Discussion”