proton: Add gamedrive config setting to create an S: drive for the game's library

This commit is contained in:
Andrew Eikum 2020-12-03 13:36:48 -06:00
parent 25a2a690b0
commit 4c0f01e2dc
2 changed files with 32 additions and 0 deletions

View file

@ -275,6 +275,7 @@ the Wine prefix. Removing the option will revert to the previous behavior.
| <tt>noesync</tt> | <tt>PROTON_NO_ESYNC</tt> | Do not use eventfd-based in-process synchronization primitives. |
| <tt>nofsync</tt> | <tt>PROTON_NO_FSYNC</tt> | Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no `FUTEX_WAIT_MULTIPLE` support.) |
| <tt>forcelgadd</tt> | <tt>PROTON_FORCE_LARGE_ADDRESS_AWARE</tt> | Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default. |
| <tt>gamedrive</tt> | <tt>PROTON_SET_GAME_DRIVE</tt> | Create an S: drive which points to the Steam Library which contains the game. |
| <tt>noforcelgadd</tt> | | Disable forcelgadd. If both this and `forcelgadd` are set, enabled wins. |
| <tt>oldglstr</tt> | <tt>PROTON_OLD_GL_STRING</tt> | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. |
| <tt>vkd3dfl12</tt> | | Force the Direct3D 12 feature level to 12, regardless of driver support. |

31
proton
View file

@ -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", "")