English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   project.TOSEC (amiga only) (https://eab.abime.net/forumdisplay.php?f=33)
-   -   CHD format (https://eab.abime.net/showthread.php?t=103203)

Ian 21 July 2020 14:02

CHD format
 
How does everyone feel about converting the tosec-iso dats to CHD format?

I am going to be doing this myself anyway, (I have already done this with my completed redump sets) and have a full collection of Amiga isos, so can create a set of dats if anyone else thinks this is a good idea considering it's reversable.

ransom1122 21 July 2020 14:39

Sounds promising... But you need to convert from bin/cue to chd, i dont think you can go from iso direct to chd...

However you decide, the process is going to take a long time even with a fast pc.

Ian 21 July 2020 14:48

I did the 3DO reump set this morning, when you have enough cores, you can just leave it running and still do what you need, so all good in that respect.

I didn't know it didn't support iso, will give it a try now.

EDIT: Worked fine on Alfred Chicken, iso and wavs all converted.

Mikerochip 21 July 2020 15:34

It'll work fine on ISO and ISO/WAV once you have a .cue file.

Not sure if it'll work on ISO/MP3, but, then, why would you want that anyhow..

I converted what I wanted from the set a while back, no problems so far.
I also converted a fair few other non official ones, all worked fine too.

(To be fair, I expected none)

Ian 21 July 2020 17:40

I don't seem to be able to convert them back afterwards, can do it no problem with redump sets, think the iso format and mode 1 2048 is causing issues here.

I'm sure I can convert them all no problem and have them work in WinUAE, but if they cannot be returned to their original state I don't see the point in the exercise. I guess I could convert them all, and share some dats, it will just be a pain in the ass if anything ever gets updated.

Mikerochip 21 July 2020 23:47

Convert the .iso to a .bin first? then convert that to a .chd.

It'll revert to the .bin file no problem then.

Ian 22 July 2020 00:33

That worked, thank for the tip, probs would've eventually tried that. Also the bin files don't have headers so don't work as wavs, but I have found something that sorts that out.

Upshot is, I converted to CHD and then back to iso and wav with matching SHA-256 hashes so this is definitely doable for sure.

I should probs work on a couple of bats to do the conversion to make it easy and set it running.

Thanks for the tips Mikerochip, been a great help!! :D

Ian 22 July 2020 01:46

This is what I've knocked up and it creates matching files without any issues from CHD to iso&wav, I am bang average at batch files though, so this could probably be improved, at the moment is just a bunch of for loops.

Code:

SET PATH=C:\Program Files\7-Zip

for %%g in (*.chd) do (
        .\1-files\chdman extractcd -i "%%g" -o "%%~ng.cue" -ob "%%~ng.bin"
)

for %%h in (*.cue) do (
        .\1-files\binmerge\binmerge.exe -s "%%h" "%%~nh.new"
        .\1-files\bin2wav.exe "%%~nh.new.cue"
        .\1-files\piso convert "%%~nh.new (Track 01).bin" -o "%%~nh.new (Track 01).iso"
        del /F /Q "%%h"
)

for %%i in (*.bin) do (
        del /F /Q "%%i"
)

for %%j in (*.chd) do (
        7z a -tzip "%%~nj.zip" "*.new (Track*.*"
        del /F /Q "*.new*.*"
)

So loop 1 converts the CHDs to cue and bin.

Loop 2, splits the bin, converts the bins to wave, also the data track back to iso and deletes the cue sheet created from the CHD.

Loop 3 deletes all the unneeded bin files

loop 4 zips up the iso and wavs, as cuesheets are provided from tosec not much point going through the ball ache of renaming all the files, and generating a matching cuesheet as this will all be fixed when run through clrmame.

I guess I could nest the 2, 3 and 4th within the first one so it works on 1 chd, does all the tasks then starts the next one kinda like this:

Code:

SET PATH=C:\Program Files\7-Zip

for %%g in (*.chd) do (
        .\1-files\chdman extractcd -i "%%g" -o "%%~ng.cue" -ob "%%~ng.bin"

        for %%h in (*.cue) do (
                .\1-files\binmerge\binmerge.exe -s "%%h" "%%~nh.new"
                .\1-files\bin2wav.exe "%%~nh.new.cue"
                .\1-files\piso convert "%%~nh.new (Track 01).bin" -o "%%~nh.new (Track 01).iso"
                del /F /Q "%%h"
        )

        for %%i in (*.bin) do (
                del /F /Q "%%i"
        )

        for %%j in (*.chd) do (
                7z a -tzip "%%~nj.zip" "*.new (Track*.*"
                del /F /Q "*.new*.*"
        )
)

probs ugly as fuq for someone that knows what they are doing :crazy:laughing

All suggestions welcomed :)

Ian 22 July 2020 15:54

As ever, testing as you go throws up more issues....

Convert from ISO and WAV to CHD
Code:

SET PATH=C:\Program Files\7-Zip

for %%i in (*.zip) do (
        7z e "%%i"
        for %%g in (*.iso) do (
                if exist "%%~ni.cue" ren "%%~ni.cue" "%%~ni-original.cue"
                .\1-files\piso -y convert "%%g" -o "%%~ng.bin"
                if exist "%%~ni.cue" ren "%%~ni.cue" "%%~ni-piso.cue"
                if exist "%%~ni-original.cue" ren "%%~ni-original.cue" "%%~ni.cue"
                .\1-files\ssr.exe -w "%%g"="%%~ng.bin" "MODE1/2048"="MODE1/2352" "%%~ni.cue"
        )
        .\1-files\chdman createcd -i "%%~ni.cue" -o "%%~ni.chd"
        if exist "*[Track*.*" del /F /Q "*[Track*.*"
        if exist "%%~ni.cue" del /F /Q "%%~ni*.cue"
        if exist "%%~ni.bin" del /F /Q "%%~ni.bin"
        if exist "%%~ni.iso" del /F /Q "%%~ni.iso"
        if not exist .\Originals md Originals
        move "%%i" ".\Originals\%%i"
)

Convert back to ISO and WAV (this is where the fun began - appears TOSEC have added index's to the audio on some cue's, which results in the conversion tool making 2 wavs for each track - probs something else that can do it but this does it and I assume 1:74 is a standard pregap length so will pop up elsewhere)

Code:

SET PATH=C:\Program Files\7-Zip

for %%g in (*.chd) do (
        .\1-files\chdman extractcd -i "%%g" -o "%%~ng.cue" -ob "%%~ng.bin"
       
        for %%h in (*.cue) do (
                .\1-files\binmerge\binmerge.exe -s "%%h" "%%~nh.new"
                .\1-files\ssr.exe -w "    INDEX 00 00:00:00\r\n    INDEX 01 00:01:74"="    INDEX 00 00:00:00" "INDEX 00"="INDEX 01" "%%~nh.new.cue"
                .\1-files\bin2wav.exe "%%~nh.new.cue"
                if exist "%%~nh.new (Track 01).bin" .\1-files\piso convert "%%~nh.new (Track 01).bin" -o "%%~nh.new (Track 01).iso"
                if exist "%%~nh.new (Track 1).bin" .\1-files\piso convert "%%~nh.new (Track 1).bin" -o "%%~nh.new (Track 1).iso"
                del /F /Q "%%h"
        )
        del /F /Q "%%~ng*.bin"
        7z a -tzip "%%~ng.zip" "*.new (Track*.*"
        del /F /Q "*.new*.*"
)

So the tools needed are:
A registered version of poweriso (the free version doesn't do iso's over 300mb) - If anyone knows something free that will convert iso to bin and bin back to iso then please let me know and I will replace this.
Bin2Wav
SSR
Binmerge - this is a python3 script, I have converted it to an exe to suit this purpose but the folder is now 20 mb's due to all the library's it needs to run.
chdman which can be obtained from any MAME distro.
7-zip

All these need to be placed in a folder called 1-files in the directory of the isos you want to convert. as does the code saved as whatever_you_want.bat

The CHD converter moves all the original zips into another folder in the directory you are running it from, for safety.

If you know what you are doing and can do some of this better than this, please let me know.

It's currently working through the games folder, when it's done I will create a dat and see how it goes.

Radertified 22 July 2020 16:21

AnyBurn is free and is able to convert between ISO and BIN/CUE: http://www.anyburn.com/download.php

It has a command line program included:

abcmd convert xxx.iso -o xyz.bin (and vice versa)

Ian 22 July 2020 19:49

Cheers for that, will look into replacing power iso with that.

3 files do not convert so hold off on using this anyone that is interested in this.

These are the 3 that don't work correctly if you want to do it and maybe have a look at these manually:

cannon fodder (1993)(virgin)[amiga-cd32]
center court tennis 2 (2016-07-21)(fritsche, gernot)(fw)[!]
d-generation v1.0 (1993)(mindscape)[b]

Looks like it's because my copies of centre court and d-generation didn't have cue files so you maybe OK with those.

Cannon fodder has two iso's which is why that hasn't worked, will have to think on this one.

Mikerochip 22 July 2020 20:32

If you don't have a .cue, just make one!

FILE "track01.iso" BINARY
TRACK 01 MODE1/2048
INDEX 01 00:00:00

Save those 3 lines to a cue and rename the iso file as needed.

For things like cannon fodder, or PC Engine games, open the .cue in ISOBuster, and export it out as one single .bin file, and chd that.

That'll give you one single bin with both tracks, and one single .cue.
(Make sure when saving the .bin file, when the windows file picker opens, drop down the file type and pick .bin)

This will work for any kind of CD with multiple tracks/mixed track types.

If you get really stuck, open the .cue with something like Daemon Tools (lite, which is free) and use ISOBuster to export out the virtual CD drive to a raw .bin file.


If you want to use Daemon tools in a batch file:

C:\Progra~1\DAEMON~1\DTAgent.exe -mount dt, 0, %1

<do some stuff>

C:\Progra~1\DAEMON~1\DTAgent.exe -unmount 0

Ian 22 July 2020 20:46

Thanks Mikerochip, I am guessing it would be impossible to return Cannon Fodder back to so it matches TOSEC again using the above method?

I'm not sure why I think this is important, I guess it's because if Tomse doesn't like it and doesn't use the format, if there are any changes it will mean the files won't convert back to how they were for renaming and verifying.

Mikerochip 22 July 2020 22:12

Yeah, I understand.

Why TOSEC persist with that stupid split track setup I don't know.
(It's not representative of an actual CD. Or well, not accurately representative enough)
(Which is the whole reason Redump.org and TruRip etc exist)

You can create a new CD from the individual tracks that doesn't even remotely match the original, so, why bother with it.
Everyone else has moved on to whole disk images (Where this wouldn't be a problem).

Anyhow!

Use ISO Buster again,
once you do the above: create the new single .bin file with both tracks,

open the new .cue file in ISO Buster, and select each track one by one:
Right click on it, "Extract Trackxx" --> then select "Extract RAW but convert to user Data .iso" or similar.

(Since, I assume, the old tracks were 2048 sector, and in the new .bin, tracks will be 2352 sector tracks)

Do the hashes match?
(I presume they will, but, you'll have to try it)

You can automate ISOBuster, but, I've never bothered since every time I want to use it, it's a specialist job I have to do by hand anyhow.

Well, WinUAE supports .chd files since forever (thanks!!) so, using it shouldn't be a problem, with emulation anyhow.
Not sure if FS-UAE supports it or not.

And, if you want to burn the disk image, a simple:

chdman.exe extractCD -i "path to .chd" -o "path to new .cue" -ob "path to new .bin"

And you can just burn the new .cue file to a CDR, using a DAO mode or similar, depending on your software.
Most CDR burning software has supported DAO modes since around 1998 ish, so, it'll be hard to find one that doesn't support it!
Usually it's enough to just point to the .cue file and burn it.

(And remember kids, the speed you burn the CD-R at makes *no difference*. Slower burning (1x-4x) will result in an almost identical CD-R to a 24x burn speed CD-R, it will just suck up more of your time.
That piece of disinformation has been around since people had cheap shitty media with worse burners and woefully slow PC's)

Ian 22 July 2020 22:55

1 Attachment(s)
Will see if I can automate it using isobuster.

I kinda don't care enough at this moment though, it's just one game. I think one bit is mode1/2048 and the other is mode2/2336, very weird, don't really understand it enough though, lucky to get this far :D

I have created a dat for all the others though if people want to give it a try.

Don't select sets when scanning as clrmame wants everything in a sub folder then.

Rename .txt to .dat after downloading.

Edit: I just converted Cannon Fodder manually and let CHDMAN do all the conversion, pretty sure it will never go back to the original now, but the game works.

I now have a fully legal set of files, it compresses to 11 mb though so too big to attach, if anyone wants it let me know and I will put it in the zone or something

Mikerochip 22 July 2020 23:11

Ah!

Mode2/2336 is actually an MPEG file as a track.

You can extract as per instructions above, and it should match.

but, just for yourself to check it out, you can right click, extract track02 --> Treat as Video only, and you'll get a lovely (and playable) .mpg video file at the end.

It's quite rare. I've only seen a few games using Mode2/2336. (It's almost always used for mpeg video files when it is used, I think)

edit: yup, I tried it, it's the opening "War" video / song.

Ian 23 July 2020 00:15

2 Attachment(s)
Here are the two batch files for iso's, rename as .bat or .cmd.

Use at your own risk. It doesn't actually do anything with the original archives other than move them to another folder so you should be OK no matter what happens.

Both these now using abcmd.exe from anyburn as suggested by Radertified not poweriso. just copy the abcmd and anyburn.exe into the 1-files folder if you've had any interest in this and download the files yourself.

Ian 27 July 2020 16:34

1 Attachment(s)
Sadly, these batchfile only work when the files inside the zips are named the same as the zip, sadly this isn't the case, several of the zips have been renamed without the files inside being renamed and some cuesheets haven't got the correct names in either (eg track 1 written on all entries).

With the bat's you will it will probably pause asking you to overwrite a cuesheet, or it will leave a cuesheet in the directory and move the zip to the originals folder.

I'm sure these aren't issues someone could get around, even as I type this I am thinking it could be avoided with an if exist name.chd move name.zip etc. at the end.

Anyway, I have done all the dats, these are all named correctly as they used the zip names anyway.

Hopefully they get added to TOSEC either as an option or to replace the [ISO] dats

Slight error in these dats, the I didn't change the descriptions on some of the CDTV dats, should be fixed in the updated zip.

Retroplay 27 July 2020 16:53

1 Attachment(s)
I use these scripts when I need to do batch converting from archives to CHD (useful for MAME software list games).
7zip and chdman must be in path.
Just edit "workdir" and "destination" path to your own preference.

Radertified 27 July 2020 17:16

Quote:

Originally Posted by Ian (Post 1416422)
Hopefully they get added to TOSEC either as an option or to replace the [ISO] dats

I'd love for them to replace the ISO dats. A single CHD that contains everything is the ideal situation and I'm all for it. I just don't see it happening without widespread support for CHD in burning (eg. ImgBurn) or mounting (eg. Virtual Clonedrive, Alcohol, Daemon Tools) programs. Sure it's possible to extract a BIN/CUE out of a CHD but that's an unnecessary extra step when ISO and BIN/CUE don't need it at all.


All times are GMT +2. The time now is 20:26.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04838 seconds with 11 queries