CHD batch for newly supported systems

if you know how to handle batch files, this should work:

@echo off
@cls
set rompath=E:\EMULATORS\ConsoleISO\PCE-CD
set destpath=F:\TMP
for /R %rompath% %%G in (*.cue) do (
	echo.
	echo === Converting %%~nG to CHD ===
	chdman createcd -i "%%G" -o "%destpath%\%%~nG.chd" -f
	echo.
	echo.
)

edit “rompath” and “destpath” to your setup. save with .cmd extension to where your chdman is and then run in a dos prompt.

Thanks for the fast reply, unfortunately it didn’t work too, the window opens and closes right away. My current folder structure for the isos are, X:\Hyperspin\Roms\Sega Saturn\Game Folder (Region)\Game.bin, Game.cue.

Lots of games have multiple bin tracks.

The batch worked fine converting GDI Dreamcast isos to CHD, but no dice on the Saturn ones.

you need to understand how batch files works, and edit as to match your setup. this config works for my system with every cue sheet in a folder even when theyre on sub-subfolders.

I edited the fields and it ended up like this:

@echo off @cls set rompath=K:\HyperSpin\Roms\Sega Saturn set destpath=K:\TMP for /R %rompath% %%G in (*.cue) do ( echo. echo === Converting %%~nG to CHD === chdman createcd -i “%%G” -o “%destpath%%%~nG.chd” -f echo. echo. )

Saved as cmd, when I double click it, the window closes real fast, I’m not sure if I have the latest chdman, nor if this is the problem here. Would you share your batch script?

Thanks again @wertz

you had “space” in your filenames/directory. here’s a modified one:

@echo off 
@cls 
set rompath=K:\HyperSpin\Roms\Sega Saturn 
set destpath=K:\TMP 
for /R "%rompath%" %%G in (*.cue) do ( 
echo. 
echo === Converting %%~nG to CHD === chdman createcd -i "%%G" -o "%destpath%\%%~nG.chd" -f 
echo. 
echo. 
)
1 Like

It lost format when I pasted back in the reply, but in the batch (cmd) file, it’s just like your last post.

All I’d need is this cmd file with your lines and chdman in the same folder, right? If so, it’s not working here.

here is whatsnew in the edited one i posted

"%rompath%"

1 Like

It now opened the window and started processing, which is a good sign, it’s like this:

=== Converting Mega Man 8 - Anniversary Collector’s Edition (USA) to CHD === chdman createcd -i “K:\HyperSpin\Roms\Sega Saturn\Mega Man 8 - Anniversary Collector’s Edition (USA)\Mega Man 8 - Anniversary Collector’s Edition (USA).cue” -o “K:\TMP \Mega Man 8 - Anniversary Collector’s Edition (USA).chd” -f

=== Converting Megaman X3 (Europe) to CHD === chdman createcd -i “K:\HyperSpin\Roms\Sega Saturn\Megaman X3 (Europe)\Megaman X3 (Europe).cue” -o “K:\TMP \Megaman X3 (Europe).chd” -f

=== Converting Metal Black (Japan) to CHD === chdman createcd -i “K:\HyperSpin\Roms\Sega Saturn\Metal Black (Japan)\Metal Black (Japan).cue” -o “K:\TMP \Metal Black (Japan).chd” -f

I assume it should create the CHD files under K:\TMP, but it didn’t create the files, the window actually process all folders, seem to read the cue files only and the compressed files aren’t created.

move chdman a line down like so:

@echo off 
@cls 
set rompath=K:\HyperSpin\Roms\Sega Saturn 
set destpath=K:\TMP 
for /R "%rompath%" %%G in (*.cue) do ( 
echo. 
echo === Converting %%~nG to CHD ===
chdman createcd -i "%%G" -o "%destpath%\%%~nG.chd" -f 
echo. 
echo. 
)
1 Like

Some major progress, I also downloaded the latest chdman

=== Converting Brain Dead 13 (USA) to CHD === chdman - MAME Compressed Hunks of Data (CHD) manager 0.188 (mame0188) Output CHD: K:\TMP \Brain Dead 13 (USA).chd Input file: K:\HyperSpin\Roms\Sega Saturn\Brain Dead 13 (USA)\Brain Dead 13 (USA).cue Input tracks: 2 Input length: 58:52:30 Compression: cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC) Logical size: 648,553,536 Error creating CHD file (K:\TMP \Brain Dead 13 (USA).chd): file not found Fatal error occurred: 1

How come it says “file not found”?

“K:\TMP \Brain Dead 13 (USA).chd”

you had a “space” after the K:\TMP \ instead of it to be K:\TMP
goto destpath line and delete that space. hopefully you are editing using notepad++ here.

1 Like

Yes, I’m using notepad++, and it’s seems to be working now, besides the space in TMP, I added the backslash also in …\Sega Saturn, which hadn’t it, it’s compressing now:

=== Converting Shining Force III - Premium Disc (Japan) to CHD === chdman - MAME Compressed Hunks of Data (CHD) manager 0.188 (mame0188) Output CHD: H:\TMP\Shining Force III - Premium Disc (Japan).chd Input file: K:\HyperSpin\Roms\Sega Saturn!new\Shining Force III - Premium Disc (Japan)\Shining Force III - Premium Disc (Japan).CUE Input tracks: 2 Input length: 52:42:04 Compression: cdlz (CD LZMA), cdzl (CD Deflate), cdfl (CD FLAC) Logical size: 580,557,888 Compressing, 17.9% complete… (ratio=62.0%)

I also put the H: folder as the temp folder since it will work faster from one HDD to another.

Can’t thank you enough for your help and patience.

1 Like

ok good to know. we should ask @markwkidd if he has the time to convert this into an executable tool with gui so it should be easier to use :smiley:

3 Likes

Would be really nice to have a GUI for users like me, I believe it would benefit millions of people out there!

Something to note, don’t use the chdman from that old GDI to CHD batch package. My old Dreamcast CHDs I converted with that don’t work with Redream. I had to reconvert my GDIs with the latest version. I think the other cores use the same library for reading CHDs, so ISOs converted with that old chdman might not work in those either. Best to use the one that comes with the latest MAME; it probably gives you better compression anyways.

1 Like

In this case, can the batch @wertz helped me with be tweaked to batch decompress if I need to use the newest chdman in order to make it work with the latest Dreamcast cores? Currently, I use NullDC which is working fine with all CHDs, but cores are updated really fast, so in the near future it will be probably surpass the standalone emulator. I also think it’s a good idea keeping both batches for compressing and decompressing so we can use them anytime we want, for applying patches or any other uses.

chd is not a very well documented compression system, ive read it doesn’t even included subchannels. keep original cuesheets/images somewhere safe and recompress if time comes that this is necessary.

This could be a problem, if compressing stuff is meant to save space, keeping a backup of original images may not be the ideal for majority, I believe.

You should be able to modify his batch with the extractcd command:

chdman - MAME Compressed Hunks of Data (CHD) manager 0.188 (mame0188)
Usage:
   chdman extractcd [options], where valid options are:
      --output, -o <filename>: output file name (required)
      --outputbin, -ob <filename>: output file name for binary data
      --force, -f: force overwriting an existing file
      --input, -i <filename>: input file name (required)
      --inputparent, -ip <filename>: parent file name for input CHD

Not sure if you have to use two output arguments or not. It looks like maybe -o could be the .cue, while -ob is the .bin.

My new Dreamcast CHDs don’t work in Reicast BTW, so I’m holding onto the old ones too for now. Didn’t try the new ones in NullDC or Demul yet.

1 Like

Can someone familiar with batches and chdman make a decompression batch? I’m about to copy some PS1 games to an Android device and will need them in PBP.