mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-04-01 15:19:16 +03:00
proton: Also lock the prefix
This commit is contained in:
parent
7a20ea9c1f
commit
5b3ceebc20
224
proton
224
proton
@ -113,140 +113,142 @@ with dist_lock:
|
|||||||
prefix = os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx/"
|
prefix = os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx/"
|
||||||
env["WINEPREFIX"] = prefix
|
env["WINEPREFIX"] = prefix
|
||||||
|
|
||||||
if not os.path.isdir(prefix):
|
prefix_lock = FileLock(os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx.lock", timeout=-1)
|
||||||
#copy default prefix into place
|
with prefix_lock:
|
||||||
shutil.copytree(basedir + "/dist/share/default_pfx", prefix, symlinks=True)
|
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"
|
version_file = os.environ["STEAM_COMPAT_DATA_PATH"] + "/version"
|
||||||
if os.path.exists(version_file):
|
if os.path.exists(version_file):
|
||||||
with open(version_file, "r") as f:
|
with open(version_file, "r") as f:
|
||||||
upgrade_pfx(f.readline().strip())
|
upgrade_pfx(f.readline().strip())
|
||||||
else:
|
else:
|
||||||
upgrade_pfx(None)
|
upgrade_pfx(None)
|
||||||
|
|
||||||
with open(version_file, "w") as f:
|
with open(version_file, "w") as f:
|
||||||
f.write(CURRENT_PREFIX_VERSION + "\n")
|
f.write(CURRENT_PREFIX_VERSION + "\n")
|
||||||
|
|
||||||
#copy steam files into place
|
#copy steam files into place
|
||||||
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ:
|
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ:
|
||||||
#modern steam client sets this
|
#modern steam client sets this
|
||||||
steamdir = os.environ["STEAM_COMPAT_CLIENT_INSTALL_PATH"]
|
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)
|
#fallback for old steam clients (should remove once changes graduate)
|
||||||
steamdir = os.path.dirname(os.environ["STEAM_CLIENT_CONFIG_FILE"])
|
steamdir = os.path.dirname(os.environ["STEAM_CLIENT_CONFIG_FILE"])
|
||||||
else:
|
else:
|
||||||
#linux-only fallback, really shouldn't get here
|
#linux-only fallback, really shouldn't get here
|
||||||
steamdir = os.environ["HOME"] + ".steam/root/"
|
steamdir = os.environ["HOME"] + ".steam/root/"
|
||||||
dst = prefix + "/drive_c/Program Files (x86)/"
|
dst = prefix + "/drive_c/Program Files (x86)/"
|
||||||
makedirs(dst + "Steam")
|
makedirs(dst + "Steam")
|
||||||
filestocopy = ["steamclient.dll",
|
filestocopy = ["steamclient.dll",
|
||||||
"steamclient64.dll",
|
"steamclient64.dll",
|
||||||
"Steam.dll"]
|
"Steam.dll"]
|
||||||
for f in filestocopy:
|
for f in filestocopy:
|
||||||
if os.path.isfile(steamdir + "/legacycompat/" + f):
|
if os.path.isfile(steamdir + "/legacycompat/" + f):
|
||||||
dstfile = dst + "Steam/" + f
|
dstfile = dst + "Steam/" + f
|
||||||
if os.path.isfile(dstfile):
|
if os.path.isfile(dstfile):
|
||||||
os.remove(dstfile)
|
os.remove(dstfile)
|
||||||
shutil.copy(steamdir + "/legacycompat/" + f, dstfile)
|
shutil.copy(steamdir + "/legacycompat/" + f, dstfile)
|
||||||
|
|
||||||
#copy openvr files into place
|
#copy openvr files into place
|
||||||
dst = prefix + "/drive_c/vrclient/bin/"
|
dst = prefix + "/drive_c/vrclient/bin/"
|
||||||
makedirs(dst)
|
makedirs(dst)
|
||||||
shutil.copy(basedir + "/dist/lib/wine/fakedlls/vrclient.dll", dst)
|
shutil.copy(basedir + "/dist/lib/wine/fakedlls/vrclient.dll", dst)
|
||||||
shutil.copy(basedir + "/dist/lib64/wine/fakedlls/vrclient_x64.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.
|
#parse linux openvr config and present it in win32 format to the app.
|
||||||
#logic from openvr's CVRPathRegistry_Public::GetPaths
|
#logic from openvr's CVRPathRegistry_Public::GetPaths
|
||||||
|
|
||||||
#check environment for overrides
|
#check environment for overrides
|
||||||
vr_runtime = None
|
vr_runtime = None
|
||||||
if "VR_OVERRIDE" in env:
|
if "VR_OVERRIDE" in env:
|
||||||
vr_runtime = env["VR_OVERRIDE"]
|
vr_runtime = env["VR_OVERRIDE"]
|
||||||
env.pop("VR_OVERRIDE")
|
env.pop("VR_OVERRIDE")
|
||||||
|
|
||||||
vr_config = None
|
vr_config = None
|
||||||
if "VR_CONFIG_PATH" in env:
|
if "VR_CONFIG_PATH" in env:
|
||||||
vr_config = env["VR_CONFIG_PATH"]
|
vr_config = env["VR_CONFIG_PATH"]
|
||||||
env.pop("VR_CONFIG_PATH")
|
env.pop("VR_CONFIG_PATH")
|
||||||
|
|
||||||
vr_log = None
|
vr_log = None
|
||||||
if "VR_LOG_PATH" in env:
|
if "VR_LOG_PATH" in env:
|
||||||
vr_log = env["VR_LOG_PATH"]
|
vr_log = env["VR_LOG_PATH"]
|
||||||
env.pop("VR_LOG_PATH")
|
env.pop("VR_LOG_PATH")
|
||||||
|
|
||||||
#load from json if needed
|
#load from json if needed
|
||||||
if vr_runtime is None or \
|
if vr_runtime is None or \
|
||||||
vr_config is None or \
|
vr_config is None or \
|
||||||
vr_log is None:
|
vr_log is None:
|
||||||
try:
|
try:
|
||||||
#TODO: support mac
|
#TODO: support mac
|
||||||
if "XDG_CONFIG_HOME" in os.environ:
|
if "XDG_CONFIG_HOME" in os.environ:
|
||||||
path = os.environ["XDG_CONFIG_HOME"]
|
path = os.environ["XDG_CONFIG_HOME"]
|
||||||
else:
|
else:
|
||||||
path = os.environ["HOME"] + "/.config"
|
path = os.environ["HOME"] + "/.config"
|
||||||
path = path + "/openvr/openvrpaths.vrpath"
|
path = path + "/openvr/openvrpaths.vrpath"
|
||||||
|
|
||||||
j = json.load(open(path, "r"))
|
j = json.load(open(path, "r"))
|
||||||
|
|
||||||
if vr_runtime is None:
|
if vr_runtime is None:
|
||||||
vr_runtime = j["runtime"][0]
|
vr_runtime = j["runtime"][0]
|
||||||
|
|
||||||
if vr_config is None:
|
if vr_config is None:
|
||||||
vr_config = j["config"][0]
|
vr_config = j["config"][0]
|
||||||
|
|
||||||
if vr_log is None:
|
if vr_log is None:
|
||||||
vr_log = j["log"][0]
|
vr_log = j["log"][0]
|
||||||
except:
|
except:
|
||||||
pass
|
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
|
#remove existing file
|
||||||
vrpaths_name = prefix + "/drive_c/users/steamuser/Local Settings/Application Data/openvr/openvrpaths.vrpath"
|
vrpaths_name = prefix + "/drive_c/users/steamuser/Local Settings/Application Data/openvr/openvrpaths.vrpath"
|
||||||
if os.path.exists(vrpaths_name):
|
if os.path.exists(vrpaths_name):
|
||||||
os.remove(vrpaths_name)
|
os.remove(vrpaths_name)
|
||||||
|
|
||||||
#dump new file
|
#dump new file
|
||||||
if not vr_runtime is None:
|
if not vr_runtime is None:
|
||||||
try:
|
try:
|
||||||
env["PROTON_VR_RUNTIME"] = vr_runtime
|
env["PROTON_VR_RUNTIME"] = vr_runtime
|
||||||
|
|
||||||
j = { "runtime": [ "C:\\vrclient\\", "C:\\vrclient" ] }
|
j = { "runtime": [ "C:\\vrclient\\", "C:\\vrclient" ] }
|
||||||
|
|
||||||
if not vr_config is None:
|
if not vr_config is None:
|
||||||
win_vr_config = subprocess.check_output([wine_path, "winepath", "-w", vr_config], env=env, stderr=lfile)
|
win_vr_config = subprocess.check_output([wine_path, "winepath", "-w", vr_config], env=env, stderr=lfile)
|
||||||
j["config"] = [ win_vr_config.strip() ]
|
j["config"] = [ win_vr_config.strip() ]
|
||||||
|
|
||||||
if not vr_log is None:
|
if not vr_log is None:
|
||||||
win_vr_log = subprocess.check_output([wine_path, "winepath", "-w", vr_log], env=env, stderr=lfile)
|
win_vr_log = subprocess.check_output([wine_path, "winepath", "-w", vr_log], env=env, stderr=lfile)
|
||||||
j["log"] = [ win_vr_log.strip() ]
|
j["log"] = [ win_vr_log.strip() ]
|
||||||
|
|
||||||
j["version"] = 1
|
j["version"] = 1
|
||||||
j["jsonid"] = "vrpathreg"
|
j["jsonid"] = "vrpathreg"
|
||||||
|
|
||||||
json.dump(j, open(vrpaths_name, "w"), indent=2)
|
json.dump(j, open(vrpaths_name, "w"), indent=2)
|
||||||
except:
|
except:
|
||||||
pass
|
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"):
|
if os.path.lexists(link_dir + "/d3d11.dll"):
|
||||||
os.remove(link_dir + "/d3d11.dll")
|
os.remove(link_dir + "/d3d11.dll")
|
||||||
if os.path.lexists(link_dir + "/dxgi.dll"):
|
if os.path.lexists(link_dir + "/dxgi.dll"):
|
||||||
os.remove(link_dir + "/dxgi.dll")
|
os.remove(link_dir + "/dxgi.dll")
|
||||||
os.symlink(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll")
|
os.symlink(dll_dir + "/d3d11.dll", link_dir + "/d3d11.dll")
|
||||||
os.symlink(dll_dir + "/dxgi.dll", link_dir + "/dxgi.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/",
|
make_dxvk_links(basedir + "/dist/lib64/wine/dxvk/",
|
||||||
prefix + "drive_c/windows/system32")
|
prefix + "drive_c/windows/system32")
|
||||||
make_dxvk_links(basedir + "/dist/lib/wine/dxvk/",
|
make_dxvk_links(basedir + "/dist/lib/wine/dxvk/",
|
||||||
prefix + "drive_c/windows/syswow64")
|
prefix + "drive_c/windows/syswow64")
|
||||||
env["WINEDLLOVERRIDES"] = "dxgi,d3d11=n"
|
env["WINEDLLOVERRIDES"] = "dxgi,d3d11=n"
|
||||||
else:
|
else:
|
||||||
make_dxvk_links(basedir + "/dist/lib64/wine/",
|
make_dxvk_links(basedir + "/dist/lib64/wine/",
|
||||||
prefix + "drive_c/windows/system32")
|
prefix + "drive_c/windows/system32")
|
||||||
make_dxvk_links(basedir + "/dist/lib/wine/",
|
make_dxvk_links(basedir + "/dist/lib/wine/",
|
||||||
prefix + "drive_c/windows/syswow64")
|
prefix + "drive_c/windows/syswow64")
|
||||||
|
|
||||||
ARCH_UNKNOWN=0
|
ARCH_UNKNOWN=0
|
||||||
ARCH_I386=1
|
ARCH_I386=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user