Skip to content

Commit

Permalink
Allow clone CHDs to use parent CHDs as parents.
Browse files Browse the repository at this point in the history
* util/chd.cpp: Allow caller to provide a helper for finding parent CHDs
  and expose (recursive) missing parent status.
* emu/romload.cpp: Search parent systems/devices/software for parent
  CHDs on encountering a delta CHD.
* emu/romload.cpp: Report error on delta CHDs when parent can't be
  found.
* emu/romload.cpp: Check parents for matching CHDs with different names
  for devices as well as systems and software.
  • Loading branch information
cuavas committed Oct 19, 2023
1 parent 4dfc36a commit d1172bf
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 113 deletions.

6 comments on commit d1172bf

@cuavas
Copy link
Member Author

@cuavas cuavas commented on d1172bf Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been requested several times. There’s probably an open issue for it, but I haven’t looked. It allows substantial space savings for a full media set in cases where a clone system/device/software item has a CHD that can share a lot of hunks with a CHD in its parent.

Using sf2049tea and sf2049te as an example, you can create a delta CHD like:

chdman copy -i sf2049tea.chd -op sf2049te.chd -o sf2049tea-delta.chd
mv sf2049tea.chd sf2049tea-abs.chd
mv sf2049tea-delta.chd sf2049tea.chd

You’ll now have a delta CHD that’s about 50 MB that can be used in place of the regular CHD that’s over 1 GB, provided MAME can find sf2049te.chd from the parent.

Of course, there are cases where few blocks can be shared – if you try this with fmtowns_cd:4ddrivinm you’ll only save about 2 MB.

@FoxhackDN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this potentially save a lot of space for parent / clone CHD sets that have the same audio track data?

@cuavas
Copy link
Member Author

@cuavas cuavas commented on d1172bf Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this potentially save a lot of space for parent / clone CHD sets that have the same audio track data?

It depends. You have to try it and find out. The data must be identical and at identical block offsets, or it won’t help.

@FoxhackDN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this comment here for posterity: No, it does not, at least not on my limited testing on NeoGeo CD. :)

@FoxhackDN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it back, I actually managed to create a delta of fatfury3 for the NeoGeo CD that was less than 200kb. It didn't work with the game I tried first (Double Dragon) because the parent has damaged tracks 1 and 2, so everything was out of whack - but for CDs that are properly dumped, it should work.

@Augusto7743
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cuavas
Thanks very much !

Please sign in to comment.