alucryd / oxyromon

Rusty ROM OrgaNizer
Other
121 stars 13 forks source link

[Feature] Support hard disk and laserdisc with CHD #157

Open lemonadecbc opened 1 day ago

lemonadecbc commented 1 day ago

CHDMAN implements separate commands for handling hard disk and laserdisc CHD-files. Currently oxyromon supports only CD and DVD, CD being default. This causes issue when trying to process HD formatted CHD-files as oxyromon and chdman expects to output CUE-file, which is non-existent.

Please implement support for these chdman commands:

chdman createhd chdman createld

and

chdman extracthd chdman extractld

alucryd commented 12 hours ago

Thanks for filing both MAME issues. MAME support is severely lacking in oxyromon atm but I'll do my best to improve it. I can see several roadblocks that I'll need to overcome so I created a new branch and a PR to discuss things as I go along.

CHD is a very tricky format to deal with. AFAICT the only way to distinguish a CHD type is by looking at their metadata, there is no obvious way to tell them apart, such as a type field in their information, and they all have the same magic. The best I could come up with is https://github.com/alucryd/oxyromon/blob/feat/chd-hd-ld/src/chdman.rs#L655 They each seem to have different tags, and this is what I could compile from the chdman sources. Not sure why they made it so cryptic :/

In any case this should get the extract part going.

The create part is where it gets interesting. Currently oxyromon relies almost entirely on file extensions to make CHD format decisions, as redump conveniently chose CUE/BIN for CDs, and ISO for DVDs. Unfortunately MAME was not so thoughtful about the HD and LD naming scheme, and the CHD MAME DATs I'm looking at have no extension at all, making it impossible to distinguish hard disks from laser discs with the DAT alone. However the CHD files I could get my hands on appear to have distinctive magics, respectively RIFF for the laser disc, and RDSK for the hard disk, so I can start with that. It's probably not exhaustive but still a good starting point.