MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Threaded Mode Threaded  

Pages: 1

John IV
IV/Play, MAME, MAMEUI
Reged: 09/22/03
Posts: 1967
Loc: Washington, USA
Send PM


Space savings from new CHD delta feature
#397228 - 10/21/23 08:04 PM


So Vas added the ability to load a delta of a CHD child which could lead to a significant space savings in CHD storage.

https://github.com/mamedev/mame/commit/d1172bf710f2a7b1777ed7687f5ba65748d90ee9

Does anyone have a batch file or similar to automate this across all your CHDs?

Per Vas:

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

Code:


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




john iv
http://www.mameui.info/



John IV
IV/Play, MAME, MAMEUI
Reged: 09/22/03
Posts: 1967
Loc: Washington, USA
Send PM


Re: Space savings from new CHD delta feature? new [Re: John IV]
#397234 - 10/22/23 04:45 AM


Pretty cool, as an example Golden Tee Fore! 2004's clone went from 1GB to 90MB.

It'll be interesting to see if there'll be a new torrent just for deltas.

Note, if you're doing some converting be aware that clrmame will flag the chds as missing and not recognize the delta version.

Edited by John IV (10/22/23 04:48 AM)



john iv
http://www.mameui.info/



John IV
IV/Play, MAME, MAMEUI
Reged: 09/22/03
Posts: 1967
Loc: Washington, USA
Send PM


Re: Space savings from new CHD delta feature? new [Re: John IV]
#397235 - 10/22/23 08:56 AM


The biggest clone CHDs, the 10GB+ kpython2.cpp games delta down to 2GB.



john iv
http://www.mameui.info/



joey35car
MAME Fan
Reged: 02/07/07
Posts: 1095
Loc: Planet Claire
Send PM


Re: Space savings from new CHD delta feature? new [Re: John IV]
#397236 - 10/22/23 05:46 PM





joey35car
MAME Fan
Reged: 02/07/07
Posts: 1095
Loc: Planet Claire
Send PM


Re: Space savings from new CHD delta feature? new [Re: John IV]
#397237 - 10/22/23 05:48 PM


So this only works on clone CHDs?



John IV
IV/Play, MAME, MAMEUI
Reged: 09/22/03
Posts: 1967
Loc: Washington, USA
Send PM


Re: Space savings from new CHD delta feature? new [Re: joey35car]
#397238 - 10/22/23 06:27 PM


Yes, it basically creates a diff between the existing clone and the parent, which can share a lot of data. The space savings can be enormous for a full set collection. I already shaved off 20GB with just four CHDs converted.

Also, Roman just cranked out a test .exe of cmpro if anyone wants to test it before he releases a full build.

https://www.emulab.it/forum/index.php?topic=9148.0

Note the conversions take a while if you haven't dealt with CHD 'editing' in a bit, as it has to do a validate extract and re-compress.



john iv
http://www.mameui.info/



John IV
IV/Play, MAME, MAMEUI
Reged: 09/22/03
Posts: 1967
Loc: Washington, USA
Send PM


Re: Space savings from new CHD delta feature? new [Re: John IV]
#397245 - 10/23/23 09:24 AM


200GB saved so far with just the biggest 12 clone CHDs.



john iv
http://www.mameui.info/



joey35car
MAME Fan
Reged: 02/07/07
Posts: 1095
Loc: Planet Claire
Send PM


Re: Space savings from new CHD delta feature? new [Re: John IV]
#397265 - 10/25/23 06:41 AM


Nice. Hopefully some sites like PD will have these converted one day so we don't have too. 😁

Thanks



joey35car
MAME Fan
Reged: 02/07/07
Posts: 1095
Loc: Planet Claire
Send PM


Re: Space savings from new CHD delta feature new [Re: John IV]
#397270 - 10/25/23 07:36 PM


OK so far I converted one game and works fine. Anyone know how to create a batch file so it can do all the clones automatically instead of renaming the files one by one in the batch file?

Thanks

Edit: Well I guess I'm in the mood to do it one by one. Not to many.



joey35car
MAME Fan
Reged: 02/07/07
Posts: 1095
Loc: Planet Claire
Send PM


Re: Space savings from new CHD delta feature new [Re: John IV]
#397271 - 10/25/23 09:23 PM


I used this batch file to convert all my ISO and Cue to CHDs automatically. Maybe something similar could be used for the delta.

for /r %%i in (*.cue, *.iso) do chdman createcd -i "%%i" -o "%%~ni.chd"



John IV
IV/Play, MAME, MAMEUI
Reged: 09/22/03
Posts: 1967
Loc: Washington, USA
Send PM


Re: Space savings from new CHD delta feature new [Re: joey35car]
#397272 - 10/25/23 09:31 PM


Roman's getting close see the link above for his thread on the cmpro forum.



john iv
http://www.mameui.info/



Roman
Regular
Reged: 09/21/03
Posts: 1583
Send PM


Re: Space savings from new CHD delta feature new [Re: joey35car]
#397278 - 10/26/23 09:01 AM


The problem with a batchfile is that you need to know the parent/clone relationship of sets and the exact storing position of each chd file.

So you need to provide the clone chd filename and the belonging parent chd filename to chdman to create a delta out of it. There is no rule in naming/storing, so a general batchfile is not possible without having the parent/clone relationship accessible from somewhere and the relations can theoretically change with each MAME version.

So...it sounds more like a job for a tool which knows the current -listxml/-listsoftware output, runs through folders collecting chd sha1s, finding the pairs in the xml data and creates an output (either a batchfile or directly calling chdman)....and surely it should also support revert in case a delta chd lost its parent...



joey35car
MAME Fan
Reged: 02/07/07
Posts: 1095
Loc: Planet Claire
Send PM


Re: Space savings from new CHD delta feature new [Re: Roman]
#397279 - 10/26/23 09:35 AM


Thanks for the explanation. Hopefully you can incorporate this in clrmamepro one day.



Roman
Regular
Reged: 09/21/03
Posts: 1583
Send PM


Re: Space savings from new CHD delta feature new [Re: joey35car]
#397280 - 10/26/23 09:58 AM


I did already..need a day or two for some more testing....busy with real life.

https://www.emulab.it/forum/index.php?topic=9148.msg25902#msg25902

Actually writing a standalone tool would be easy, too with the core I already got for the new rebuilder (all the xml loading/parent/clone relationship stuff is in there)...and doing a folder walk and reading chd sha1, storing them in a hashmap plus calling chdman...no big deal...however...no time currently...



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4457
Loc: Melbourne, Australia
Send PM


Re: Space savings from new CHD delta feature new [Re: Roman]
#397284 - 10/26/23 11:42 AM


You’re obviously adding functionality to your own tool, but it would be relatively easy to do in any scripting language with XML DOM support. PowerShell and Python both have everything you’d need to load the XML and drive chdman.



Roman
Regular
Reged: 09/21/03
Posts: 1583
Send PM


Re: Space savings from new CHD delta feature new [Re: Vas Crabb]
#397285 - 10/26/23 11:51 AM


Yes of course it's possible with all kind of solutions which are able to take the XML into account and run through folders...
All I said was that a static batchfile without taking the xml into account or just writing down a for loop or having hardcoded filenames won't generally work.

I'm sure there will be someone who writes a powershell/python/whatever script....feel free



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9713
Loc: ECV-197 The Orville
Send PM


Re: Space savings from new CHD delta feature new [Re: John IV]
#397288 - 10/26/23 08:10 PM


The usual disclaimer applies: if you're doing this, keep a backup of your original CHDs, or wait for the next MAME to see if the early adopters end up having to redownload their entire set ;-)


Pages: 1

MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 20 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 676