joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.83k stars 383 forks source link

Mounting DVDs #2184

Open almeath opened 3 years ago

almeath commented 3 years ago

I would like to request a feature to be able to mount DVD images within a Windows 9x environment in DOSBox-X. I do not mean support for playing movies specifically, but just the ability to mount them within the virtual drive in order to install and play supported games; for example, Riven, Wing Commander IV, JMP Legacy of Time etc. Most of these DVD games had enhanced graphics and sound making them superior to their CD version. It is also a bit of a hassle to swap through 5 or 6 CDs during play.

I saw some conversations about this over the last few years, but no clear work-arounds. I have not tried using a virtual CD mounting program because I understood that there is a limit to the volume size that can be accessed anyway, or am I mistaken? I also read that programs like Daemon tools require many extra extensions and components such as IE4 which will tend to bog down Windows 95 with extra bloat and affect overall performance.

So, it would be great if such a feature could be built directly into DOSBox-X, as the simplest method with no performance impact.

joncampbell123 commented 3 years ago

There's no limit to the size of the ISO allowed, unless DOSBox-X inherited some limit from SVN at the time X began as a fork.

The only possible limit I can think of is a possible 2GB limit if the ISO image support is not using fopen64/lseek64. Other than that, 4GB+ ISOs should mount just fine, whether they use ISO 9660 or UDF.

However, if the game is explicitly asking the drive the media type, that is the only DVD-related thing DOSBox-X does not emulate yet. Windows 95 (and the game) will always think it is CD-ROM. Does it check the media type, and does it require the drive to report a DVD-ROM?

As far as I am aware, UDF filesystem support requires Windows 98 or later. The ISO image will need to be formatted as ISO 9660 for Windows 95 and earlier. It's possible that like most discs, the ISO may have been authored with both ISO and UDF filesystem structures, and if it supports Mac OS, with HFS/HFS+ as well. Hybrid discs are possible that way. All three filesystem structures can coexist on the same disc and ISO image.

almeath commented 3 years ago

Thanks for this feedback, I will have to go back and check each game. I just recall that when I tried to mount one of the DVDs using the standard commands, it failed to show up at all within Windows - it looked like no CD/DVD drive was connected. I will perform some more tests and report back.

almeath commented 3 years ago

I tested this using two games, Riven and The Journeyman Project 3 Legacy of Time. Riven is a hybrid Mac-PC DVD and JP3 is Windows only.

Riven

  1. ISO confirmed as properly ripped and not corrupt. It installs and launches properly in a VMWare Fusion VM and also in SheepShaver emulating MacOS 9.
  2. Fails to mount in DOS command prompt in DOSBox-X ; it says "Drive D does not exist"
  3. Fails to mount in Windows 98 SE in DOSBox-X ; it says it is "either not a ISO/BIN file or contains errors"
  4. I tried dragging the image contents to a folder, and then copied that into my DOSBox-X hdd and installed the game in Windows 98 from that folder. It installs and runs properly, but fails at the point where it is asking for the DVD. So that likewise confirms no corrupted data.
  5. VirtualCloneDrive fails to mount the image within Windows 98 in DOSBox-X. It treats the media as invalid or corrupt.

Legacy of Time

  1. ISO is likewise confirmed as properly ripped. It mounts, installs and plays in a VMWare Fusion VM.
  2. It mounts successfully as D drive in DOS command prompt in DOSBox-X.
  3. In Windows 98 in DOSBox-X it also mounts, but all the executables show up as generic icons, and running them tells me they are not valid Win32 applications.
  4. If I drag the contents off the image in VMWare and transfer to a folder, I can again install the game and launch it successfully within Windows 98 in DOSBox-X. Again, it only fails at the point it expects the DVD to be present.
  5. Unlike Riven, the DVD does appear to be present - it shows up as D drive in Windows and displays the full directory structure and file contents, but Windows is not recognizing that a DVD is actually available from within the game.
  6. Looking at the properties of the D drive, it says it is a CD-ROM (CDFS).
Wengier commented 3 years ago

I have checked it myself, and I think it really depended on the size of your ISO image(s). For example, I found that it was not able to mount a 3GB ISO image of mine, so I have fixed it in #2186. If you use Windows, you can try the updated Windows binary here:

Please check it out.

almeath commented 3 years ago

I am using a Mac, but is that update reflected in the main repository if I download the source from Github? I could compile my own binary to test it out..

For the record, both of the ISOs I have tested are 4.03 to 4.34GB in size, being DVD images. Perhaps I need to manually create an ISO in the 2-3GB range and try that too.

Wengier commented 3 years ago

@almeath The update should be reflected in the main repository shortly, but for now you can just use the repository I linked to for compiling the code.

almeath commented 3 years ago

Thanks, I will test that as soon as possible.

I took your other advice and tested a self-created 1GB ISO using ImgBurn, which opened in the command prompt and also in Win98. I repeated the exact same process but made it 4GB and it fails as originally reported. So it definitely appears to be related to the overall size of the images.

almeath commented 3 years ago

I compiled from the main repository and I can confirm that the changes made in #2186 have fixed the bug with mounting 4GB+ images. I tested both the Riven and Journeyman Project DVDs via command prompt, Windows 95 and 98 and it works in all three instances. Thanks for your prompt action on this.

As mentioned above, there are separate issues due to the format of the DVD images (perhaps they are hybrid UDF/ISO9660 etc) but I have been able to work around those by copying the contents out of the DVD image into a HDD image created using the image make command. The secondary hard drive is mounted and identified as D drive. The Journeyman Project will install off the hard disk image in Windows 98 (as I am using Win95b which will not recognize fat 32, but in theory OSR2 should work). I do not know why this fixed it, but it is at least a viable work-around. I will see if Riven can be made to work in the same way.

One more thing, if anyone is reading up on this, Journeyman Project 3 will benefit from installing Qucktime 6.4 and enabling the sound out to "wave out", otherwise there will be stuttering when the movies are playing back. Otherwise, it works perfectly.

joncampbell123 commented 3 years ago

On most systems, even 64-bit, "int" is still signed 32-bit. Using "int" for the size of a CD limits it to 2^31 bytes aka 2GB. Changing the datatype to int64 allows the code to support >= 2GB ISO images.

almeath commented 3 years ago

Thanks for the explanation. I should add that before resorting to HDD images I did simply try copying the contents into a new image with UDF+ISO9660+Joliet format, but the same issues occurred with Windows 95/98 not recognizing the files with the Win32 error. For some reason I do not understand, moving things into a formatted HDD image fixes this.

Farooq87 commented 3 years ago

@Wengier I have the same issue. With this update Dosbox-X CD-Drive anyway doesnt see more than 2 gb on 4 gb image bug3

Farooq87 commented 3 years ago

As for the UDF DVD I tried to create new image with this format and Dosbox-X didnt recognize CD-Rom at all after I mounted it in config imgmount a Windows98.img imgmount c drive.img -ide 1m imgmount d XFiles.iso -t cdrom -ide 2m imgmount e drive2.img -ide 1s boot -l c

Farooq87 commented 3 years ago

@joncampbell123 "On most systems, even 64-bit, "int" is still signed 32-bit. Using "int" for the size of a CD limits it to 2^31 bytes aka 2GB. Changing the datatype to int64 allows the code to support >= 2GB ISO images."

Could you please explain where exactly should I change int on int64?

joncampbell123 commented 3 years ago

@Farooq87 Without looking at the code right now... the variable used to compute the file offset needs to be int64_t or Bit64s for a 64-bit signed int, then used with fseek64/lseek64 or platform appropriate library function for moving the current file position with a 64-bit offset.

joncampbell123 commented 3 years ago

@Farooq87 src/dos/cdrom_image.cpp line 758, I think I can fix it up. Note how it assigns the seek offset to int seek;

joncampbell123 commented 3 years ago

Uh, except that the underlying file it calls on takes an int offset. Might take more work. Hold on.

joncampbell123 commented 3 years ago

Try the latest commit, it should allow 2GB or larger ISO images to work now. At least on my end, it is now possible to browse a ~9GB ISO/UDF image in Windows 98.

Farooq87 commented 3 years ago

@joncampbell123 Yep I see commit. How can I download this fix? Or will you incorporate it in future 0.83.12 version?

rderooy commented 3 years ago

You need to recompile the code or wait for the next release.

A new release should be out soon, to fix another issue with 0.83.11 when installing Win9x.

Wengier commented 3 years ago

@Farooq87 Since you use Windows, you can also download an updated Windows 64-bit SDL2 binary I built here:

Farooq87 commented 3 years ago

@Wengier I tried it but with no success I have never recompiled code before. Clarify please to me. I must download source for latest Dosbox-X, extract SRC to Dosbox-X folder and then edit both files there. Right?

Wengier commented 3 years ago

On the Windows platform, the easiest way to build the source code is to use Visual Studio 2019. Download the whole code from the repository, launch VS2019 and open the “solution” in the vs2015 directory, select a target (e.g. x64 SDL1) and start to build the code. Wait for it to finish. More information can be found from this page:

https://github.com/joncampbell123/dosbox-x/blob/master/README.source-code-description

Torinde commented 1 year ago

Mounting UDF directly in the DOSbox-X shell would be useful for big images. Also, EDR-DOS (and dosemu2?) support FAT+ with up to 256GB files.

Related:

joncampbell123 commented 1 year ago

DOSBox-X already supports UDF, if you set the DOS kernel version to 7.10 (Windows 98) or higher.