dosbox-staging / dosbox-staging

DOSBox Staging is a modern continuation of DOSBox with advanced features and current development practices.
https://www.dosbox-staging.org/
Other
1.28k stars 154 forks source link

Support MDF/MDS CDROM image files #3805

Open weirddan455 opened 2 months ago

weirddan455 commented 2 months ago

Are you using the latest Dosbox-Staging Version?

Different version than latest?

No response

What Operating System are you using?

None

If Other OS, please describe

No response

Is your feature request related to a problem? Please describe.

These are formats used by Alcohol 120%. Would be nice to support them. MDS is a small file that does the same job as a CUE file, only it's encoded in a binary format rather than text. MDF is the BIN equivalent. If we're lucky, all we would need to do is write some parsing code for the small MDS file to read track information and it can use the existing code for BIN/CUE.

Describe the solution you'd like

Write an MDS parser and see if it works.

Describe alternatives you've considered

Maybe there's existing code from another project we can use.

Add any other context or screenshots about the feature request here.

No response

Code of Conduct & Contributing Guidelines

Torinde commented 2 months ago

X supports MDF

johnnovak commented 2 months ago

MDF is the BIN equivalent.

Kinda, but MDF/MDS can be used to store CD images with disk-based protections. Not sure if X handles that or just reads the pure user data part. I guess handling the protection part could be tricky, but I'm pretty sure 99.9% of CD games for DOS don't use any disk-based protections (which makes MDF/MDS a bit of an overkill over ISO and CUE/BIN).

weirddan455 commented 2 months ago

Yeah, I think that's correct @johnnovak

We can probably get away without handling copy protections though. I know a few DOS games use LaserLock. Not sure if that one needs MDF/MDS or if BIN/CUE is good enough but we don't handle that currently.

IMO just getting this file format working at all for non-copy protected games would be a nice improvement.

johnnovak commented 2 months ago

IMO just getting this file format working at all for non-copy protected games would be a nice improvement.

Fair point, and probably all we need.

And just pointing out that supporting Win98 "officially" would open the floodgates in this area, too. Many Win9x-era games use disk-based protections.

weirddan455 commented 2 months ago

And just pointing out that supporting Win98 "officially" would open the floodgates in this area, too.

Are you planning on doing that?

We can look into implementing copy protections later as it would benefit a small minority of DOS games as well. That's a separate task in my mind. LaserLock is a more primitive one that appears to use a hidden directory. It probably needs some tinkering on the MSCDEX layer to get that working. Should be do-able but I haven't looked into it thoroughly.

The Win9x era had some more advanced copy protection schemes. I vaguely remember they worked based off some timings due to "wobbles" on the disk or something. I also remember using Alcohol 120% and managing to burn a copy of some of my games that worked without a no-CD crack so that's also possible, but harder.

Grounded0 commented 2 months ago

It would nice to have a list of games with optical disc copy protection scheme for DOS, Win16 and Win32s.

I think John Novak just pointed out that IF we were to officially support Win9x this would become another problem area. Can't see that happening since i don't see many people here motivated to solve issues with Monster Truck Madness (1996) for example.

I don't want to see this issue tracker turning into a dumping ground where people have very little motivation in actually resolving people's problems. The bigger the issue tracker gets less valuable it becomes as a means of project coordination tool.

johnnovak commented 2 months ago

I don't want to see this issue tracker turning into a dumping ground where people have very little motivation in actually resolving people's problems. The bigger the issue tracker gets less valuable it becomes as a means of project coordination tool.

I agree with that, in an abstract sense.

But we're in no danger of that at present, our issue tracker is in a good shape, and @weirddan455 is interested in working on adding support for this.

And just pointing out that supporting Win98 "officially" would open the floodgates in this area, too.

Are you planning on doing that?

No way 😬 Just pointed out this is yet another reason why we don't wanna go near Win98 emulation support. We don't even have enough "manpower" to finish the strictly DOS stuff that's in our pipeline (e.g., I will probably only get to the OSD stuff in a couple of years... which is fine, this is not a dayjob for me. But we don't want to bite more than we can chew).

Grounded0 commented 2 months ago

Yeah I agree that this is a good feature to add. I've seen MDF/MDS disc image dumps on archive.org for DOS/Win 3.x stuff that I couldn't use but had instead hunt down an ISO.

FeralChild64 commented 2 months ago

Here is another open-source project, supporting MDS format: https://cdemu.sourceforge.io/

MasterO2 commented 2 months ago

Here is another open-source project, supporting MDS format: https://cdemu.sourceforge.io/

Mirrored on Github as well: https://github.com/cdemu/cdemu

Grounded0 commented 2 months ago

But we're in no danger of that at present, our issue tracker is in a good shape, and @weirddan455 is interested in working on adding support for this.

Yeah I agree. This was directed at us hypothetically introducing an official Windows 9x support which almost everyone agrees is a bad idea for now.

My schizoaffective disorder has been getting much worse and I need to dial back my activities here. Hopefully nobody misinterpreted anything here as negative statements directed at them. 🙏

johnnovak commented 2 months ago

@Grounded0 It's all good man, and I wish you all the best ❤️

weirddan455 commented 2 months ago

@Grounded0 No worries, I didn't take offense to anything you said. I hope you feel better soon.

X supports MDF

I looked at what DOSBox-X was doing and they're not really supporting it properly. I was able to mount a .MDF image in X that doesn't mount in Staging but the .MDS file does not mount in either. They've got some different logic in their LoadIsoFile and it happened to load it as though it were an ISO file. This is likely to fail with images containing audio tracks because X has no parser for MDS.

Here is another open-source project, supporting MDS format: https://cdemu.sourceforge.io/

Mirrored on Github as well: https://github.com/cdemu/cdemu

I am familiar with the cdemu projecting, having used it myself for testing the physical CDROM implementation in Staging. They have a library called libMirage for parsing different image formats but unfortunately it has a dependency on glib. I really don't want anything else in Staging depending on glib as it has been problematic in our build system.

I might end end up using their code as a reference though. This is their MDS parser: https://github.com/cdemu/cdemu/blob/master/libmirage/images/image-mds/parser.c

I'd prefer to find documentation on the MDS specification but I've come up empty on that so far. It seems to be proprietary and cdemu probably had to reverse engineer it.

FeralChild64 commented 2 months ago

There is probably no official specification anywhere, just some reverse engineered documentation:

https://www.cryer.co.uk/file-types/m/mds/mds.txt http://forum.redump.org/post/41803/#p41803

weirddan455 commented 2 months ago

@FeralChild64 Better than nothing! Nice find.