diff --git a/README.md b/README.md index 729c38c7..8cf52c42 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,7 @@ the Wine prefix. Removing the option will revert to the previous behavior. | noesync | PROTON_NO_ESYNC | Do not use eventfd-based in-process synchronization primitives. | | nofsync | PROTON_NO_FSYNC | Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no `FUTEX_WAIT_MULTIPLE` support.) | | forcelgadd | PROTON_FORCE_LARGE_ADDRESS_AWARE | Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default. | +| gamedrive | PROTON_SET_GAME_DRIVE | Create an S: drive which points to the Steam Library which contains the game. | | noforcelgadd | | Disable forcelgadd. If both this and `forcelgadd` are set, enabled wins. | | oldglstr | PROTON_OLD_GL_STRING | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. | | vkd3dfl12 | | Force the Direct3D 12 feature level to 12, regardless of driver support. | diff --git a/proton b/proton index 493d088b..4d6e551d 100755 --- a/proton +++ b/proton @@ -114,6 +114,19 @@ def getmtimestr(*path_fragments): except IOError: return "0" +def try_get_game_library_dir(): + if not "STEAM_COMPAT_INSTALL_PATH" in g_session.env or \ + not "STEAM_COMPAT_LIBRARY_PATHS" in g_session.env: + return None + + #find library path which is a subset of the game path + library_paths = g_session.env["STEAM_COMPAT_LIBRARY_PATHS"].split(":") + for l in library_paths: + if l in g_session.env["STEAM_COMPAT_INSTALL_PATH"]: + return l + + return None + EXT2_IOC_GETFLAGS = 0x80086601 EXT2_IOC_SETFLAGS = 0x40086602 @@ -558,6 +571,23 @@ class CompatData: try_copy(g_proton.lib_dir + "wine/vkd3d-proton/d3d12.dll", self.prefix_dir + "drive_c/windows/syswow64/d3d12.dll") + gamedrive_path = self.prefix_dir + "dosdevices/s:" + if "gamedrive" in g_session.compat_config: + library_dir = try_get_game_library_dir() + if not library_dir: + if os.path.lexists(gamedrive_path): + os.remove(gamedrive_path) + else: + if os.path.lexists(gamedrive_path): + cur_tgt = os.readlink(gamedrive_path) + if cur_tgt != library_dir: + os.remove(gamedrive_path) + os.symlink(library_dir, gamedrive_path) + else: + os.symlink(library_dir, gamedrive_path) + elif os.path.lexists(gamedrive_path): + os.remove(gamedrive_path) + def comma_escaped(s): escaped = False idx = -1 @@ -693,6 +723,7 @@ class Session: self.check_environment("PROTON_OLD_GL_STRING", "oldglstr") self.check_environment("PROTON_NO_WRITE_WATCH", "nowritewatch") self.check_environment("PROTON_HIDE_NVIDIA_GPU", "hidenvgpu") + self.check_environment("PROTON_SET_GAME_DRIVE", "gamedrive") if "noesync" in self.compat_config: self.env.pop("WINEESYNC", "")