Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ValveSoftware/Proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Eikum <aeikum@codeweavers.com>2018-06-21 17:09:10 +0300
committerAndrew Eikum <aeikum@codeweavers.com>2018-06-25 22:25:13 +0300
commit971ba6438ba3c76c13dbf9429601a40e27e30c87 (patch)
treeb2356a20b14035eb5035d6d702b07740ea483626
parent3d337e96834f5f6f54f54e1c6a9f725564f384d9 (diff)
proton: Load environment overrides from a file on diskproton-3.7-20180625
-rw-r--r--README.md6
-rwxr-xr-xbuild_proton.sh1
-rwxr-xr-xproton74
-rwxr-xr-xuser_settings.sample.py22
4 files changed, 65 insertions, 38 deletions
diff --git a/README.md b/README.md
index f4ff2889..c6bb19df 100644
--- a/README.md
+++ b/README.md
@@ -161,8 +161,12 @@ Runtime Config Options
Proton can be tuned at runtime to help certain games run. The Steam client sets
some options for known games using the <tt>STEAM_COMPAT_CONFIG</tt> variable.
You can override these options using the environment variables described below.
+The best way to set these environment overrides is by renaming
+"user_settings.sample.py" to "user_settings.py" and modifying it appropriately.
+
To enable an option, set the variable to a non-<tt>0</tt> value. To disable an
-option, set the variable to <tt>0</tt>.
+option, set the variable to <tt>0</tt>. To use Steam's default configuration, do
+not specify the variable at all.
All of the below are runtime options. They do not effect permanent changes to
the Wine prefix. Removing the option will revert to the previous behavior.
diff --git a/build_proton.sh b/build_proton.sh
index 6e4e35ba..23a2aa7e 100755
--- a/build_proton.sh
+++ b/build_proton.sh
@@ -608,6 +608,7 @@ if [ "$PACKAGE" = true ]; then
cp -a toolmanifest.vdf dist/
cp -a filelock.py dist/
cp -a proton dist/
+ cp -a user_settings.sample.py dist/
if [ "$PLATFORM" == "Darwin" ]; then
cp -a dist.LICENSE.osx dist/LICENSE
else
diff --git a/proton b/proton
index 4ac49151..67a12f7d 100755
--- a/proton
+++ b/proton
@@ -13,9 +13,8 @@ import tarfile
from filelock import FileLock, Timeout
-# For performance, all logging is turned off by default. It can be enabled here.
-#WITH_WINEDEBUG="+timestamp,+pid,+tid,+seh,+debugstr"
-#WITH_DXVK_LOG_LEVEL="info"
+#To enable debug logging, copy "user_settings.sample.py" to "user_settings.py"
+#and edit it if needed.
CURRENT_PREFIX_VERSION="3.7-1"
@@ -50,23 +49,6 @@ if not ("STEAM_COMPAT_DATA_PATH" in os.environ):
log("No compat data path?")
sys.exit(1)
-def check_environment(env_name, config_name):
- if not env_name in os.environ:
- return
- if os.environ[env_name] == "0" or len(os.environ[env_name]) == 0:
- config_opts.discard(config_name)
- else:
- config_opts.add(config_name)
-
-if "STEAM_COMPAT_CONFIG" in os.environ:
- config_opts = set(os.environ["STEAM_COMPAT_CONFIG"].split(","))
-else:
- config_opts = set()
-
-check_environment("PROTON_USE_WINED3D11", "wined3d11")
-check_environment("PROTON_NO_D3D11", "nod3d11")
-check_environment("PROTON_NO_ESYNC", "noesync")
-
basedir = os.path.dirname(sys.argv[0])
bindir = basedir + "/dist/bin/"
libdir = basedir + "/dist/lib"
@@ -89,20 +71,9 @@ with dist_lock:
env = dict(os.environ)
dlloverrides = {}
-try:
- env["WINEDEBUG"] = WITH_WINEDEBUG
- lfile_path = os.environ["HOME"] + "/steam-" + os.environ["SteamGameId"] + ".log"
- if os.path.exists(lfile_path):
- os.remove(lfile_path)
- lfile = open(lfile_path, "w+")
-except (NameError, KeyError): #WITH_WINEDEBUG is unset, or SteamGameId is unset
- env["WINEDEBUG"] = "-all"
- lfile = None
-
-try:
- env["DXVK_LOG_LEVEL"] = WITH_DXVK_LOG_LEVEL
-except NameError: #WITH_DXVK_LOG_LEVEL is unset
- env["DXVK_LOG_LEVEL"] = "none"
+#for performance, logging is disabled by default; override with user_settings.py
+env["DXVK_LOG_LEVEL"] = "none"
+env["WINEDEBUG"] = "-all"
if ld_path_var in os.environ:
env[ld_path_var] = lib64dir + ":" + libdir + ":" + os.environ[ld_path_var]
@@ -111,9 +82,6 @@ else:
env["WINEDLLPATH"] = lib64dir + "/wine:" + libdir + "/wine"
-if not "noesync" in config_opts:
- env["WINEESYNC"] = "1"
-
if "PATH" in os.environ:
env["PATH"] = bindir + ":" + os.environ["PATH"]
else:
@@ -129,6 +97,38 @@ with dist_lock:
prefix = os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx/"
env["WINEPREFIX"] = prefix
+#load environment overrides
+if os.path.exists(basedir + "/user_settings.py"):
+ import user_settings
+ env.update(user_settings.user_settings)
+
+def check_environment(env_name, config_name):
+ if not env_name in env:
+ return
+ if env[env_name] == "0" or len(env[env_name]) == 0:
+ config_opts.discard(config_name)
+ else:
+ config_opts.add(config_name)
+
+if "STEAM_COMPAT_CONFIG" in os.environ:
+ config_opts = set(os.environ["STEAM_COMPAT_CONFIG"].split(","))
+else:
+ config_opts = set()
+
+check_environment("PROTON_USE_WINED3D11", "wined3d11")
+check_environment("PROTON_NO_D3D11", "nod3d11")
+check_environment("PROTON_NO_ESYNC", "noesync")
+
+if not "noesync" in config_opts:
+ env["WINEESYNC"] = "1"
+
+lfile = None
+if env["WINEDEBUG"] != "-all":
+ lfile_path = os.environ["HOME"] + "/steam-" + os.environ["SteamGameId"] + ".log"
+ if os.path.exists(lfile_path):
+ os.remove(lfile_path)
+ lfile = open(lfile_path, "w+")
+
prefix_lock = FileLock(os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx.lock", timeout=-1)
with prefix_lock:
if not os.path.isdir(prefix):
diff --git a/user_settings.sample.py b/user_settings.sample.py
new file mode 100755
index 00000000..7dbd7d9b
--- /dev/null
+++ b/user_settings.sample.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python2.7
+
+#to enable these settings, name this file "user_settings.py"
+
+user_settings = {
+ #logs are saved to $HOME/steam-$STEAM_APP_ID.log, overwriting any previous log with that name
+ "WINEDEBUG": "+timestamp,+pid,+tid,+seh,+debugstr",
+
+ "DXVK_LOG_LEVEL": "info",
+
+ #Enable DXVK's HUD
+# "DXVK_HUD": "devinfo,fps",
+
+ #Use wined3d for d3d11 instead of dxvk
+# "PROTON_USE_WINED3D11": "1",
+
+ #Disable d3d11 entirely
+# "PROTON_NO_D3D11": "1",
+
+ #Disable in-process synchronization primitives
+# "PROTON_NO_ESYNC": "1",
+}