Idea: CHD support?

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Idea: CHD support?

Post by adespoton »

Since we've now got really functional sparsebundle support, does anyone want to see if they can do CHD support too? This would make an image format that's compatible with MESS, and is also compressable! Source code's already available in the MAME sources (as are a number of nifty command-line tools, such as chdman for manipulating the files, and imgtool for actually snooping around/messing with the inside from the host.
yksoft1
Master Emulator
Posts: 394
Joined: Tue Aug 14, 2007 4:32 pm
Location: People's Republic of China

Re: Idea: CHD support?

Post by yksoft1 »

If you want to support raw or compressed hard disk images you also need to fully support the Apple Partition Map.
vasi
Tinkerer
Posts: 54
Joined: Mon Feb 23, 2009 11:46 pm

Re: Idea: CHD support?

Post by vasi »

Hi, I'm the one who implemented sparsebundle support. I don't know anything about CHD, is it documented anywhere? Links would be great. If it's not too much work, I'll take a look at adding support.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Idea: CHD support?

Post by adespoton »

Here's some useful starting points:
http://www.mess.org/howto/convert_chd_basilisk
I believe the chdman sources are available in http://mamedev.org/downloader.php?file= ... e0149s.zip (archive name will change as mame updates)

CHD format changed as of 0.146, the current version supports FLAC/LZMA compressed hard disk images. I believe CHD uses a shadow file to enable read-write on a compressed read-only file.
vasi
Tinkerer
Posts: 54
Joined: Mon Feb 23, 2009 11:46 pm

Re: Idea: CHD support?

Post by vasi »

Ok, so there are a couple of problems with this:

MESS doesn't expose the CHD-handling functions via a library so that other programs can use it. And the CHD-related code is pretty strongly integrated within MESS, there's no easy way to extract it without also including several other bits of MESS. While CHD is not terribly complex, it's enough that I'm reluctant to reimplement it from scratch! Do you know of any code that's easier for us to use?

Also, CHD doesn't store the name of the parent file within the child ("shadow") CHD. This means we would need some way to locate the parent if the user specified a CHD disk. Maybe there's a common naming convention, like "foo.chd" and "foo.chd.shadow" or something? Otherwise we would have to extend the "disk" entry in our preferences, so users can specify the parent. This is something we might have to eventually do for other disk formats, so I'm not ruling it out, it's just annoying.

Have you considered using VHD instead of CHD? We already have support for it in SS/B2, it's supported by a lot of other software (qemu, Microsoft virtualization, VirtualBox), it also allows compressed images with shadows, and it includes the path to the parent in child files. I don't think any of the builds floating around enable VHD support, but you could build SS/B2 yourself if you need it.
vasi
Tinkerer
Posts: 54
Joined: Mon Feb 23, 2009 11:46 pm

Re: Idea: CHD support?

Post by vasi »

Ooops, I take it back, I think VHD does not actually support compression, just sparseness. *sigh* Qemu's qcow2 format would be great, but they still haven't released the library to allow access to it, although this was planned months ago.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Idea: CHD support?

Post by adespoton »

I was afraid all that might be the case, based on how MESS/MAME work :( I've only ever played around wich chdman, which is significantly simpler (and more discrete) than the runtime code.

Personally, I find CHD's lack of adding the parent path in the shadow file a blessing, as it means you can store it anywhere... with the downside that you have to know where both of them are yourself.

I was thinking that a simple hack we could do on OS X (actually, it'd work on any platform, but not be so pretty on others) is to do a chdbundle:
path/to/9.0.4.chdbundle/Contents/Resources/9.0.4.chd 9.0.4.chdshadow

This way, if we wanted to, an Info.plist file could track the relative location of the files, or we could just assume it's in the same folder with a specific extension. These are both things that I'm pretty sure MESS can deal with.

However, extracting the disk code from the project as a whole might need Arbee or someone similar to accomplish.
Post Reply