2018-10-05 17:51:21 +02:00
|
|
|
#!/usr/bin/env python3
|
2018-01-18 21:00:48 +01:00
|
|
|
|
|
|
|
#script to launch Wine with the correct environment
|
|
|
|
|
2018-08-24 09:18:36 +02:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2019-06-27 21:49:29 +02:00
|
|
|
import fcntl
|
|
|
|
import array
|
2018-01-19 18:03:54 +01:00
|
|
|
import filecmp
|
2018-01-18 21:00:48 +01:00
|
|
|
import json
|
|
|
|
import os
|
|
|
|
import shutil
|
2019-02-01 00:02:36 +01:00
|
|
|
import errno
|
2018-01-18 21:00:48 +01:00
|
|
|
import subprocess
|
|
|
|
import sys
|
2018-01-19 18:03:54 +01:00
|
|
|
import tarfile
|
2018-01-18 21:00:48 +01:00
|
|
|
|
2018-10-24 21:22:22 +02:00
|
|
|
from filelock import FileLock
|
2018-03-16 16:08:29 +01:00
|
|
|
|
2018-06-21 16:09:10 +02:00
|
|
|
#To enable debug logging, copy "user_settings.sample.py" to "user_settings.py"
|
|
|
|
#and edit it if needed.
|
2018-03-16 17:02:04 +01:00
|
|
|
|
2019-06-19 16:31:09 +02:00
|
|
|
CURRENT_PREFIX_VERSION="4.11-1"
|
2018-02-15 19:53:47 +01:00
|
|
|
|
2018-01-18 21:00:48 +01:00
|
|
|
PFX="Proton: "
|
2018-10-11 15:50:23 +02:00
|
|
|
ld_path_var = "LD_LIBRARY_PATH"
|
2018-03-06 19:13:24 +01:00
|
|
|
|
2019-02-05 15:08:13 +01:00
|
|
|
def nonzero(s):
|
|
|
|
return len(s) > 0 and s != "0"
|
|
|
|
|
2018-01-18 21:00:48 +01:00
|
|
|
def log(msg):
|
2018-03-13 15:57:35 +01:00
|
|
|
sys.stderr.write(PFX + msg + os.linesep)
|
|
|
|
sys.stderr.flush()
|
2018-02-15 19:53:47 +01:00
|
|
|
|
2019-04-08 21:27:31 +02:00
|
|
|
def file_is_wine_fake_dll(path):
|
|
|
|
if not os.path.exists(path):
|
|
|
|
return False
|
|
|
|
try:
|
|
|
|
sfile = open(path, "rb")
|
|
|
|
sfile.seek(0x40)
|
|
|
|
tag = sfile.read(20)
|
|
|
|
return tag == b"Wine placeholder DLL"
|
|
|
|
except IOError:
|
|
|
|
return False
|
|
|
|
|
2018-01-23 15:03:43 +01:00
|
|
|
def makedirs(path):
|
|
|
|
try:
|
|
|
|
os.makedirs(path)
|
2018-10-11 15:50:23 +02:00
|
|
|
except OSError:
|
2018-01-23 15:03:43 +01:00
|
|
|
#already exists
|
|
|
|
pass
|
|
|
|
|
2019-02-01 00:02:36 +01:00
|
|
|
def try_copy(src, dst):
|
|
|
|
try:
|
2019-07-11 22:09:20 +02:00
|
|
|
if os.path.isdir(dst):
|
|
|
|
dstfile = dst + "/" + os.path.basename(src)
|
|
|
|
if os.path.lexists(dstfile):
|
|
|
|
os.remove(dstfile)
|
|
|
|
elif os.path.lexists(dst):
|
|
|
|
os.remove(dst)
|
2019-02-01 00:02:36 +01:00
|
|
|
shutil.copy(src, dst)
|
|
|
|
except PermissionError as e:
|
|
|
|
if e.errno == errno.EPERM:
|
|
|
|
#be forgiving about permissions errors; if it's a real problem, things will explode later anyway
|
|
|
|
log('Error while copying to \"' + dst + '\": ' + e.strerror)
|
|
|
|
else:
|
|
|
|
raise
|
|
|
|
|
2018-07-20 15:26:15 +02:00
|
|
|
def real_copy(src, dst):
|
|
|
|
if os.path.islink(src):
|
|
|
|
os.symlink(os.readlink(src), dst)
|
|
|
|
else:
|
2019-02-01 00:02:36 +01:00
|
|
|
try_copy(src, dst)
|
2018-07-20 15:26:15 +02:00
|
|
|
|
2019-07-29 19:17:22 +02:00
|
|
|
EXT2_IOC_GETFLAGS = 0x80086601
|
|
|
|
EXT2_IOC_SETFLAGS = 0x40086602
|
|
|
|
|
|
|
|
EXT4_CASEFOLD_FL = 0x40000000
|
|
|
|
|
|
|
|
def set_dir_casefold_bit(dir_path):
|
|
|
|
dr = os.open(dir_path, 0o644)
|
|
|
|
if dr < 0:
|
|
|
|
return
|
|
|
|
try:
|
|
|
|
dat = array.array('I', [0])
|
|
|
|
if fcntl.ioctl(dr, EXT2_IOC_GETFLAGS, dat, True) >= 0:
|
|
|
|
dat[0] = dat[0] | EXT4_CASEFOLD_FL
|
|
|
|
fcntl.ioctl(dr, EXT2_IOC_SETFLAGS, dat, False)
|
|
|
|
except OSError:
|
|
|
|
#no problem
|
|
|
|
pass
|
|
|
|
os.close(dr)
|
2018-07-20 15:26:15 +02:00
|
|
|
|
2019-07-29 17:49:26 +02:00
|
|
|
class Proton:
|
|
|
|
def __init__(self, base_dir):
|
|
|
|
self.base_dir = base_dir + "/"
|
|
|
|
self.dist_dir = self.path("dist/")
|
|
|
|
self.bin_dir = self.path("dist/bin/")
|
|
|
|
self.lib_dir = self.path("dist/lib/")
|
|
|
|
self.lib64_dir = self.path("dist/lib64/")
|
|
|
|
self.fonts_dir = self.path("dist/share/fonts/")
|
|
|
|
self.version_file = self.path("version")
|
|
|
|
self.default_pfx_dir = self.path("dist/share/default_pfx/")
|
|
|
|
self.user_settings_file = self.path("user_settings.py")
|
|
|
|
self.wine_bin = self.bin_dir + "wine"
|
|
|
|
self.wineserver_bin = self.bin_dir + "wineserver"
|
|
|
|
self.dist_lock = FileLock(self.path("dist.lock"), timeout=-1)
|
|
|
|
|
|
|
|
def path(self, d):
|
|
|
|
return self.base_dir + d
|
|
|
|
|
2019-07-29 18:13:36 +02:00
|
|
|
def extract_tarball(self):
|
|
|
|
with self.dist_lock:
|
|
|
|
if not os.path.exists(self.dist_dir) or \
|
|
|
|
not os.path.exists(self.path("dist/version")) or \
|
|
|
|
not filecmp.cmp(self.version_file, self.path("dist/version")):
|
|
|
|
if os.path.exists(self.dist_dir):
|
|
|
|
shutil.rmtree(self.dist_dir)
|
|
|
|
tar = tarfile.open(self.path("proton_dist.tar.gz"), mode="r:gz")
|
|
|
|
tar.extractall(path=self.dist_dir)
|
|
|
|
tar.close()
|
|
|
|
try_copy(self.version_file, self.dist_dir)
|
|
|
|
|
2019-07-29 20:59:15 +02:00
|
|
|
def make_default_prefix(self):
|
2019-07-29 18:13:36 +02:00
|
|
|
with self.dist_lock:
|
2019-07-29 20:59:15 +02:00
|
|
|
local_env = dict(g_session.env)
|
2019-07-29 18:13:36 +02:00
|
|
|
if not os.path.isdir(self.default_pfx_dir):
|
|
|
|
#make default prefix
|
|
|
|
local_env["WINEPREFIX"] = self.default_pfx_dir
|
2019-07-29 21:13:28 +02:00
|
|
|
g_session.run_proc([self.wine_bin, "wineboot"], local_env)
|
|
|
|
g_session.run_proc([self.wineserver_bin, "-w"], local_env)
|
2019-07-29 18:13:36 +02:00
|
|
|
|
2019-07-29 18:09:18 +02:00
|
|
|
class CompatData:
|
|
|
|
def __init__(self, compatdata):
|
|
|
|
self.base_dir = compatdata + "/"
|
|
|
|
self.prefix_dir = self.path("pfx/")
|
|
|
|
self.version_file = self.path("version")
|
|
|
|
self.tracked_files_file = self.path("tracked_files")
|
|
|
|
self.prefix_lock = FileLock(self.path("pfx.lock"), timeout=-1)
|
|
|
|
|
|
|
|
def path(self, d):
|
|
|
|
return self.base_dir + d
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
def remove_tracked_files(self):
|
|
|
|
if not os.path.exists(self.tracked_files_file):
|
2019-07-29 19:17:22 +02:00
|
|
|
log("Prefix has no tracked_files??")
|
|
|
|
return
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
with open(self.tracked_files_file, "r") as tracked_files:
|
2019-07-29 19:17:22 +02:00
|
|
|
dirs = []
|
|
|
|
for f in tracked_files:
|
2019-07-29 19:33:18 +02:00
|
|
|
path = self.prefix_dir + f.strip()
|
2019-07-29 19:17:22 +02:00
|
|
|
if os.path.exists(path):
|
|
|
|
if os.path.isfile(path) or os.path.islink(path):
|
|
|
|
os.remove(path)
|
|
|
|
else:
|
|
|
|
dirs.append(path)
|
|
|
|
for d in dirs:
|
|
|
|
try:
|
|
|
|
os.rmdir(d)
|
|
|
|
except OSError:
|
|
|
|
#not empty
|
|
|
|
pass
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
os.remove(self.tracked_files_file)
|
|
|
|
os.remove(self.version_file)
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
def upgrade_pfx(self, old_ver):
|
|
|
|
if old_ver == CURRENT_PREFIX_VERSION:
|
|
|
|
return
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
log("Upgrading prefix from " + str(old_ver) + " to " + CURRENT_PREFIX_VERSION + " (" + self.base_dir + ")")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
if old_ver is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not '-' in old_ver:
|
|
|
|
#How can this happen??
|
|
|
|
log("Prefix has an invalid version?! You may want to back up user files and delete this prefix.")
|
|
|
|
#If it does, just let the Wine upgrade happen and hope it works...
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
old_proton_ver, old_prefix_ver = old_ver.split('-')
|
|
|
|
old_proton_maj, old_proton_min = old_proton_ver.split('.')
|
|
|
|
new_proton_ver, new_prefix_ver = CURRENT_PREFIX_VERSION.split('-')
|
|
|
|
new_proton_maj, new_proton_min = new_proton_ver.split('.')
|
|
|
|
|
|
|
|
if int(new_proton_maj) < int(old_proton_maj) or \
|
|
|
|
(int(new_proton_maj) == int(old_proton_maj) and \
|
|
|
|
int(new_proton_min) < int(old_proton_min)):
|
|
|
|
log("Removing newer prefix")
|
2019-07-29 19:33:18 +02:00
|
|
|
if old_proton_ver == "3.7" and not os.path.exists(self.tracked_files_file):
|
2019-07-29 19:17:22 +02:00
|
|
|
#proton 3.7 did not generate tracked_files, so copy it into place first
|
2019-07-29 19:33:18 +02:00
|
|
|
try_copy(g_proton.path("proton_3.7_tracked_files"), self.tracked_files_file)
|
|
|
|
self.remove_tracked_files()
|
2019-07-29 19:17:22 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
if old_proton_ver == "3.7" and old_prefix_ver == "1":
|
2019-07-29 19:33:18 +02:00
|
|
|
if not os.path.exists(self.prefix_dir + "/drive_c/windows/syswow64/kernel32.dll"):
|
2019-07-29 19:17:22 +02:00
|
|
|
#shipped a busted 64-bit-only installation on 20180822. detect and wipe clean
|
|
|
|
log("Detected broken 64-bit-only installation, re-creating prefix.")
|
2019-07-29 19:33:18 +02:00
|
|
|
shutil.rmtree(self.prefix_dir)
|
2019-07-29 19:17:22 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
#replace broken .NET installations with wine-mono support
|
2019-07-29 19:33:18 +02:00
|
|
|
if os.path.exists(self.prefix_dir + "/drive_c/windows/Microsoft.NET/NETFXRepair.exe") and \
|
|
|
|
file_is_wine_fake_dll(self.prefix_dir + "/drive_c/windows/system32/mscoree.dll"):
|
2019-07-29 19:17:22 +02:00
|
|
|
log("Broken .NET installation detected, switching to wine-mono.")
|
|
|
|
#deleting this directory allows wine-mono to work
|
2019-07-29 19:33:18 +02:00
|
|
|
shutil.rmtree(self.prefix_dir + "/drive_c/windows/Microsoft.NET")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
except ValueError:
|
|
|
|
log("Prefix has an invalid version?! You may want to back up user files and delete this prefix.")
|
|
|
|
#Just let the Wine upgrade happen and hope it works...
|
|
|
|
return
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
def copy_pfx(self):
|
|
|
|
with open(self.tracked_files_file, "w") as tracked_files:
|
|
|
|
for src_dir, dirs, files in os.walk(g_proton.default_pfx_dir):
|
|
|
|
rel_dir = src_dir.replace(g_proton.default_pfx_dir, "", 1).lstrip('/')
|
|
|
|
if len(rel_dir) > 0:
|
|
|
|
rel_dir = rel_dir + "/"
|
|
|
|
dst_dir = src_dir.replace(g_proton.default_pfx_dir, self.prefix_dir, 1)
|
|
|
|
if not os.path.exists(dst_dir):
|
|
|
|
os.makedirs(dst_dir)
|
|
|
|
tracked_files.write(rel_dir + "\n")
|
|
|
|
for dir_ in dirs:
|
|
|
|
src_file = os.path.join(src_dir, dir_)
|
|
|
|
dst_file = os.path.join(dst_dir, dir_)
|
|
|
|
if os.path.islink(src_file) and not os.path.exists(dst_file):
|
|
|
|
real_copy(src_file, dst_file)
|
|
|
|
for file_ in files:
|
|
|
|
src_file = os.path.join(src_dir, file_)
|
|
|
|
dst_file = os.path.join(dst_dir, file_)
|
|
|
|
if not os.path.exists(dst_file):
|
|
|
|
real_copy(src_file, dst_file)
|
|
|
|
tracked_files.write(rel_dir + file_ + "\n")
|
|
|
|
|
|
|
|
def create_fonts_symlinks(self):
|
2019-07-29 19:17:22 +02:00
|
|
|
fontsmap = [
|
|
|
|
( "LiberationSans-Regular.ttf", "arial.ttf" ),
|
|
|
|
( "LiberationSans-Bold.ttf", "arialbd.ttf" ),
|
|
|
|
( "LiberationSerif-Regular.ttf", "times.ttf" ),
|
|
|
|
( "LiberationMono-Regular.ttf", "cour.ttf" ),
|
|
|
|
]
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
windowsfonts = self.prefix_dir + "/drive_c/windows/Fonts"
|
2019-07-29 19:17:22 +02:00
|
|
|
makedirs(windowsfonts)
|
|
|
|
for p in fontsmap:
|
|
|
|
lname = os.path.join(windowsfonts, p[1])
|
|
|
|
fname = os.path.join(g_proton.fonts_dir, p[0])
|
|
|
|
if os.path.lexists(lname):
|
|
|
|
if os.path.islink(lname):
|
|
|
|
os.remove(lname)
|
|
|
|
os.symlink(fname, lname)
|
|
|
|
else:
|
|
|
|
os.symlink(fname, lname)
|
|
|
|
|
2019-07-29 20:06:51 +02:00
|
|
|
def setup_prefix(self):
|
2019-07-29 19:33:18 +02:00
|
|
|
with self.prefix_lock:
|
|
|
|
if os.path.exists(self.version_file):
|
|
|
|
with open(self.version_file, "r") as f:
|
2019-07-29 19:17:22 +02:00
|
|
|
self.upgrade_pfx(f.readline().strip())
|
|
|
|
else:
|
|
|
|
self.upgrade_pfx(None)
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
if not os.path.exists(self.prefix_dir):
|
|
|
|
makedirs(self.prefix_dir + "/drive_c")
|
|
|
|
set_dir_casefold_bit(self.prefix_dir + "/drive_c")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
if not os.path.exists(self.prefix_dir + "/user.reg"):
|
|
|
|
self.copy_pfx()
|
2019-07-29 19:17:22 +02:00
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
with open(self.version_file, "w") as f:
|
2019-07-29 19:17:22 +02:00
|
|
|
f.write(CURRENT_PREFIX_VERSION + "\n")
|
|
|
|
|
|
|
|
#create font files symlinks
|
2019-07-29 19:33:18 +02:00
|
|
|
self.create_fonts_symlinks()
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
#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"]
|
|
|
|
else:
|
|
|
|
#linux-only fallback, really shouldn't get here
|
|
|
|
steamdir = os.environ["HOME"] + ".steam/root/"
|
2019-07-29 19:33:18 +02:00
|
|
|
dst = self.prefix_dir + "/drive_c/Program Files (x86)/"
|
2019-07-29 19:17:22 +02:00
|
|
|
makedirs(dst + "Steam")
|
|
|
|
filestocopy = ["steamclient.dll",
|
|
|
|
"steamclient64.dll",
|
|
|
|
"Steam.dll"]
|
|
|
|
for f in filestocopy:
|
|
|
|
if os.path.isfile(steamdir + "/legacycompat/" + f):
|
|
|
|
dstfile = dst + "Steam/" + f
|
|
|
|
if os.path.isfile(dstfile):
|
|
|
|
os.remove(dstfile)
|
|
|
|
try_copy(steamdir + "/legacycompat/" + f, dstfile)
|
|
|
|
|
|
|
|
#copy openvr files into place
|
2019-07-29 19:33:18 +02:00
|
|
|
dst = self.prefix_dir + "/drive_c/vrclient/bin/"
|
2019-07-29 19:17:22 +02:00
|
|
|
makedirs(dst)
|
|
|
|
try_copy(g_proton.lib_dir + "wine/fakedlls/vrclient.dll", dst)
|
|
|
|
try_copy(g_proton.lib64_dir + "wine/fakedlls/vrclient_x64.dll", dst)
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
try_copy(g_proton.lib_dir + "wine/dxvk/openvr_api_dxvk.dll", self.prefix_dir + "/drive_c/windows/syswow64/")
|
|
|
|
try_copy(g_proton.lib64_dir + "wine/dxvk/openvr_api_dxvk.dll", self.prefix_dir + "/drive_c/windows/system32/")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
#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
|
2019-07-29 20:06:51 +02:00
|
|
|
if "VR_OVERRIDE" in g_session.env:
|
|
|
|
vr_runtime = g_session.env["VR_OVERRIDE"]
|
|
|
|
g_session.env.pop("VR_OVERRIDE")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
vr_config = None
|
2019-07-29 20:06:51 +02:00
|
|
|
if "VR_CONFIG_PATH" in g_session.env:
|
|
|
|
vr_config = g_session.env["VR_CONFIG_PATH"]
|
|
|
|
g_session.env.pop("VR_CONFIG_PATH")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
vr_log = None
|
2019-07-29 20:06:51 +02:00
|
|
|
if "VR_LOG_PATH" in g_session.env:
|
|
|
|
vr_log = g_session.env["VR_LOG_PATH"]
|
|
|
|
g_session.env.pop("VR_LOG_PATH")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
#load from json if needed
|
|
|
|
if vr_runtime is None or \
|
|
|
|
vr_config is None or \
|
|
|
|
vr_log is None:
|
|
|
|
try:
|
|
|
|
path = os.environ.get("XDG_CONFIG_HOME", os.environ["HOME"] + "/.config")
|
|
|
|
path = path + "/openvr/openvrpaths.vrpath"
|
|
|
|
|
|
|
|
with open(path, "r") as jfile:
|
|
|
|
j = json.load(jfile)
|
|
|
|
|
|
|
|
if vr_runtime is None:
|
|
|
|
vr_runtime = j["runtime"][0]
|
|
|
|
|
|
|
|
if vr_config is None:
|
|
|
|
vr_config = j["config"][0]
|
|
|
|
|
|
|
|
if vr_log is None:
|
|
|
|
vr_log = j["log"][0]
|
|
|
|
except (TypeError, ValueError, OSError):
|
|
|
|
log("Missing or invalid openvrpaths.vrpath file! " + str(sys.exc_info()[1]))
|
|
|
|
|
2019-07-29 19:33:18 +02:00
|
|
|
makedirs(self.prefix_dir + "/drive_c/users/steamuser/Local Settings/Application Data/openvr")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
#remove existing file
|
2019-07-29 19:33:18 +02:00
|
|
|
vrpaths_name = self.prefix_dir + "/drive_c/users/steamuser/Local Settings/Application Data/openvr/openvrpaths.vrpath"
|
2019-07-29 19:17:22 +02:00
|
|
|
if os.path.exists(vrpaths_name):
|
|
|
|
os.remove(vrpaths_name)
|
|
|
|
|
|
|
|
#dump new file
|
|
|
|
if not vr_runtime is None:
|
|
|
|
try:
|
2019-07-29 20:06:51 +02:00
|
|
|
g_session.env["PROTON_VR_RUNTIME"] = vr_runtime
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
j = { "runtime": [ "C:\\vrclient\\", "C:\\vrclient" ] }
|
|
|
|
|
|
|
|
if not vr_config is None:
|
2019-07-29 20:06:51 +02:00
|
|
|
win_vr_config = subprocess.check_output([g_proton.wine_bin, "winepath", "-w", vr_config], env=g_session.env, stderr=g_session.log_file).decode("utf-8")
|
2019-07-29 19:17:22 +02:00
|
|
|
j["config"] = [ win_vr_config.strip() ]
|
|
|
|
|
|
|
|
if not vr_log is None:
|
2019-07-29 20:06:51 +02:00
|
|
|
win_vr_log = subprocess.check_output([g_proton.wine_bin, "winepath", "-w", vr_log], env=g_session.env, stderr=g_session.log_file).decode("utf-8")
|
2019-07-29 19:17:22 +02:00
|
|
|
j["log"] = [ win_vr_log.strip() ]
|
|
|
|
|
|
|
|
j["version"] = 1
|
|
|
|
j["jsonid"] = "vrpathreg"
|
|
|
|
|
|
|
|
with open(vrpaths_name, "w") as vfile:
|
|
|
|
json.dump(j, vfile, indent=2)
|
|
|
|
except (ValueError, OSError):
|
|
|
|
log("Unable to write VR config! " + str(sys.exc_info()[1]))
|
|
|
|
|
2019-07-29 20:06:51 +02:00
|
|
|
if "wined3d" in g_session.compat_config:
|
2019-07-29 19:17:22 +02:00
|
|
|
dxvkfiles = []
|
|
|
|
wined3dfiles = ["d3d11", "d3d10", "d3d10core", "d3d10_1", "dxgi", "d3d9"]
|
|
|
|
else:
|
|
|
|
dxvkfiles = ["d3d11", "d3d10", "d3d10core", "d3d10_1", "dxgi"]
|
|
|
|
wined3dfiles = []
|
2019-07-29 20:06:51 +02:00
|
|
|
if "d9vk" in g_session.compat_config:
|
2019-07-29 19:17:22 +02:00
|
|
|
dxvkfiles.append("d3d9")
|
|
|
|
else:
|
|
|
|
wined3dfiles.append("d3d9")
|
|
|
|
|
|
|
|
for f in wined3dfiles:
|
|
|
|
try_copy(g_proton.default_pfx_dir + "drive_c/windows/system32/" + f + ".dll",
|
2019-07-29 19:33:18 +02:00
|
|
|
self.prefix_dir + "drive_c/windows/system32/" + f + ".dll")
|
2019-07-29 19:17:22 +02:00
|
|
|
try_copy(g_proton.default_pfx_dir + "drive_c/windows/syswow64/" + f + ".dll",
|
2019-07-29 19:33:18 +02:00
|
|
|
self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
|
|
|
for f in dxvkfiles:
|
|
|
|
try_copy(g_proton.lib64_dir + "wine/dxvk/" + f + ".dll",
|
2019-07-29 19:33:18 +02:00
|
|
|
self.prefix_dir + "drive_c/windows/system32/" + f + ".dll")
|
2019-07-29 19:17:22 +02:00
|
|
|
try_copy(g_proton.lib_dir + "wine/dxvk/" + f + ".dll",
|
2019-07-29 19:33:18 +02:00
|
|
|
self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
|
2019-07-29 20:06:51 +02:00
|
|
|
g_session.dlloverrides[f] = "n"
|
|
|
|
|
|
|
|
class Session:
|
|
|
|
def __init__(self):
|
|
|
|
self.log_file = None
|
|
|
|
self.env = dict(os.environ)
|
|
|
|
self.dlloverrides = {
|
|
|
|
"steam.exe": "b", #always use our special built-in steam.exe
|
|
|
|
"mfplay": "n" #disable built-in mfplay
|
|
|
|
}
|
|
|
|
if "STEAM_COMPAT_CONFIG" in os.environ:
|
|
|
|
self.compat_config = set(os.environ["STEAM_COMPAT_CONFIG"].split(","))
|
|
|
|
else:
|
|
|
|
self.compat_config = set()
|
2019-07-29 19:17:22 +02:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
def init_wine(self):
|
2019-07-29 20:53:16 +02:00
|
|
|
if "HOST_LC_ALL" in self.env and len(self.env["HOST_LC_ALL"]) > 0:
|
2019-07-29 20:41:01 +02:00
|
|
|
#steam sets LC_ALL=C to help some games, but Wine requires the real value
|
|
|
|
#in order to do path conversion between win32 and host. steam sets
|
|
|
|
#HOST_LC_ALL to allow us to use the real value.
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["LC_ALL"] = self.env["HOST_LC_ALL"]
|
2019-07-29 20:41:01 +02:00
|
|
|
else:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env.pop("LC_ALL", "")
|
2019-07-29 19:17:22 +02:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
#for performance, logging is disabled by default; override with user_settings.py
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["DXVK_LOG_LEVEL"] = "none"
|
|
|
|
self.env["WINEDEBUG"] = "-all"
|
|
|
|
self.env.pop("WINEARCH", "")
|
2018-01-18 21:00:48 +01:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
if ld_path_var in os.environ:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env[ld_path_var] = g_proton.lib64_dir + ":" + g_proton.lib_dir + ":" + os.environ[ld_path_var]
|
2019-07-29 20:41:01 +02:00
|
|
|
else:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env[ld_path_var] = g_proton.lib64_dir + ":" + g_proton.lib_dir
|
2018-01-18 21:00:48 +01:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINEDLLPATH"] = g_proton.lib64_dir + "/wine:" + g_proton.lib_dir + "/wine"
|
2019-07-29 18:13:36 +02:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
if "PATH" in os.environ:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["PATH"] = g_proton.bin_dir + ":" + os.environ["PATH"]
|
2019-07-29 20:41:01 +02:00
|
|
|
else:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["PATH"] = g_proton.bin_dir
|
2018-01-19 18:03:54 +01:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
def check_environment(self, env_name, config_name):
|
2019-07-29 20:53:16 +02:00
|
|
|
if not env_name in self.env:
|
2019-07-29 20:41:01 +02:00
|
|
|
return False
|
2019-07-29 20:53:16 +02:00
|
|
|
if nonzero(self.env[env_name]):
|
|
|
|
self.compat_config.add(config_name)
|
2019-07-29 20:41:01 +02:00
|
|
|
else:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.compat_config.discard(config_name)
|
2019-07-29 20:41:01 +02:00
|
|
|
return True
|
|
|
|
|
|
|
|
def init_session(self):
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINEPREFIX"] = g_compatdata.prefix_dir
|
2019-07-29 20:41:01 +02:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "PROTON_LOG" in self.env and nonzero(self.env["PROTON_LOG"]):
|
|
|
|
self.env["WINEDEBUG"] = "+timestamp,+pid,+tid,+seh,+debugstr,+loaddll,+mscoree"
|
|
|
|
self.env["DXVK_LOG_LEVEL"] = "info"
|
|
|
|
self.env["WINE_MONO_TRACE"] = "E:System.NotImplementedException"
|
2019-07-29 20:41:01 +02:00
|
|
|
|
|
|
|
#default wine-mono override for FNA games
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINE_MONO_OVERRIDES"] = "Microsoft.Xna.Framework.*,Gac=n"
|
2019-07-29 20:41:01 +02:00
|
|
|
|
|
|
|
#load environment overrides
|
|
|
|
if os.path.exists(g_proton.user_settings_file):
|
|
|
|
try:
|
|
|
|
import user_settings
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env.update(user_settings.user_settings)
|
2019-07-29 20:41:01 +02:00
|
|
|
except:
|
|
|
|
log("************************************************")
|
|
|
|
log("THERE IS AN ERROR IN YOUR user_settings.py FILE:")
|
|
|
|
log("%s" % sys.exc_info()[1])
|
|
|
|
log("************************************************")
|
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "wined3d11" in self.compat_config:
|
|
|
|
self.compat_config.add("wined3d")
|
2019-07-29 20:41:01 +02:00
|
|
|
|
|
|
|
if not self.check_environment("PROTON_USE_WINED3D", "wined3d"):
|
|
|
|
self.check_environment("PROTON_USE_WINED3D11", "wined3d")
|
|
|
|
self.check_environment("PROTON_USE_D9VK", "d9vk")
|
|
|
|
self.check_environment("PROTON_NO_D3D11", "nod3d11")
|
|
|
|
self.check_environment("PROTON_NO_D3D10", "nod3d10")
|
|
|
|
self.check_environment("PROTON_NO_ESYNC", "noesync")
|
|
|
|
self.check_environment("PROTON_NO_FSYNC", "nofsync")
|
|
|
|
self.check_environment("PROTON_FORCE_LARGE_ADDRESS_AWARE", "forcelgadd")
|
|
|
|
self.check_environment("PROTON_OLD_GL_STRING", "oldglstr")
|
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if not "noesync" in self.compat_config:
|
|
|
|
self.env["WINEESYNC"] = "1"
|
2019-07-29 20:41:01 +02:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if not "nofsync" in self.compat_config:
|
|
|
|
self.env["WINEFSYNC"] = "1"
|
2019-07-29 20:41:01 +02:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "oldglstr" in self.compat_config:
|
2019-07-29 20:41:01 +02:00
|
|
|
#mesa override
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["MESA_EXTENSION_MAX_YEAR"] = "2003"
|
2019-07-29 20:41:01 +02:00
|
|
|
#nvidia override
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["__GL_ExtensionStringVersion"] = "17700"
|
2019-07-29 20:41:01 +02:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "forcelgadd" in self.compat_config:
|
2019-07-29 20:41:01 +02:00
|
|
|
#forcelgadd should be used just for testing whether a game is helped by
|
|
|
|
#setting LARGE_ADDRESS_AWARE. If it does, then add an AppDefault in the
|
|
|
|
#registry, so that it doesn't impact every executable in the prefix.
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINE_LARGE_ADDRESS_AWARE"] = "1"
|
2019-07-29 20:41:01 +02:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "SteamGameId" in self.env:
|
|
|
|
if self.env["WINEDEBUG"] != "-all":
|
2019-07-29 20:41:01 +02:00
|
|
|
lfile_path = os.environ["HOME"] + "/steam-" + os.environ["SteamGameId"] + ".log"
|
|
|
|
if os.path.exists(lfile_path):
|
|
|
|
os.remove(lfile_path)
|
2019-07-29 20:53:16 +02:00
|
|
|
self.log_file = open(lfile_path, "w+")
|
|
|
|
self.log_file.write("======================\n")
|
2019-07-29 20:41:01 +02:00
|
|
|
with open(g_proton.version_file, "r") as f:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.log_file.write("Proton: " + f.readline().strip() + "\n")
|
|
|
|
self.log_file.write("SteamGameId: " + self.env["SteamGameId"] + "\n")
|
|
|
|
self.log_file.write("Command: " + str(sys.argv[2:]) + "\n")
|
|
|
|
self.log_file.write("Options: " + str(self.compat_config) + "\n")
|
|
|
|
self.log_file.write("======================\n")
|
|
|
|
self.log_file.flush()
|
2019-07-29 20:41:01 +02:00
|
|
|
else:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINEDEBUG"] = "-all"
|
2018-01-18 21:00:48 +01:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
g_compatdata.setup_prefix()
|
2019-02-05 15:06:03 +01:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "nod3d11" in self.compat_config:
|
|
|
|
self.dlloverrides["d3d11"] = ""
|
|
|
|
if "dxgi" in self.dlloverrides:
|
|
|
|
del self.dlloverrides["dxgi"]
|
2018-05-11 14:14:04 +02:00
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
if "nod3d10" in self.compat_config:
|
|
|
|
self.dlloverrides["d3d10_1"] = ""
|
|
|
|
self.dlloverrides["d3d10"] = ""
|
|
|
|
self.dlloverrides["dxgi"] = ""
|
2018-02-14 20:59:35 +01:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
s = ""
|
2019-07-29 20:53:16 +02:00
|
|
|
for dll in self.dlloverrides:
|
|
|
|
setting = self.dlloverrides[dll]
|
2019-07-29 20:41:01 +02:00
|
|
|
if len(s) > 0:
|
|
|
|
s = s + ";" + dll + "=" + setting
|
|
|
|
else:
|
|
|
|
s = dll + "=" + setting
|
|
|
|
if "WINEDLLOVERRIDES" in os.environ:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINEDLLOVERRIDES"] = os.environ["WINEDLLOVERRIDES"] + ";" + s
|
2019-07-29 20:41:01 +02:00
|
|
|
else:
|
2019-07-29 20:53:16 +02:00
|
|
|
self.env["WINEDLLOVERRIDES"] = s
|
2019-07-29 20:41:01 +02:00
|
|
|
|
|
|
|
def dump_dbg_env(self, f):
|
2019-07-29 20:53:16 +02:00
|
|
|
f.write("PATH=\"" + self.env["PATH"] + "\" \\\n")
|
2019-07-29 20:41:01 +02:00
|
|
|
f.write("\tTERM=\"xterm\" \\\n") #XXX
|
|
|
|
f.write("\tWINEDEBUG=\"-all\" \\\n")
|
2019-07-29 20:53:16 +02:00
|
|
|
f.write("\tWINEDLLPATH=\"" + self.env["WINEDLLPATH"] + "\" \\\n")
|
|
|
|
f.write("\t" + ld_path_var + "=\"" + self.env[ld_path_var] + "\" \\\n")
|
|
|
|
f.write("\tWINEPREFIX=\"" + self.env["WINEPREFIX"] + "\" \\\n")
|
|
|
|
if "WINEESYNC" in self.env:
|
|
|
|
f.write("\tWINEESYNC=\"" + self.env["WINEESYNC"] + "\" \\\n")
|
|
|
|
if "SteamGameId" in self.env:
|
|
|
|
f.write("\tSteamGameId=\"" + self.env["SteamGameId"] + "\" \\\n")
|
|
|
|
if "SteamAppId" in self.env:
|
|
|
|
f.write("\tSteamAppId=\"" + self.env["SteamAppId"] + "\" \\\n")
|
|
|
|
if "PROTON_VR_RUNTIME" in self.env:
|
|
|
|
f.write("\tPROTON_VR_RUNTIME=\"" + self.env["PROTON_VR_RUNTIME"] + "\" \\\n")
|
|
|
|
if "WINEDLLOVERRIDES" in self.env:
|
|
|
|
f.write("\tWINEDLLOVERRIDES=\"" + self.env["WINEDLLOVERRIDES"] + "\" \\\n")
|
|
|
|
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in self.env:
|
|
|
|
f.write("\tSTEAM_COMPAT_CLIENT_INSTALL_PATH=\"" + self.env["STEAM_COMPAT_CLIENT_INSTALL_PATH"] + "\" \\\n")
|
|
|
|
if "WINE_LARGE_ADDRESS_AWARE" in self.env:
|
|
|
|
f.write("\tWINE_LARGE_ADDRESS_AWARE=\"" + self.env["WINE_LARGE_ADDRESS_AWARE"] + "\" \\\n")
|
2019-07-29 20:41:01 +02:00
|
|
|
|
|
|
|
def dump_dbg_scripts(self):
|
|
|
|
exe_name = os.path.basename(sys.argv[2])
|
|
|
|
|
2019-07-29 20:53:16 +02:00
|
|
|
tmpdir = self.env.get("PROTON_DEBUG_DIR", "/tmp") + "/proton_" + os.environ["USER"] + "/"
|
2019-07-29 20:41:01 +02:00
|
|
|
makedirs(tmpdir)
|
|
|
|
|
|
|
|
with open(tmpdir + "winedbg", "w") as f:
|
|
|
|
f.write("#!/bin/bash\n")
|
|
|
|
f.write("#Run winedbg with args\n\n")
|
|
|
|
f.write("cd \"" + os.getcwd() + "\"\n")
|
|
|
|
self.dump_dbg_env(f)
|
|
|
|
f.write("\t\"" + g_proton.wine_bin + "\" winedbg \"$@\"\n")
|
|
|
|
os.chmod(tmpdir + "winedbg", 0o755)
|
|
|
|
|
|
|
|
with open(tmpdir + "winedbg_run", "w") as f:
|
|
|
|
f.write("#!/bin/bash\n")
|
|
|
|
f.write("#Run winedbg and prepare to run game or given program\n\n")
|
|
|
|
f.write("cd \"" + os.getcwd() + "\"\n")
|
|
|
|
f.write("DEF_CMD=(")
|
|
|
|
first = True
|
|
|
|
for arg in sys.argv[2:]:
|
|
|
|
if first:
|
|
|
|
f.write("\"" + arg + "\"")
|
|
|
|
first = False
|
|
|
|
else:
|
|
|
|
f.write(" \"" + arg + "\"")
|
|
|
|
f.write(")\n")
|
|
|
|
self.dump_dbg_env(f)
|
|
|
|
f.write("\t\"" + g_proton.wine_bin + "\" winedbg \"${@:-${DEF_CMD[@]}}\"\n")
|
|
|
|
os.chmod(tmpdir + "winedbg_run", 0o755)
|
|
|
|
|
|
|
|
with open(tmpdir + "gdb_attach", "w") as f:
|
|
|
|
f.write("#!/bin/bash\n")
|
|
|
|
f.write("#Run winedbg in gdb mode and auto-attach to already-running program\n\n")
|
|
|
|
f.write("cd \"" + os.getcwd() + "\"\n")
|
|
|
|
f.write("EXE_NAME=${1:-\"" + exe_name + "\"}\n")
|
|
|
|
f.write("WPID_HEX=$(\"" + tmpdir + "winedbg\" --command 'info process' | grep -i \"$EXE_NAME\" | cut -f2 -d' ' | tr -d '0')\n")
|
|
|
|
f.write("if [ -z \"$WPID_HEX\" ]; then \n")
|
|
|
|
f.write(" echo \"Program does not appear to be running: \\\"$EXE_NAME\\\"\"\n")
|
|
|
|
f.write(" exit 1\n")
|
|
|
|
f.write("fi\n")
|
|
|
|
f.write("WPID_DEC=$(printf %d 0x$WPID_HEX)\n")
|
|
|
|
self.dump_dbg_env(f)
|
|
|
|
f.write("\t\"" + g_proton.wine_bin + "\" winedbg --gdb $WPID_DEC\n")
|
|
|
|
os.chmod(tmpdir + "gdb_attach", 0o755)
|
|
|
|
|
|
|
|
with open(tmpdir + "gdb_run", "w") as f:
|
|
|
|
f.write("#!/bin/bash\n")
|
|
|
|
f.write("#Run winedbg in gdb mode and prepare to run game or given program\n\n")
|
|
|
|
f.write("cd \"" + os.getcwd() + "\"\n")
|
|
|
|
f.write("DEF_CMD=(")
|
|
|
|
first = True
|
|
|
|
for arg in sys.argv[2:]:
|
|
|
|
if first:
|
|
|
|
f.write("\"" + arg + "\"")
|
|
|
|
first = False
|
|
|
|
else:
|
|
|
|
f.write(" \"" + arg + "\"")
|
|
|
|
f.write(")\n")
|
|
|
|
self.dump_dbg_env(f)
|
|
|
|
f.write("\t\"" + g_proton.wine_bin + "\" winedbg --gdb \"${@:-${DEF_CMD[@]}}\"\n")
|
|
|
|
os.chmod(tmpdir + "gdb_run", 0o755)
|
|
|
|
|
|
|
|
with open(tmpdir + "run", "w") as f:
|
|
|
|
f.write("#!/bin/bash\n")
|
|
|
|
f.write("#Run game or given command in environment\n\n")
|
|
|
|
f.write("cd \"" + os.getcwd() + "\"\n")
|
|
|
|
f.write("DEF_CMD=(")
|
|
|
|
first = True
|
|
|
|
for arg in sys.argv[2:]:
|
|
|
|
if first:
|
|
|
|
f.write("\"" + arg + "\"")
|
|
|
|
first = False
|
|
|
|
else:
|
|
|
|
f.write(" \"" + arg + "\"")
|
|
|
|
f.write(")\n")
|
|
|
|
self.dump_dbg_env(f)
|
|
|
|
f.write("\t\"" + g_proton.wine_bin + "\" steam.exe \"${@:-${DEF_CMD[@]}}\"\n")
|
|
|
|
os.chmod(tmpdir + "run", 0o755)
|
2018-02-14 20:59:35 +01:00
|
|
|
|
2019-07-29 20:59:15 +02:00
|
|
|
def run_proc(self, args, local_env=None):
|
2019-07-29 21:13:28 +02:00
|
|
|
if local_env is None:
|
2019-07-29 20:59:15 +02:00
|
|
|
local_env = self.env
|
|
|
|
subprocess.call(args, env=local_env, stderr=self.log_file, stdout=self.log_file)
|
2018-01-18 21:00:48 +01:00
|
|
|
|
2019-07-29 20:41:01 +02:00
|
|
|
def run(self):
|
2019-07-29 20:53:16 +02:00
|
|
|
if "PROTON_DUMP_DEBUG_COMMANDS" in self.env and nonzero(self.env["PROTON_DUMP_DEBUG_COMMANDS"]):
|
2019-07-29 20:41:01 +02:00
|
|
|
try:
|
|
|
|
self.dump_dbg_scripts()
|
|
|
|
except OSError:
|
|
|
|
log("Unable to write debug scripts! " + str(sys.exc_info()[1]))
|
2019-07-29 20:53:16 +02:00
|
|
|
self.run_proc([g_proton.wine_bin, "steam"] + sys.argv[2:])
|
2018-01-25 20:22:24 +01:00
|
|
|
|
2018-01-18 21:00:48 +01:00
|
|
|
|
2019-07-29 21:09:28 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
if not "STEAM_COMPAT_DATA_PATH" in os.environ:
|
|
|
|
log("No compat data path?")
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
g_proton = Proton(os.path.dirname(sys.argv[0]))
|
|
|
|
|
|
|
|
g_proton.extract_tarball()
|
|
|
|
|
|
|
|
g_compatdata = CompatData(os.environ["STEAM_COMPAT_DATA_PATH"])
|
|
|
|
|
|
|
|
g_session = Session()
|
|
|
|
|
|
|
|
g_session.init_wine()
|
|
|
|
|
|
|
|
g_proton.make_default_prefix()
|
|
|
|
|
|
|
|
g_session.init_session()
|
|
|
|
|
|
|
|
if sys.version_info[0] == 2:
|
|
|
|
binary_stdout = sys.stdout
|
|
|
|
elif sys.version_info[0] == 3:
|
|
|
|
binary_stdout = sys.stdout.buffer
|
|
|
|
else:
|
|
|
|
raise Exception("Unsupported python version")
|
|
|
|
|
|
|
|
#determine mode
|
|
|
|
if sys.argv[1] == "run":
|
|
|
|
#start target app
|
|
|
|
g_session.run()
|
|
|
|
elif sys.argv[1] == "waitforexitandrun":
|
|
|
|
#wait for wineserver to shut down
|
|
|
|
g_session.run_proc([g_proton.wineserver_bin, "-w"])
|
|
|
|
#then run
|
|
|
|
g_session.run()
|
|
|
|
elif sys.argv[1] == "getcompatpath":
|
|
|
|
#linux -> windows path
|
|
|
|
path = subprocess.check_output([g_proton.wine_bin, "winepath", "-w", sys.argv[2]], env=g_session.env, stderr=g_session.log_file)
|
|
|
|
binary_stdout.write(path)
|
|
|
|
elif sys.argv[1] == "getnativepath":
|
|
|
|
#windows -> linux path
|
|
|
|
path = subprocess.check_output([g_proton.wine_bin, "winepath", sys.argv[2]], env=g_session.env, stderr=g_session.log_file)
|
|
|
|
binary_stdout.write(path)
|
|
|
|
else:
|
|
|
|
log("Need a verb.")
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
sys.exit(0)
|
2018-08-29 14:45:41 +02:00
|
|
|
|
2019-07-29 21:13:28 +02:00
|
|
|
#pylint --disable=C0301,C0326,C0330,C0111,C0103,R0902,C1801,R0914,R0912,R0915
|
2018-08-29 14:45:41 +02:00
|
|
|
# vim: set syntax=python:
|