bottlesdevs / Bottles

Run Windows software and games on Linux
https://usebottles.com
GNU General Public License v3.0
6.42k stars 269 forks source link

[Request] A way to mount / unmount CD images when launching a program #959

Open TiBeN opened 2 years ago

TiBeN commented 2 years ago

Is your feature request related to a problem? Please describe. I am looking for a way to trigger a CD image mount before launching a program. In Lutris, i used "Pre-launch script" and "post-exist" script with simple bash script to trigger cdemu mounts / unmount. But i have not found a way in bottles to do this kind of thing.

Describe the solution you'd like The best solution would be a cdemu (best cd drive emulator in Linux) integration. Something like a "Mount image" option in Program options.

Describe alternatives you've considered The pre-launch / post-exit launch bash script like in Lutris is a cheaper solution but it works. It's just kind of a pain to have to create sh script file for each installed game only for that.

Additional context Just discovered Bottles yesterday and i found it very promising so i'm planning to migrate from Lutris to Bottles, mainly because i use lutris only as a Wine frontend. I'm a kind of old school gamer, i don't use any game platforms (gog, steam etc.) but my old physical games converted to CD ISO images.

My mount script is as simple as:

#!/bin/bash
cdemu load 0 '<iso-filepath>'
sleep 3
udisksctl mount -b /dev/sr0
sleep 3

It could be better i suppose, but it does not require root.

mirkobrombin commented 2 years ago

Related: https://github.com/bottlesdevs/Bottles/issues/948

Keeping the issue for cdemu implementation, thanks for reporting 🙏

TiBeN commented 2 years ago

Yeah, it looks like another use case for Pre-launch/Post-exit script feature. CDemu integration would be the most comprehensive solution but i don't know how difficult it could be to implement, especially in a Flatpak context which seems to be very rooted to Bottles.

Thanks for your quick feedback and for the work on Bottles, this tiny tool has the abilty to become the best Wine frontend ihmo.

WineBottles commented 2 years ago

this tiny tool has the ability to become the best Wine frontend ihmo.

I agree. As someone who recently came from Windows (and will never go back) but loves gaming. Bottles made it easy to get about 75% of my most played games up and running. It's fantastic.

The rest of my 25% games I would like to play either require further WINE/Proton changes by CodeWeavers/Valve/GE or very specific bug fixes here in Bottles which I have been slowly creating tickets for to not overwhelm you.

Keep up the amazing work @mirkobrombin !

prog-amateur2 commented 2 years ago

Hello a message on the forum lead me to this issue. I think that from January, I can kindly ask if there is any progress on this issue ? I would like to install an official .img USB image of Windows Office 2016 but it seams Bottles only accept .exe files.

Is there any workaround to make my Office working through Bottles ? Thank you very much.

lunalucadou commented 1 year ago

I also would like for this feature to be added.

With Lutris, I could easily specify pre-launch and post-exit scripts to mount and unmount ISOs.

With Bottles, even if I use the command arguments field to run commands prior to launch, I cannot mount ISOs, and using the "post-run script" variable, I cannot unmount them, either.

Flatpaks cannot access most of /usr/bin (not sure why; some executables are visible to Flatpaks despite having the same ownership and permissions as non-visible ones), and even if you use Flatseal to give Bottles full filesystem access, it does not see mount, unmount, cdemu, gnome-disk-image-mounter, etc. in /usr/bin. Even if you add /run/host/usr/bin to the PATH variable (source), these executables will not work because of calls to libraries which are in locations which are inaccessible to Flatpak.

Because there seems to be no way to utilize existing software to mount/unmount CD images, this would have to be something built into Bottles. (Alternatively: provide an installation method besides Flatpak for advanced users who understand the risks of forgoing Flatpak's sandboxing.)

arthurtaras commented 1 year ago

It seems Bottles already has an easy enough way to install from ISO disks without any issues.

  1. Create a directory for mounting on Windows Drive C inside Bottles, i.e. 'iso': mkdir iso
  2. Mount ISO as a loopback device with sudo: sudo mount -o loop <PathToISO> iso
  3. Inside Bottles go to Tools > Legacy Wine Tools > Configuration > Drives
  4. Add Drive D or any other letter as CDROM and set the path to /home/<user>/.var/app/com.usebottles.bottles/data/bottles/bottles/<bottle>/drive_c/iso where 'iso' is the directory you mounted ISO into

To unmount, sudo umount iso or restart the computer.

I disagree that this requires a special feature because you can't mount without sudo and automating sudo within the bottle defeats the purpose. Maybe you can visually facelift the legacy tool but that's about it

TiBeN commented 1 year ago

@arthurtarasov, The native Linux mount system is pretty limited compared to a solution like cdemu which supports a lot more image formats (cue/bin, mdf, img, ccd etc.) than simply iso and can handle a lot of protection systems which were common with Windows PC cd-roms (Safedisc, securom) with a true device emulation system. It also correctly handle audio-cds parts commonly used for music in games.

What's more, it is "client/daemon" designed so no "sudo" required.

yozachar commented 1 year ago

I was able to run an executable from an .img.

The D: drive showed up automatically later, but I was unable to access it via console.

Here's the console error messages

Y:\>Setup.exe

Y:\>01bc:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticator"
0180:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticator"
0310:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticator"
0420:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Security.Isolation.IsolatedWindowsEnvironmentHost"
052c:err:ole:create_server class {7d096c5f-ac08-4f1f-beb7-5c22c517ce39} not registered
052c:err:ole:com_get_class_object no class object {7d096c5f-ac08-4f1f-beb7-5c22c517ce39} could be created for context 0x4
052c:err:ole:create_server class {7d096c5f-ac08-4f1f-beb7-5c22c517ce39} not registered
052c:err:ole:com_get_class_object no class object {7d096c5f-ac08-4f1f-beb7-5c22c517ce39} could be created for context 0x4
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
0428:err:mscoree:LoadLibraryShim error reading registry key for installroot
01d0:err:seh:NtRaiseException Unhandled exception code c0000409 flags 1 addr 0x180065a4e
0698:err:service:process_send_command service protocol error - failed to read pipe r = 0  count = 0!
0670:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Security.Authentication.OnlineId.OnlineIdSystemAuthenticator"

Sure I didn't expect it to run flawlessly, but any pointers to fix these issues would help.