proton: Also lock the prefix

This commit is contained in:
Andrew Eikum 2018-03-16 10:39:04 -05:00
parent 7a20ea9c1f
commit 5b3ceebc20

78
proton
View File

@ -113,69 +113,71 @@ with dist_lock:
prefix = os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx/"
env["WINEPREFIX"] = prefix
if not os.path.isdir(prefix):
prefix_lock = FileLock(os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx.lock", timeout=-1)
with prefix_lock:
if not os.path.isdir(prefix):
#copy default prefix into place
shutil.copytree(basedir + "/dist/share/default_pfx", prefix, symlinks=True)
version_file = os.environ["STEAM_COMPAT_DATA_PATH"] + "/version"
if os.path.exists(version_file):
version_file = os.environ["STEAM_COMPAT_DATA_PATH"] + "/version"
if os.path.exists(version_file):
with open(version_file, "r") as f:
upgrade_pfx(f.readline().strip())
else:
else:
upgrade_pfx(None)
with open(version_file, "w") as f:
with open(version_file, "w") as f:
f.write(CURRENT_PREFIX_VERSION + "\n")
#copy steam files into place
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ:
#copy steam files into place
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ:
#modern steam client sets this
steamdir = os.environ["STEAM_COMPAT_CLIENT_INSTALL_PATH"]
elif "STEAM_CLIENT_CONFIG_FILE" in os.environ:
elif "STEAM_CLIENT_CONFIG_FILE" in os.environ:
#fallback for old steam clients (should remove once changes graduate)
steamdir = os.path.dirname(os.environ["STEAM_CLIENT_CONFIG_FILE"])
else:
else:
#linux-only fallback, really shouldn't get here
steamdir = os.environ["HOME"] + ".steam/root/"
dst = prefix + "/drive_c/Program Files (x86)/"
makedirs(dst + "Steam")
filestocopy = ["steamclient.dll",
dst = prefix + "/drive_c/Program Files (x86)/"
makedirs(dst + "Steam")
filestocopy = ["steamclient.dll",
"steamclient64.dll",
"Steam.dll"]
for f in filestocopy:
for f in filestocopy:
if os.path.isfile(steamdir + "/legacycompat/" + f):
dstfile = dst + "Steam/" + f
if os.path.isfile(dstfile):
os.remove(dstfile)
shutil.copy(steamdir + "/legacycompat/" + f, dstfile)
#copy openvr files into place
dst = prefix + "/drive_c/vrclient/bin/"
makedirs(dst)
shutil.copy(basedir + "/dist/lib/wine/fakedlls/vrclient.dll", dst)
shutil.copy(basedir + "/dist/lib64/wine/fakedlls/vrclient_x64.dll", dst)
#copy openvr files into place
dst = prefix + "/drive_c/vrclient/bin/"
makedirs(dst)
shutil.copy(basedir + "/dist/lib/wine/fakedlls/vrclient.dll", dst)
shutil.copy(basedir + "/dist/lib64/wine/fakedlls/vrclient_x64.dll", dst)
#parse linux openvr config and present it in win32 format to the app.
#logic from openvr's CVRPathRegistry_Public::GetPaths
#parse linux openvr config and present it in win32 format to the app.
#logic from openvr's CVRPathRegistry_Public::GetPaths
#check environment for overrides
vr_runtime = None
if "VR_OVERRIDE" in env:
#check environment for overrides
vr_runtime = None
if "VR_OVERRIDE" in env:
vr_runtime = env["VR_OVERRIDE"]
env.pop("VR_OVERRIDE")
vr_config = None
if "VR_CONFIG_PATH" in env:
vr_config = None
if "VR_CONFIG_PATH" in env:
vr_config = env["VR_CONFIG_PATH"]
env.pop("VR_CONFIG_PATH")
vr_log = None
if "VR_LOG_PATH" in env:
vr_log = None
if "VR_LOG_PATH" in env:
vr_log = env["VR_LOG_PATH"]
env.pop("VR_LOG_PATH")
#load from json if needed
if vr_runtime is None or \
#load from json if needed
if vr_runtime is None or \
vr_config is None or \
vr_log is None:
try:
@ -199,15 +201,15 @@ if vr_runtime is None or \
except:
pass
makedirs(prefix + "/drive_c/users/steamuser/Local Settings/Application Data/openvr")
makedirs(prefix + "/drive_c/users/steamuser/Local Settings/Application Data/openvr")
#remove existing file
vrpaths_name = prefix + "/drive_c/users/steamuser/Local Settings/Application Data/openvr/openvrpaths.vrpath"
if os.path.exists(vrpaths_name):
#remove existing file
vrpaths_name = prefix + "/drive_c/users/steamuser/Local Settings/Application Data/openvr/openvrpaths.vrpath"
if os.path.exists(vrpaths_name):
os.remove(vrpaths_name)
#dump new file
if not vr_runtime is None:
#dump new file
if not vr_runtime is None:
try:
env["PROTON_VR_RUNTIME"] = vr_runtime
@ -228,7 +230,7 @@ if not vr_runtime is None:
except:
pass
def make_dxvk_links(dll_dir, link_dir):
def make_dxvk_links(dll_dir, link_dir):
if os.path.lexists(link_dir + "/d3d11.dll"):
os.remove(link_dir + "/d3d11.dll")
if os.path.lexists(link_dir + "/dxgi.dll"):
@ -236,13 +238,13 @@ def make_dxvk_links(dll_dir, link_dir):
os.symlink(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll")
os.symlink(dll_dir + "/dxgi.dll", link_dir + "/dxgi.dll")
if "dxvk" in config_opts:
if "dxvk" in config_opts:
make_dxvk_links(basedir + "/dist/lib64/wine/dxvk/",
prefix + "drive_c/windows/system32")
make_dxvk_links(basedir + "/dist/lib/wine/dxvk/",
prefix + "drive_c/windows/syswow64")
env["WINEDLLOVERRIDES"] = "dxgi,d3d11=n"
else:
else:
make_dxvk_links(basedir + "/dist/lib64/wine/",
prefix + "drive_c/windows/system32")
make_dxvk_links(basedir + "/dist/lib/wine/",