From 71b6108ee47882f6cfeadbe20f7e085675f4b8ed Mon Sep 17 00:00:00 2001
From: castro-fidel <tergoevm@gmail.com>
Date: Thu, 17 Dec 2020 23:23:37 +0300
Subject: [PATCH] Windows STEAM works for any version of the wine-proton

---
 data_from_portwine/port_on                    | 80 +++++++------------
 data_from_portwine/scripts/portproton.sh      |  1 +
 data_from_portwine/scripts/runlib             | 21 +++--
 data_from_portwine/scripts/setup              |  3 +-
 .../scripts/vars/PortBattleNET_vars           |  8 --
 data_from_portwine/scripts/vars/PortEpic_vars |  8 --
 data_from_portwine/scripts/vars/PortGOG_vars  | 23 +++---
 data_from_portwine/scripts/vars/PortLoL_vars  |  3 -
 .../scripts/vars/PortMailRu_vars              |  2 -
 .../scripts/vars/PortOrigin_vars              |  8 --
 .../scripts/vars/PortProton_vars              | 19 ++---
 .../scripts/vars/PortUplay_vars               |  8 --
 data_from_portwine/scripts/vars/PortWGC_vars  |  8 --
 13 files changed, 65 insertions(+), 127 deletions(-)

diff --git a/data_from_portwine/port_on b/data_from_portwine/port_on
index ecbab1b9..e2af5dc3 100755
--- a/data_from_portwine/port_on
+++ b/data_from_portwine/port_on
@@ -8,6 +8,7 @@ import filecmp
 import fnmatch
 import json
 import os
+import os.path
 import shutil
 import errno
 import stat
@@ -135,11 +136,7 @@ class CompatData:
             makedirs(self.prefix_dir + "/drive_c")
             set_dir_casefold_bit(self.prefix_dir + "/drive_c")
 
-        if not os.path.exists(self.prefix_dir + "/user.reg"):
-            self.copy_pfx()
-
         use_wined3d = "wined3d" in g_session.compat_config
-        use_dxvk_dxgi = "WINEDLLOVERRIDES" in g_session.env and "dxgi=n" in g_session.env["WINEDLLOVERRIDES"]
 
         builtin_dll_copy = os.environ.get("PROTON_DLL_COPY",
                 #dxsetup redist
@@ -180,44 +177,45 @@ class CompatData:
         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)
+        if os.path.isfile(g_proton.lib_dir + "wine/fakedlls/vrclient.dll"):
+            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 os.path.isfile(g_proton.lib_dir + "wine/dxvk/openvr_api_dxvk.dll"):
+            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 use_wined3d:
-            dxvkfiles = ["dxvk_config"]
+            dxvkfiles = []
             wined3dfiles = ["d3d11", "d3d10", "d3d10core", "d3d10_1", "d3d9"]
+            if os.path.isfile(g_proton.lib64_dir + "wine/dxvk/dxvk_config.dll"):
+                dxvkfiles.append("dxvk_config")
         else:
             dxvkfiles = ["dxvk_config", "d3d11", "d3d10", "d3d10core", "d3d10_1", "d3d9"]
             wined3dfiles = []
 
         #if the user asked for dxvk's dxgi (dxgi=n), then copy it into place
-        if use_dxvk_dxgi:
+        if "PW_DXGI_FROM_DXVK" in os.environ and nonzero(os.environ["PW_DXGI_FROM_DXVK"]):
             dxvkfiles.append("dxgi")
         else:
             wined3dfiles.append("dxgi")
 
         for f in wined3dfiles:
-            try_copy(g_proton.lib64_dir + "wine/" + f + ".dll",
-                    self.prefix_dir + "drive_c/windows/system32/" + f + ".dll")
-            try_copy(g_proton.lib_dir + "wine/" + f + ".dll",
-                    self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
+            try_copy(g_proton.lib64_dir + "wine/" + f + ".dll", self.prefix_dir + "drive_c/windows/system32/" + f + ".dll")
+            try_copy(g_proton.lib_dir + "wine/" + f + ".dll", self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
 
         for f in dxvkfiles:
-            try_copy(g_proton.lib64_dir + "wine/dxvk/" + f + ".dll",
-                    self.prefix_dir + "drive_c/windows/system32/" + f + ".dll")
-            try_copy(g_proton.lib_dir + "wine/dxvk/" + f + ".dll",
-                    self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
-            g_session.dlloverrides[f] = "n"
+            if os.path.isfile(g_proton.lib64_dir + "wine/dxvk/" + f + ".dll"):
+                try_copy(g_proton.lib64_dir + "wine/dxvk/" + f + ".dll", self.prefix_dir + "drive_c/windows/system32/" + f + ".dll")
+                try_copy(g_proton.lib_dir + "wine/dxvk/" + f + ".dll", self.prefix_dir + "drive_c/windows/syswow64/" + f + ".dll")
+                g_session.dlloverrides[f] = "n"
 
-        try_copy(g_proton.lib64_dir + "wine/vkd3d-proton/d3d12.dll",
-                self.prefix_dir + "drive_c/windows/system32/d3d12.dll")
-        try_copy(g_proton.lib_dir + "wine/vkd3d-proton/d3d12.dll",
-                self.prefix_dir + "drive_c/windows/syswow64/d3d12.dll")
+        if os.path.isfile(g_proton.lib64_dir + "wine/vkd3d-proton/d3d12.dll"):
+            try_copy(g_proton.lib64_dir + "wine/vkd3d-proton/d3d12.dll", self.prefix_dir + "drive_c/windows/system32/d3d12.dll")
+        if os.path.isfile(g_proton.lib_dir + "wine/vkd3d-proton/d3d12.dll"):
+            try_copy(g_proton.lib_dir + "wine/vkd3d-proton/d3d12.dll", self.prefix_dir + "drive_c/windows/syswow64/d3d12.dll")
 
 def comma_escaped(s):
     escaped = False
@@ -231,7 +229,8 @@ class Session:
     def __init__(self):
         self.env = dict(os.environ)
         self.dlloverrides = {
-                "steam.exe": "n"
+                "dotnetfx35.exe": "b", #replace the broken installer, as does Windows
+                "mfplay": "n", #disable built-in mfplay             
         }
 
         self.compat_config = set()
@@ -299,40 +298,34 @@ class Session:
         self.env.setdefault("VKD3D_DEBUG", "none")
 
         #default wine-mono override for FNA games
-        self.env.setdefault("WINE_MONO_OVERRIDES", "Microsoft.Xna.Framework.*,Gac=n")
+#        self.env.setdefault("WINE_MONO_OVERRIDES", "Microsoft.Xna.Framework.*,Gac=n")
 
         if "wined3d11" in self.compat_config:
             self.compat_config.add("wined3d")
 
         if not self.check_environment("PW_USE_WINED3D", "wined3d"):
             self.check_environment("PW_USE_WINED3D11", "wined3d")
-        self.check_environment("PW_NO_D3D12", "nod3d12")
-        self.check_environment("PW_NO_D3D11", "nod3d11")
-        self.check_environment("PW_NO_D3D10", "nod3d10")
-        self.check_environment("PW_NO_D3D9",  "nod3d9")
         self.check_environment("PW_NO_ESYNC", "noesync")
         self.check_environment("PW_NO_FSYNC", "nofsync")
         self.check_environment("PW_FORCE_LARGE_ADDRESS_AWARE", "forcelgadd")
         self.check_environment("PW_OLD_GL_STRING", "oldglstr")
-        self.check_environment("PW_NO_VR", "novrclient")
         self.check_environment("PW_NO_WINEMFPLAY", "nomfplay")
         self.check_environment("PW_NO_WRITE_WATCH", "nowritewatch")
         self.check_environment("PW_DXVK_ASYNC", "dxvkasync")
         self.check_environment("PW_NVAPI_DISABLE", "nonvapi")
         self.check_environment("PW_WINEDBG_DISABLE", "nowinedbg")
-        self.check_environment("PW_PULSE_LOWLATENCY", "pulselowlat")
         self.check_environment("PW_HIDE_NVIDIA_GPU", "hidenvgpu")
         self.check_environment("PW_VKD3D_FEATURE_LEVEL", "vkd3dfl12")
         
         if "noesync" in self.compat_config:
             self.env.pop("WINEESYNC", "")
         else:
-            self.env["WINEESYNC"] = "1" if "SteamGameId" in self.env else "0"
+            self.env["WINEESYNC"] = "1"
 
         if "nofsync" in self.compat_config:
             self.env.pop("WINEFSYNC", "")
         else:
-            self.env["WINEFSYNC"] = "1" if "SteamGameId" in self.env else "0"
+            self.env["WINEFSYNC"] = "1"
 
         if "nowritewatch" in self.compat_config:
             self.env["WINE_DISABLE_WRITE_WATCH"] = "1"
@@ -357,23 +350,6 @@ class Session:
             self.env["WINEDEBUG"] = "-all"
 
         g_compatdata.setup_prefix()
-
-        if "nod3d12" in self.compat_config:
-            self.dlloverrides["d3d12"] = ""
-            
-        if "nod3d11" in self.compat_config:
-            self.dlloverrides["d3d11"] = ""
-            if "dxgi" in self.dlloverrides:
-                del self.dlloverrides["dxgi"]
-
-        if "nod3d10" in self.compat_config:
-            self.dlloverrides["d3d10_1"] = ""
-            self.dlloverrides["d3d10"] = ""
-            self.dlloverrides["dxgi"] = ""
-
-        if "nod3d9" in self.compat_config:
-            self.dlloverrides["d3d9"] = ""
-            self.dlloverrides["dxgi"] = ""
             
         if "nowritewatch" in self.compat_config:
             self.env["WINE_DISABLE_WRITE_WATCH"] = "1"
diff --git a/data_from_portwine/scripts/portproton.sh b/data_from_portwine/scripts/portproton.sh
index 220d08af..7eb96e1a 100755
--- a/data_from_portwine/scripts/portproton.sh
+++ b/data_from_portwine/scripts/portproton.sh
@@ -5,6 +5,7 @@ START_PORTWINE
 if [ -f "$1" ]; then
     export portwine_exe="$(readlink -f "$1")"
     export PATH_TO_GAME="$( cd "$( dirname "$1" )" >/dev/null 2>&1 && pwd )"
+    cd "$PATH_TO_GAME"
     if [ ! -z ${optirun_on} ]; then
         "${PW_RUNTIME}" $PW_TERM ${optirun_on} "${port_on_run}" "run" "$portwine_exe"
     else
diff --git a/data_from_portwine/scripts/runlib b/data_from_portwine/scripts/runlib
index 758f9241..43a248b9 100755
--- a/data_from_portwine/scripts/runlib
+++ b/data_from_portwine/scripts/runlib
@@ -24,6 +24,7 @@ pwzen() {
 zenity --progress --title="Settings..." --text="Please wait!" --pulsate --auto-close --auto-kill --width=450
 } 
 ########################################################################
+ulimit -c unlimited
 cd "$(dirname "`readlink -f "$0"`")"
 export PORT_SCRIPTS_PATH="$(pwd)"
 cd "${PORT_SCRIPTS_PATH}/../../"
@@ -53,7 +54,7 @@ if [ ! -e "${PORT_WINE_TMP_PATH}/${portname}_ver" ]; then
 	echo "10" > "${PORT_WINE_TMP_PATH}/${portname}_ver"
 fi
 ########################################################################
-export pw_libs_ver="_v2"
+export pw_libs_ver="_v3"
 export port_on_run="${PORT_WINE_PATH}/data/port_on"
 export WINEDIR="${PORT_WINE_PATH}"/data/dist
 export WINELIB="${HOME}/.PortWINE/libs${pw_libs_ver}"
@@ -114,7 +115,7 @@ then
     start_settings=`zenity --title  "${ss_title}" --text "${ss_text}" --list --radiolist \
     --column="${inst_set}" --column "${ss_ver}" --column "${ss_dr}"  --width=500 --height=220 \
     TRUE "DXVK" "${ss_ogl_3}" \
-    FALSE "VKD3D and OpenGL" "${ss_ogl_2}" `
+    FALSE "VKD3D and OpenGL" "${ss_ogl_2}" ` 
     if [ $? -eq 1 ];then exit 1; fi
     case $start_settings in
     "VKD3D and OpenGL") 
@@ -157,17 +158,20 @@ echo "DXVK_HUD=${DXVK_HUD}"
 
 if [ "${var_dxvk_on}" != "off" ]; then
     export PW_USE_WINED3D=0
-    export WINEDLLOVERRIDES="${WINEDLLOVERRIDES};dxgi=n"
+    export PW_DXGI_FROM_DXVK=1
     echo "Use DXVK and D9VK (DX9-DX11 to Vulkan)"
 
 else
     export PW_USE_WINED3D=1
-    echo "Use OpenGL and VKD3D (DX9-DX11 to OpenGL and DX12 to vulkan)" 
     export PW_VKD3D_FEATURE_LEVEL=1
+    export VKD3D_CONFIG=force_bindless_texel_buffer
+    echo "Use OpenGL and VKD3D (DX9-DX11 to OpenGL and DX12 to vulkan)"
 fi
 
 export DXVK_STATE_CACHE_PATH="${PATH_TO_GAME}"
 export DXVK_STATE_CACHE=1
+export STAGING_SHARED_MEMORY=1
+
 ########################################################################
 export optirun_on=
 export check_optimus_manager=
@@ -231,6 +235,11 @@ else
 fi
 echo "######################################################"
 ########################################################################
+sed -i '/HKCU,Software\\Valve\\Steam/d' "${WINEDIR}/share/wine/wine.inf" &&
+sed -i '/HKLM,Software\\Wow6432Node\\Valve\\Steam/d' "${WINEDIR}/share/wine/wine.inf" &&
+sed -i '/HKLM,Software\\Wow6432Node\\Valve\\Steam/d' "${WINEDIR}/share/wine/wine.inf" &&
+sed -i '/HKCR,steam\\shell\\open\\command/d' "${WINEDIR}/share/wine/wine.inf" &&
+rm -f  "${WINEDIR}"/lib*/wine/*steam*
 if [ ! -d "${WINEPREFIX}" ] || [ ! -d "${WINEPREFIX}"/dosdevices ] || [ ! -d "${WINEPREFIX}"/drive_c/windows ] || [ ! -f "${WINEPREFIX}"/system.reg ] || [ ! -f "${WINEPREFIX}"/user.reg ] || [ ! -f "${WINEPREFIX}"/userdef.reg ]; then
     "${PW_RUNTIME}" $PW_TERM "${WINELOADER}" wineboot -u
 fi
@@ -248,8 +257,8 @@ fi
 #    echo "######################################################"
 #fi
 ########################################################################
-cp -f "${WINEDIR}/lib/wine/fakedlls/dxgi.dll" "${WINEDIR}/lib/wine/dxgi.dll"
-cp -f "${WINEDIR}/lib64/wine/fakedlls/dxgi.dll" "${WINEDIR}/lib64/wine/dxgi.dll"
+#cp -f "${WINEDIR}/lib/wine/fakedlls/dxgi.dll" "${WINEDIR}/lib/wine/dxgi.dll"
+#cp -f "${WINEDIR}/lib64/wine/fakedlls/dxgi.dll" "${WINEDIR}/lib64/wine/dxgi.dll"
 
 ADD_IN_START_PORTWINE
 } 
diff --git a/data_from_portwine/scripts/setup b/data_from_portwine/scripts/setup
index 9c063faa..a679a68a 100755
--- a/data_from_portwine/scripts/setup
+++ b/data_from_portwine/scripts/setup
@@ -5,6 +5,7 @@
 rm -f "${PORT_WINE_PATH}/"*".log" 
 rm -f "${PORT_WINE_TMP_PATH}/update_notifier"
 rm -f "${PORT_WINE_TMP_PATH}/init_run_suc"
+rm -fr "${PORT_WINE_PATH}/data/pfx/dosdevices" 
 
 if [ ! -d "/home/${USER}/.local/share/applications" ]
 then
@@ -117,8 +118,6 @@ if [ -f "${PORT_WINE_PATH}/restart.desktop" ]; then
 	rm "${PORT_WINE_PATH}/restart.desktop"
 fi
 
-update-desktop-database -q "${HOME}/.local/share/applications"
-
 if [ "${s_install}" = "1" ]; then
 	echo "Installation completed successfully."
 else
diff --git a/data_from_portwine/scripts/vars/PortBattleNET_vars b/data_from_portwine/scripts/vars/PortBattleNET_vars
index 0377ac99..982b738c 100755
--- a/data_from_portwine/scripts/vars/PortBattleNET_vars
+++ b/data_from_portwine/scripts/vars/PortBattleNET_vars
@@ -11,17 +11,10 @@ export gamestart="${PATH_TO_GAME}/Battle.net Launcher.exe"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
 export PW_NO_FSYNC=1        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
 export PW_NO_ESYNC=1        # Do not use eventfd-based in-process synchronization primitives
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_TERMINAL=0
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -30,7 +23,6 @@ export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches i
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
 export PW_WINEDBG_DISABLE=0
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
 ########################################################################
diff --git a/data_from_portwine/scripts/vars/PortEpic_vars b/data_from_portwine/scripts/vars/PortEpic_vars
index d495e30a..c9574f6b 100755
--- a/data_from_portwine/scripts/vars/PortEpic_vars
+++ b/data_from_portwine/scripts/vars/PortEpic_vars
@@ -11,17 +11,10 @@ export gamestart="${PATH_TO_GAME}/EpicGamesLauncher.exe"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
 export PW_NO_FSYNC=0        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
 export PW_NO_ESYNC=0        # Do not use eventfd-based in-process synchronization primitives
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_TERMINAL=0
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -30,7 +23,6 @@ export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches i
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
 ########################################################################
diff --git a/data_from_portwine/scripts/vars/PortGOG_vars b/data_from_portwine/scripts/vars/PortGOG_vars
index 2bee2752..cd80b2b6 100755
--- a/data_from_portwine/scripts/vars/PortGOG_vars
+++ b/data_from_portwine/scripts/vars/PortGOG_vars
@@ -11,17 +11,10 @@ export gamestart="${PATH_TO_GAME}/GalaxyClient.exe"
 ########################################################################
 export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
 export PW_NO_FSYNC=0        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
 export PW_NO_ESYNC=0        # Do not use eventfd-based in-process synchronization primitives
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_TERMINAL=0
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -30,13 +23,25 @@ export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches i
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
 ########################################################################
+GalaxyCommunication () 
+{
+for ((;;)); do
+    if [ $(pgrep !!!!.*)>'0' ]; then
+	    "${WINEPREFIX}/drive_c/ProgramData/GOG.com/Galaxy/redists/GalaxyCommunication.exe"
+        break
+    else
+        sleep 2
+    fi    
+done
+}
+
 ADD_IN_START_PORTWINE ()
 {
-export launch_parameters=""
+export launch_parameters="/runWithoutUpdating /deelevated"
+GalaxyCommunication &
 cd "${PATH_TO_GAME}"
 }
 ########################################################################
diff --git a/data_from_portwine/scripts/vars/PortLoL_vars b/data_from_portwine/scripts/vars/PortLoL_vars
index cddd711c..9ac059cb 100755
--- a/data_from_portwine/scripts/vars/PortLoL_vars
+++ b/data_from_portwine/scripts/vars/PortLoL_vars
@@ -10,7 +10,6 @@ export PATH_TO_GAME="${PORT_WINE_PATH}/data/pfx/drive_c/${gamedir}"
 export gamestart="${PATH_TO_GAME}/RiotClientServices.exe"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
-export STAGING_SHARED_MEMORY=1
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
 export PW_LOG=0
 export PW_ACO=1
@@ -19,13 +18,11 @@ export PW_NO_FSYNC=1
 export PW_NO_ESYNC=1
 export PW_FILELOCK=1
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_SECCOMP=0
 export PW_NO_WINEMFPLAY=0
 export PW_NVAPI_DISABLE=1
 export PW_NO_WRITE_WATCH=1
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_LARGE_ADDRESS_AWARE=0
 ########################################################################
 ADD_IN_START_PORTWINE ()
diff --git a/data_from_portwine/scripts/vars/PortMailRu_vars b/data_from_portwine/scripts/vars/PortMailRu_vars
index 7ecd1b51..417bd42f 100755
--- a/data_from_portwine/scripts/vars/PortMailRu_vars
+++ b/data_from_portwine/scripts/vars/PortMailRu_vars
@@ -10,7 +10,6 @@ export PATH_TO_GAME="${PORT_WINE_PATH}/data/pfx/drive_c/users/steamuser/Local Se
 export gamestart="${PATH_TO_GAME}/GameCenter.exe"
 ########################################################################
 export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
-export STAGING_SHARED_MEMORY=0
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
 export PW_LOG=0
 export PW_ACO=1
@@ -22,7 +21,6 @@ export PW_NO_WINEMFPLAY=0
 export PW_NVAPI_DISABLE=1
 export PW_NO_WRITE_WATCH=1
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=1
 export PW_FORCE_LARGE_ADDRESS_AWARE=1
 ########################################################################
 ADD_IN_START_PORTWINE ()
diff --git a/data_from_portwine/scripts/vars/PortOrigin_vars b/data_from_portwine/scripts/vars/PortOrigin_vars
index ec5a0f7a..5843428b 100755
--- a/data_from_portwine/scripts/vars/PortOrigin_vars
+++ b/data_from_portwine/scripts/vars/PortOrigin_vars
@@ -13,17 +13,10 @@ export porturl="http://portwine-linux.ru/origin-linux/"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
 export PW_NO_FSYNC=0        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
 export PW_NO_ESYNC=0        # Do not use eventfd-based in-process synchronization primitives
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_TERMINAL=0
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -32,7 +25,6 @@ export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches i
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
 ########################################################################
diff --git a/data_from_portwine/scripts/vars/PortProton_vars b/data_from_portwine/scripts/vars/PortProton_vars
index 95e41dea..0275ec32 100755
--- a/data_from_portwine/scripts/vars/PortProton_vars
+++ b/data_from_portwine/scripts/vars/PortProton_vars
@@ -12,17 +12,10 @@ export porturl="http://portwine-linux.ru/"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
-export PW_NO_FSYNC=0        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
-export PW_NO_ESYNC=0        # Do not use eventfd-based in-process synchronization primitives
-export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
+export PW_NO_FSYNC=1        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
+export PW_NO_ESYNC=1        # Do not use eventfd-based in-process synchronization primitives
+export PW_DXVK_ASYNC=1
 export PW_USE_TERMINAL=0
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -30,10 +23,10 @@ export PW_NVAPI_DISABLE=1
 export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches in ntdll. This is a very dangerous hack and should only be applied if you have verified that the game can operate without write watches. This improves performance for some very specific games (e.g. CoreRT-based games).
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
-export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
+export PW_WINEDBG_DISABLE=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
+#export PULSE_LATENCY_MSEC=60
 ########################################################################
 ADD_IN_START_PORTWINE ()
 {
@@ -63,5 +56,5 @@ done
 ########################################################################
 ADD_IN_POST_INSTALL ()
 {
-echo " "
+update-desktop-database -q "${HOME}/.local/share/applications"
 }
diff --git a/data_from_portwine/scripts/vars/PortUplay_vars b/data_from_portwine/scripts/vars/PortUplay_vars
index 1f65ab4f..42715fa8 100755
--- a/data_from_portwine/scripts/vars/PortUplay_vars
+++ b/data_from_portwine/scripts/vars/PortUplay_vars
@@ -11,17 +11,10 @@ export porturl="https://portwine-linux.ru/uplay-linux/"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
 export PW_NO_FSYNC=0        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
 export PW_NO_ESYNC=0        # Do not use eventfd-based in-process synchronization primitives
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_TERMINAL=0
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -30,7 +23,6 @@ export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches i
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
 ########################################################################
diff --git a/data_from_portwine/scripts/vars/PortWGC_vars b/data_from_portwine/scripts/vars/PortWGC_vars
index d985943d..5a5612c0 100755
--- a/data_from_portwine/scripts/vars/PortWGC_vars
+++ b/data_from_portwine/scripts/vars/PortWGC_vars
@@ -11,17 +11,10 @@ export gamestart="${PATH_TO_GAME}/wgc.exe"
 ########################################################################
 #export MESA_GL_VERSION_OVERRIDE=4.4COMPAT
 export WINEDLLOVERRIDES="winemenubuilder.exe=d"
-export STAGING_SHARED_MEMORY=1
 export PW_LOG=0             # Enable debug mode fo terminal 
-export PW_NO_VR=1           # Disabled VR support 
-export PW_NO_D3D9=0         # Disable d3d9.dll
-export PW_NO_D3D10=0        # Disable d3d10.dll, for d3d10 games which can fall back to and run better with d3d9
-export PW_NO_D3D11=0        # Disable d3d11.dll, for d3d11 games which can fall back to and run better with d3d9
-export PW_NO_D3D12=0        # Disable d3d12.dll, for d3d12 games which can fall back to and run better with d3d11 or d3d9
 export PW_NO_FSYNC=0        # Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no FUTEX_WAIT_MULTIPLE support.
 export PW_NO_ESYNC=0        # Do not use eventfd-based in-process synchronization primitives
 export PW_DXVK_ASYNC=0
-export PW_DXGI_NATIVE=0
 export PW_USE_TERMINAL=1
 export PW_OLD_GL_STRING=0
 export PW_NO_WINEMFPLAY=0
@@ -30,7 +23,6 @@ export PW_NO_WRITE_WATCH=0          # Disable support for memory write watches i
 export PW_HIDE_NVIDIA_GPU=0
 export PW_FORCE_USE_VSYNC=2         # Vsync: 0-FORCE_OFF, 1-FORCE_ON, 2-BY_DEFAULT
 export PW_WINEDBG_DISABLE=1
-export PW_PULSE_LOWLATENCY=0
 export PW_FORCE_DISABLED_GAMEMOD=0              # Force disabele gamemod
 export PW_FORCE_LARGE_ADDRESS_AWARE=1           # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
 ########################################################################