proton: Load environment overrides from a file on disk
This commit is contained in:
parent
3d337e9683
commit
971ba6438b
4 changed files with 65 additions and 38 deletions
|
@ -161,8 +161,12 @@ Runtime Config Options
|
||||||
Proton can be tuned at runtime to help certain games run. The Steam client sets
|
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.
|
some options for known games using the <tt>STEAM_COMPAT_CONFIG</tt> variable.
|
||||||
You can override these options using the environment variables described below.
|
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
|
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
|
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.
|
the Wine prefix. Removing the option will revert to the previous behavior.
|
||||||
|
|
|
@ -608,6 +608,7 @@ if [ "$PACKAGE" = true ]; then
|
||||||
cp -a toolmanifest.vdf dist/
|
cp -a toolmanifest.vdf dist/
|
||||||
cp -a filelock.py dist/
|
cp -a filelock.py dist/
|
||||||
cp -a proton dist/
|
cp -a proton dist/
|
||||||
|
cp -a user_settings.sample.py dist/
|
||||||
if [ "$PLATFORM" == "Darwin" ]; then
|
if [ "$PLATFORM" == "Darwin" ]; then
|
||||||
cp -a dist.LICENSE.osx dist/LICENSE
|
cp -a dist.LICENSE.osx dist/LICENSE
|
||||||
else
|
else
|
||||||
|
|
74
proton
74
proton
|
@ -13,9 +13,8 @@ import tarfile
|
||||||
|
|
||||||
from filelock import FileLock, Timeout
|
from filelock import FileLock, Timeout
|
||||||
|
|
||||||
# For performance, all logging is turned off by default. It can be enabled here.
|
#To enable debug logging, copy "user_settings.sample.py" to "user_settings.py"
|
||||||
#WITH_WINEDEBUG="+timestamp,+pid,+tid,+seh,+debugstr"
|
#and edit it if needed.
|
||||||
#WITH_DXVK_LOG_LEVEL="info"
|
|
||||||
|
|
||||||
CURRENT_PREFIX_VERSION="3.7-1"
|
CURRENT_PREFIX_VERSION="3.7-1"
|
||||||
|
|
||||||
|
@ -50,23 +49,6 @@ if not ("STEAM_COMPAT_DATA_PATH" in os.environ):
|
||||||
log("No compat data path?")
|
log("No compat data path?")
|
||||||
sys.exit(1)
|
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])
|
basedir = os.path.dirname(sys.argv[0])
|
||||||
bindir = basedir + "/dist/bin/"
|
bindir = basedir + "/dist/bin/"
|
||||||
libdir = basedir + "/dist/lib"
|
libdir = basedir + "/dist/lib"
|
||||||
|
@ -89,20 +71,9 @@ with dist_lock:
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
dlloverrides = {}
|
dlloverrides = {}
|
||||||
|
|
||||||
try:
|
#for performance, logging is disabled by default; override with user_settings.py
|
||||||
env["WINEDEBUG"] = WITH_WINEDEBUG
|
env["DXVK_LOG_LEVEL"] = "none"
|
||||||
lfile_path = os.environ["HOME"] + "/steam-" + os.environ["SteamGameId"] + ".log"
|
env["WINEDEBUG"] = "-all"
|
||||||
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"
|
|
||||||
|
|
||||||
if ld_path_var in os.environ:
|
if ld_path_var in os.environ:
|
||||||
env[ld_path_var] = lib64dir + ":" + libdir + ":" + os.environ[ld_path_var]
|
env[ld_path_var] = lib64dir + ":" + libdir + ":" + os.environ[ld_path_var]
|
||||||
|
@ -111,9 +82,6 @@ else:
|
||||||
|
|
||||||
env["WINEDLLPATH"] = lib64dir + "/wine:" + libdir + "/wine"
|
env["WINEDLLPATH"] = lib64dir + "/wine:" + libdir + "/wine"
|
||||||
|
|
||||||
if not "noesync" in config_opts:
|
|
||||||
env["WINEESYNC"] = "1"
|
|
||||||
|
|
||||||
if "PATH" in os.environ:
|
if "PATH" in os.environ:
|
||||||
env["PATH"] = bindir + ":" + os.environ["PATH"]
|
env["PATH"] = bindir + ":" + os.environ["PATH"]
|
||||||
else:
|
else:
|
||||||
|
@ -129,6 +97,38 @@ 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
|
||||||
|
|
||||||
|
#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)
|
prefix_lock = FileLock(os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx.lock", timeout=-1)
|
||||||
with prefix_lock:
|
with prefix_lock:
|
||||||
if not os.path.isdir(prefix):
|
if not os.path.isdir(prefix):
|
||||||
|
|
22
user_settings.sample.py
Executable file
22
user_settings.sample.py
Executable file
|
@ -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",
|
||||||
|
}
|
Loading…
Reference in a new issue