DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.17k stars 39 forks source link

Option to download proton and wine versions to a universal folder and add to clients via symlinks #286

Open Killrmemz opened 10 months ago

Killrmemz commented 10 months ago

Having separate copies of Proton/Wine for Bottles, Lutris, Heroic, and Steam can be rather space inefficient. Having to download the same versions multiple times is network inefficient and takes longer. So I propose, downloading to a single folder, and registering symlinks to relevant applications. Of course, for the Flatpaks among the clients, it would need to be a location where each of them has permission to read, but that can be dealt with either by storing them in a default location they all share, or by adding explicit read permissions to the folder with a button. When installing a new Proton or Wine version to a client, versions that already exist can have [Installed] listed next to their names in the list.

sonic2kk commented 10 months ago

Related: #162

A custom download directory may solve this. Using the same custom directory for multiple launchers would probably resolve this, though I didn't test.

You can choose the custom download directory by pressing the three dots button beside the launcher drop-down.

It should also be noted that for Proton, while it is not designed for use outside of Steam despite other launchers providing support, many of those will pick up Proton versions in compatibilitytools.d (and elsewhere for Valve Proton releases). So when you install a Proton version for Steam, Lutris and Heroic at least should pick it up.

Of course, this doesn't apply to Wine-GE and such with Lutris, so you still end up with the space-inefficiency you mentioned when dealing with Wine builds. This can be especially annoying with Tkg builds which can exceed 1gb.

Killrmemz commented 10 months ago

In that case, and since Heroic and Lutris using Steam's own Proton versions didn't cross my mind, I can revise my idea just a little: If a Proton version is installed to Steam, it will show up in Heroic and Lutris, but greyed out with a steam icon next to it. However, they will still be installed to a universal folder, and the Steam install should still be a symlink, so that Bottles can be symlinked into the proton versions as well, since it does not support running bottles out of compatibilitytools.d prefixes. This can allow Lutris and Heroic to still have independent proton versions, but give a visual indicator that they can see and utilize what's installed to Steam. Wine versions remain unchanged, and still symlink to everything that supports them.

DavidoTek commented 10 months ago

As sonic2kk pointed out, for now you can use the custom install folder option (... button) and add the symlinks manually.

In theory we could add modify the logic to install compatibility tools to some ProtonUp-Qt related directory and then simlink the tool to either all launchers or let the user choose which launcher should receive that tool.

I found this comment in # 162. Do symlinks to Proton actually work? https://github.com/DavidoTek/ProtonUp-Qt/issues/162#issuecomment-1663731621

sonic2kk commented 10 months ago

I'll test that out now (GE-Proton, Proton-tkg, and a regular Valve Proton release).

Though at least in terms of launching a symlink script (Steam launches Proton games via a Python script), the SteamTinkerLaunch script is symlinked from its install directory to ~/.local/share/Steam/compatibilitytools.d/SteamTinkerLaunch/steamtinkerlaunch. Though the folder itself isn't a symlink, the script it. I guess the question becomes then, is Steam able to read symlinked compatibility tool directories.

sonic2kk commented 10 months ago

I realised midway through testing that Valve Proton is not really applicable here, as Proton can be installed anywhere. However the tl;dr is that things work fine with Steam and mostly fine with Lutris and Heroic :partying_face:

The games I tested with Proton-tkg had some compatibility issues, but that is probably not related to the symlinking.

For testing, I moved them to my downloads folder on my boot drive with Steam, as well as onto a folder on a separate internal drive. I symlinked them to ~/.local/share/Steam/compatibilitytools.d/, which is where Heroic and Lutris were picking them up from.

image

It seems like symlinking is supported!

DavidoTek commented 9 months ago

It seems like symlinking is supported!

Great!

Adding something like this and according GUI functionality should do the trick:

# GE-Proton CtInstaller:
    def is_update_available(self, install_dir: str):
        """
        Determines whether a new release is available.

        Returns: bool
            Returns True if an update is available, False otherwise
        """
        latest = self.fetch_releases(count=1)[0]
        ls_installed = os.listdir(install_dir)

        return (latest not in ls_installed)

    def install_update(self, install_dir: str) -> int:
        """
        Install the latest version of the ctmod and symlink it

        Returns: int
            -1: error
             0: sucess
             1: already latest
        """
        latest = self.fetch_releases(count=1)[0]
        ls_installed = os.listdir(install_dir)
        symlink_name = CT_NAME + '-Latest'

        if latest in ls_installed:
            return 1

        self.get_tool(version=latest, install_dir=install_dir, temp_dir=TEMP_DIR)

        symlink_dir = os.path.join(install_dir, symlink_name)
        latest_dir = os.path.join(install_dir, latest)

        if os.path.exists(symlink_dir):
            os.remove(symlink_dir)
        os.symlink(latest_dir, symlink_dir)

        return 0

TODOs: