Commit e1929234 authored by Mikhail Tergoev's avatar Mikhail Tergoev

major fix proton files, gamemoderun in proton, optimized libs

parent 2a971a41
......@@ -15,11 +15,13 @@ import tarfile
from filelock import FileLock
#To enable debug logging, copy "user_settings.sample.py" to "user_settings.py"
#and edit it if needed.
CURRENT_PREFIX_VERSION="5.6-GE-2"
ld_path_var = "LD_LIBRARY_PATH"
PFX="Proton: "
ld_path_var = "LD_LIBRARY_PATH"
def nonzero(s):
return len(s) > 0 and s != "0"
......@@ -97,8 +99,10 @@ class Proton:
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.gamemoderun = "gamemoderun"
self.dist_lock = FileLock(self.path("dist.lock"), timeout=-1)
def path(self, d):
......@@ -288,15 +292,6 @@ class CompatData:
#create font files symlinks
self.create_fonts_symlinks()
#copy openvr files into place
dst = self.prefix_dir + "/drive_c/vrclient/bin/"
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)
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/")
if "wined3d" in g_session.compat_config:
dxvkfiles = ["dxvk_config"]
......@@ -306,7 +301,7 @@ class CompatData:
wined3dfiles = []
#if the user asked for dxvk's dxgi (dxgi=n), then copy it into place
if "WINEDLLOVERRIDES" in os.environ and "dxgi=n" in os.environ["WINEDLLOVERRIDES"]:
if "PW_DXGI_FOR_VKD3D" in os.environ and nonzero(os.environ["PW_DXGI_FOR_VKD3D"]):
dxvkfiles.append("dxgi")
else:
wined3dfiles.append("dxgi")
......@@ -337,7 +332,9 @@ class Session:
self.log_file = None
self.env = dict(os.environ)
self.dlloverrides = {
"steam.exe": "b" #always use our special built-in steam.exe
# "vrclient.dll":""
# "vrclient_x64.dll":""
"openvr_api_dxvk": ""
}
self.compat_config = set()
......@@ -371,7 +368,7 @@ class Session:
self.env.pop("LC_ALL", "")
self.env.pop("WINEARCH", "")
if ld_path_var in os.environ:
self.env[ld_path_var] = g_proton.lib64_dir + ":" + g_proton.lib_dir + ":" + os.environ[ld_path_var]
else:
......@@ -379,6 +376,9 @@ class Session:
self.env["WINEDLLPATH"] = g_proton.lib64_dir + "/wine:" + g_proton.lib_dir + "/wine"
self.env["GST_PLUGIN_SYSTEM_PATH_1_0"] = g_proton.lib64_dir + "gstreamer-1.0" + ":" + g_proton.lib_dir + "gstreamer-1.0"
self.env["WINE_GST_REGISTRY_DIR"] = g_compatdata.path("gstreamer-1.0/")
if "PATH" in os.environ:
self.env["PATH"] = g_proton.bin_dir + ":" + os.environ["PATH"]
else:
......@@ -396,6 +396,29 @@ class Session:
def init_session(self):
self.env["WINEPREFIX"] = g_compatdata.prefix_dir
#load environment overrides
if os.path.exists(g_proton.user_settings_file):
try:
import user_settings
for key, value in user_settings.user_settings.items():
self.env.setdefault(key, value)
except:
log("************************************************")
log("THERE IS AN ERROR IN YOUR user_settings.py FILE:")
log("%s" % sys.exc_info()[1])
log("************************************************")
if "PORTWINE_LOG" in os.environ and nonzero(os.environ["PORTWINE_LOG"]):
self.env.setdefault("WINEDEBUG", "+timestamp,+pid,+tid,+seh,+debugstr,+loaddll,+mscoree")
self.env.setdefault("DXVK_LOG_LEVEL", "info")
self.env.setdefault("VKD3D_DEBUG", "warn")
self.env.setdefault("WINE_MONO_TRACE", "E:System.NotImplementedException")
#for performance, logging is disabled by default; override with user_settings.py
self.env.setdefault("WINEDEBUG", "-all")
self.env.setdefault("DXVK_LOG_LEVEL", "none")
self.env.setdefault("VKD3D_DEBUG", "none")
#default wine-mono override for FNA games
self.env.setdefault("WINE_MONO_OVERRIDES", "Microsoft.Xna.Framework.*,Gac=n")
......@@ -414,7 +437,7 @@ class Session:
self.check_environment("PROTON_USE_SECCOMP", "seccomp")
if not "noesync" in self.compat_config:
self.env["WINEESYNC"] = "1"
self.env["WINEESYNC"] = "1"
if not "nofsync" in self.compat_config:
self.env["WINEFSYNC"] = "1"
......@@ -430,7 +453,7 @@ class Session:
if "forcelgadd" in self.compat_config:
self.env["WINE_LARGE_ADDRESS_AWARE"] = "1"
g_compatdata.setup_prefix()
if "nod3d11" in self.compat_config:
......@@ -453,34 +476,22 @@ class Session:
s = s + ";" + dll + "=" + setting
else:
s = dll + "=" + setting
if "WINEDLLOVERRIDES" in os.environ:
self.env["WINEDLLOVERRIDES"] = os.environ["WINEDLLOVERRIDES"] + ";" + s
else:
self.env["WINEDLLOVERRIDES"] = s
def dump_dbg_env(self, f):
f.write("PATH=\"" + self.env["PATH"] + "\" \\\n")
f.write("\tTERM=\"xterm\" \\\n") #XXX
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 "WINEFSYNC" in self.env:
f.write("\tWINEFSYNC=\"" + self.env["WINEFSYNC"] + "\" \\\n")
if "WINEDLLOVERRIDES" in self.env:
f.write("\tWINEDLLOVERRIDES=\"" + self.env["WINEDLLOVERRIDES"] + "\" \\\n")
if "WINE_LARGE_ADDRESS_AWARE" in self.env:
f.write("\tWINE_LARGE_ADDRESS_AWARE=\"" + self.env["WINE_LARGE_ADDRESS_AWARE"] + "\" \\\n")
def run_proc(self, args, local_env=None):
if local_env is None:
local_env = self.env
subprocess.call(args, env=local_env, stderr=self.log_file, stdout=self.log_file)
subprocess.call(args, env=local_env)
def run(self):
self.run_proc([g_proton.wine_bin] + sys.argv[2:] + self.cmdlineappend)
if "PW_GAMEMODERUN" in os.environ and nonzero(os.environ["PW_GAMEMODERUN"]):
self.run_proc([g_proton.gamemoderun] + [g_proton.wine_bin] + sys.argv[2:] + sys.argv[3:])
else:
self.run_proc([g_proton.wine_bin] + sys.argv[2:] + sys.argv[3:])
if __name__ == "__main__":
if not "STEAM_COMPAT_DATA_PATH" in os.environ:
......@@ -495,7 +506,7 @@ if __name__ == "__main__":
g_session.init_wine()
# g_proton.make_default_prefix()
g_proton.make_default_prefix()
g_session.init_session()
......@@ -503,6 +514,19 @@ if __name__ == "__main__":
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)
sys.stdout.buffer.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)
sys.stdout.buffer.write(path)
else:
log("Need a verb.")
sys.exit(1)
......
......@@ -62,6 +62,7 @@ echo "Version WINE in the Port" >> "${PORT_WINE_PATH}/${portname}.log"
echo "-------------------------------------------" >> "${PORT_WINE_PATH}/${portname}.log"
echo "log WINE" >> "${PORT_WINE_PATH}/${portname}.log"
export PORTWINE_LOG=1
export WINEDEBUG="fixme-all"
export DXVK_LOG_LEVEL="info"
export VK_LOADER_DEBUG="warn"
......
......@@ -54,8 +54,8 @@ fi
read "var_dxvk_on" < "${config_path}/dxvk_on"
export "var_dxvk_on"
########################################################################
WINEDIR="${PORT_WINE_PATH}"/data/dist
WINELIB="${PORT_WINE_PATH}"/data/libs
export WINEDIR="${PORT_WINE_PATH}"/data/dist
export WINELIB="${PORT_WINE_PATH}"/data/libs
export PROTONRUN="${PORT_WINE_PATH}/data/proton"
export WINEARCH=win64
export WINELOADER="${WINEDIR}/bin/wine"
......@@ -66,8 +66,16 @@ export WINEPREFIX="${PORT_WINE_PATH}/data/pfx"
export PATH="${WINEDIR}/bin:${PATH}"
export WINESTART="C:\\windows\\command\\start.exe"
export STEAM_COMPAT_DATA_PATH="${PORT_WINE_PATH}/data/"
#export OS_BASED="$(cat /etc/os-release | grep ID_LIKE | cut -d '=' -f2)"
if [ -d "${WINELIB}" ]; then #&& [ "${OS_BASED}" != "arch" ]
########################################################################
export DXVK_STATE_CACHE_PATH="${PATH_TO_GAME}"
export DXVK_STATE_CACHE=1
export urlg="http://portwine-linux.ru/donate"
########################################################################
START_PORTWINE ()
{
sh "${link}"/port_update
if [ -d "${WINELIB}" ]; then
host_lib_paths=
/sbin/ldconfig -XNv | grep "/" | cut -d: -f1 1> "${config_path}"/default_lib_paths
while read lib_path_prefix; do
......@@ -84,21 +92,8 @@ if [ -d "${WINELIB}" ]; then #&& [ "${OS_BASED}" != "arch" ]
else
echo "runtime libs is disabled"
fi
export GST_PLUGIN_SYSTEM_PATH_1_0="${WINEDIR}/lib64/lib/gstreamer-1.0/:${WINEDIR}/lib/lib/gstreamer-1.0/"
export WINE_GST_REGISTRY_DIR="${PORT_WINE_PATH}/data/gstreamer-1.0/"
########################################################################
export DXVK_STATE_CACHE_PATH="${PATH_TO_GAME}"
export DXVK_STATE_CACHE=1
export urlg="http://portwine-linux.ru/donate"
########################################################################
START_PORTWINE ()
{
sh "${link}"/port_update
export DXVK_LOG_LEVEL="none"
export VKD3D_DEBUG="none"
export PROTON_NO_FSYNC=0
export optirun_on=""
export optirun_on=
if [ -x "`which nvidia-settings 2>/dev/null`" ]; then
if [ -x "`which primusrun 2>/dev/null`" ]; then
export optirun_on="primusrun"
......@@ -109,7 +104,7 @@ if [ -x "`which nvidia-settings 2>/dev/null`" ]; then
fi
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __GL_SYNC_TO_VBLANK=1
# export __GL_SYNC_TO_VBLANK=1
export __GL_SHADER_DISK_CACHE_PATH="${PATH_TO_GAME}"
export __GL_SHADER_DISK_CACHE=1
export __GL_SHADER_DISK_CACHE_SIZE=1000000000
......@@ -124,12 +119,12 @@ if [ -x "`which nvidia-settings 2>/dev/null`" ]; then
echo "runtime libs is disabled"
else
export DRI_PRIME=1
export vblank_mode=1
# export vblank_mode=1
export mesa_glthread=true
# export RADV_DEBUG=nocache,nomemorycache
local AMD_ATI="$(lspci | grep AMD/ATI)"
if [ ! -z "${AMD_ATI}" ]; then
export DXVK_CONFIG_FILE="${PORT_WINE_PATH}/data/dxvk_amd.conf"
# export DXVK_CONFIG_FILE="${PORT_WINE_PATH}/data/dxvk_amd.conf"
if [ "${PORTWINE_ACO}" -eq "1" ]; then
export RADV_PERFTEST=aco
echo "ACO is enabled"
......@@ -143,7 +138,7 @@ if [ "${var_dxvk_on}" -eq "1" ]; then
elif [ "${var_dxvk_on}" -eq "2" ]; then
export DXVK_HUD="fps,devinfo,version"
fi
export def_pfx="${PORT_WINE_PATH}data/dist/share/default_pfx/"
export def_pfx="${PORT_WINE_PATH}/data/dist/share/default_pfx/"
if [ ! -d "${def_pfx}" ]; then
"${PROTONRUN}" "run" | pwzen
fi
......@@ -160,12 +155,13 @@ if [ $(pgrep xneur)>'0' ]; then
export int_xneur=1
fi
if [ -x "`which "gamemoderun" 2>/dev/null`" ]; then
if [ ! -z "${LD_PRELOAD}" ]; then
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0:${LD_PRELOAD}"
else
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0"
fi
sleep 1
systemctl --user enable gamemoded.service
systemctl --user restart gamemoded.service
export PW_GAMEMODERUN=1
echo "Gamemod will be launched."
else
export PW_GAMEMODERUN=0
echo "Gamemod not installed!"
fi
ADD_IN_START_PORTWINE
......@@ -193,7 +189,7 @@ fi
########################################################################
STOP_PORTWINE ()
{
WAIT_WINESERVER
#WAIT_WINESERVER
ADD_IN_STOP_PORTWINE
if [ "$int_xneur" -eq "1" ]; then
xneur &
......
......@@ -4,8 +4,8 @@
"${WINESERVER}" -k
START_PORTWINE
if [ ! -z ${optirun_on} ]; then
${optirun_on} "${PROTONRUN}" "run" "${gamestart}" ${launch_parameters} &>/dev/null & KILL9_WINEDEVICE
${optirun_on} "${PROTONRUN}" "run" "${gamestart}" ${launch_parameters}
else
"${PROTONRUN}" "run" "${gamestart}" ${launch_parameters} &>/dev/null & KILL9_WINEDEVICE
"${PROTONRUN}" "run" "${gamestart}" ${launch_parameters}
fi
STOP_PORTWINE
......@@ -17,21 +17,21 @@ export WINEDLLOVERRIDES="winemenubuilder.exe=d"
export WINEDEBUG="-all"
export kill_winedevice=0
export kill_explorer=0
export PORTWINE_ACO=0
export PORTWINE_ACO=1
########################################################################
ADD_IN_START_PORTWINE ()
{
if [ "${var_dxvk_on}" -eq "0" ]
then ###OPENGL###
export PROTON_USE_WINED3D=1
export PROTON_USE_VKD3D=0
export PROTON_NO_D9VK=1
export PW_DXGI_FOR_VKD3D=0
export PROTON_NO_D9VK=0
export PROTON_NO_D3D11=0
export PROTON_NO_D3D10=0
export PROTON_OLD_GL_STRING=0
else ###DXVK###
export PROTON_USE_WINED3D=0
export PROTON_USE_VKD3D=0
export PW_DXGI_FOR_VKD3D=1
export PROTON_NO_D9VK=0
export PROTON_NO_D3D11=0
export PROTON_NO_D3D10=0
......
......@@ -4,8 +4,8 @@
START_PORTWINE
if [ ! -z ${optirun_on} ]
then
${optirun_on} "${PROTONRUN}" "run" "cmd" >&2
"/usr/bin/xterm" -e '"${optirun_on}" "${PROTONRUN}" "run" "cmd"'
else
"${PROTONRUN}" "run" "cmd" >&2
"/usr/bin/xterm" -e '"${PROTONRUN}" "run" "cmd"'
fi
STOP_PORTWINE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment