From d88bf7fb38d27a1369c78b7b4c7ca1f075b1b275 Mon Sep 17 00:00:00 2001
From: castro-fidel <tergoevm@gmail.com>
Date: Tue, 13 Jul 2021 21:03:33 +0300
Subject: [PATCH] ###Scripts version 1118###

---
 data_from_portwine/changelog      |  6 +++++
 data_from_portwine/scripts/runlib | 39 +++++++++++++------------------
 data_from_portwine/scripts/var    |  4 ++--
 data_from_portwine/vkBasalt.conf  | 32 ++++++++++++-------------
 4 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/data_from_portwine/changelog b/data_from_portwine/changelog
index 79f84209..a02bf82f 100644
--- a/data_from_portwine/changelog
+++ b/data_from_portwine/changelog
@@ -6,6 +6,12 @@
 * добавить контроль за окнами для правильного отключения прогресс бара
 * заниматься только развитием проекта за счет вашей подписки на https://boosty.to/portwine-linux.ru
 -----------------------------------------
+###Scripts version 1118###
+* Обновлены libs_v17 с интеграцией MANGOHUD, vkBasalt + reshade
+* MANGOHUD и vkBasalt польностью интегрированы в контейнер
+* MANGOHUD снова работает под всеми режимами запуска (OpenGL и Vulkan) включая 32-ух битные игры. 
+* HOTFIX - user.conf корректно переопределяет все переменные
+
 ###Scripts version 1117###
 * доработка определение месторасполажения установленных шейдеров для vkBasalt
 * добавлена переменная "PW_SANDBOX_HOME_PATH" при существовании которой закрывается доступ к домашнему каталогу
diff --git a/data_from_portwine/scripts/runlib b/data_from_portwine/scripts/runlib
index f40562d2..93139c42 100755
--- a/data_from_portwine/scripts/runlib
+++ b/data_from_portwine/scripts/runlib
@@ -120,28 +120,20 @@ pw_mangohud_check () {
     export RUN_MANGOHUD=""
     unset MANGOHUD
     unset MANGOHUD_DLSYM
-    if [ -x "`which mangohud 2>/dev/null`" ] && [ "${PW_MANGOHUD}" == "1" ] ; then
+    if [ "${PW_MANGOHUD}" == "1" ] ; then
         if [ "${PW_VULKAN_USE}" = "0" ]; then
-            export MANGOHUD_DLSYM=1
-            export RUN_MANGOHUD=mangohud
+            export RUN_MANGOHUD="mangohud --dlsym"
         else
-            export MANGOHUD=1
+            export RUN_MANGOHUD="mangohud"
         fi
     else
         export DISABLE_MANGOHUD=1
     fi
 }
 pw_vkbasalt_check () {
-    if [ -d "${HOME}/.local/share/reshade/Shaders/" ]; then
-        export VKBASALT_CONFIG_FILE="${PORT_WINE_PATH}/data/vkBasalt.conf"
-        [[ xuser = `cat "${VKBASALT_CONFIG_FILE}" | grep -om1 xuser` ]] && sed -i "s%/xuser/%/${USER}/%" "${VKBASALT_CONFIG_FILE}" 
-    elif [ -d "/usr/share/reshade" ]; then
-        export VKBASALT_CONFIG_FILE="${PORT_WINE_PATH}/data/vkBasalt.conf"
-        mkdir -p "${HOME}/.local/share/reshade"
-        cp -fR /usr/share/reshade "${HOME}/.local/share"
-        [[ xuser = `cat "${VKBASALT_CONFIG_FILE}" | grep -om1 xuser` ]] && sed -i "s%/xuser/%/${USER}/%" "${VKBASALT_CONFIG_FILE}"
-        [[ Shaders = `cat "${VKBASALT_CONFIG_FILE}" | grep -om1 Shaders` ]] && sed -i "s%/Shaders/%/shaders/%" "${VKBASALT_CONFIG_FILE}"
-        [[ Textures = `cat "${VKBASALT_CONFIG_FILE}" | grep -om1 Textures` ]] && sed -i 's%/Textures$%/textures%' "${VKBASALT_CONFIG_FILE}"
+    if [ ! -z "${ENABLE_VKBASALT}" ] && [ "${ENABLE_VKBASALT}" == 1 ]
+    then export VKBASALT_CONFIG_FILE="${PORT_WINE_PATH}/data/vkBasalt.conf"
+    else export DISABLE_VKBASALT=1
     fi
 } 
 gui_question () {
@@ -320,7 +312,6 @@ PW_TRAY_ICON () {
 }
 START_PORTWINE () {
     PW_TRAY_ICON &
-    . "${USER_CONF}"
     if [ -x "`which konsole 2>/dev/null`" ]; then export PW_TERM="konsole --nofork -e"
 #    elif [ -x "`which gnome-terminal 2>/dev/null`" ]; then export PW_TERM="gnome-terminal -- /bin/bash" ???
     elif [ -x "`which lxterminal 2>/dev/null`" ]; then export PW_TERM="lxterminal -e"
@@ -890,22 +881,22 @@ PW_RUN () {
     if [ "${PW_LOG}" == 1 ] ; then
         export PW_LOG_TO_FILE="${PORT_WINE_PATH}/${portname}.log"
         if [ ! -z "${PW_GAMEMODERUN}" ] && [ "${PW_GAMEMODERUN}" != 0 ] ; then
-            echo "Full command line:  $PW_TERM ${optirun_on} gamemoderun ${RUN_MANGOHUD} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}" "&>>${PW_LOG_TO_FILE}"
-            ${optirun_on} gamemoderun ${RUN_MANGOHUD} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]} &>>"${PW_LOG_TO_FILE}"
+            echo "Full command line:  $PW_TERM ${optirun_on} gamemoderun ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}" "&>>${PW_LOG_TO_FILE}"
+            ${optirun_on} gamemoderun ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]} &>>"${PW_LOG_TO_FILE}"
         else
-            echo "Full command line: $PW_TERM ${optirun_on} ${RUN_MANGOHUD} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}" "&>>${PW_LOG_TO_FILE}"
-            ${optirun_on} ${PW_RUNTIME} ${RUN_MANGOHUD} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]} &>>"${PW_LOG_TO_FILE}"
+            echo "Full command line: $PW_TERM ${optirun_on} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}" "&>>${PW_LOG_TO_FILE}"
+            ${optirun_on} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]} &>>"${PW_LOG_TO_FILE}"
         fi
     else
         [ "${PW_USE_TERMINAL}" != "1" ] && export PW_TERM=""
         if [ ! -z "${PW_GAMEMODERUN}" ] && [ "${PW_GAMEMODERUN}" != 0 ] ; then
             echo "Use gamemode without terminal"
-            echo "Full command line: $PW_TERM ${optirun_on} gamemoderun ${RUN_MANGOHUD} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}"
-            $PW_TERM ${optirun_on} gamemoderun  ${PW_RUNTIME} ${RUN_MANGOHUD} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}
+            echo "Full command line: $PW_TERM ${optirun_on} gamemoderun ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}"
+            $PW_TERM ${optirun_on} gamemoderun ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}
         else
             echo "Don\`t use gamemode without terminal"
-            echo "Full command line: $PW_TERM ${optirun_on} ${RUN_MANGOHUD} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}"
-            $PW_TERM ${optirun_on} ${RUN_MANGOHUD} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}
+            echo "Full command line: $PW_TERM ${optirun_on} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}"
+            $PW_TERM ${optirun_on} ${PW_RUNTIME} env LD_LIBRARY_PATH="${PW_AND_RUNTIME_LIBRARY_PATH}${LD_LIBRARY_PATH}" ${RUN_MANGOHUD} "${WINELOADER}" "$@" ${LAUNCH_PARAMETERS[*]}
         fi
     fi
 }
@@ -938,10 +929,12 @@ export USER_CONF="${PORT_WINE_PATH}/data/user.conf"
 check_user_conf
 
 if [ -z "${INSTALLING_PORT}" ] ; then
+    . "${USER_CONF}"
     PW_LOAD_LIBS
     PW_DOWNLOAD_MONO
     PW_DOWNLOAD_GECKO
     PW_UPDATE
     PW_SCRIPTS_UPDATE
     PW_INIT_DB
+    . "${USER_CONF}"
 fi
diff --git a/data_from_portwine/scripts/var b/data_from_portwine/scripts/var
index f78c4440..c3e2d046 100755
--- a/data_from_portwine/scripts/var
+++ b/data_from_portwine/scripts/var
@@ -1,6 +1,6 @@
 #!/bin/bash
 #Author: Castro-Fidel (PortWINE-Linux.ru)
-#SCRIPTS_VERSION=1117
+#SCRIPTS_VERSION=1118
 ########################################################################
 export PW_MANGOHUD=1
 export MANGOHUD_CONFIG=font_size=24,position=top-left,toggle_hud=Shift_R+F12,no_display
@@ -26,7 +26,7 @@ export PW_WINDOWS_VER="10"
 export WINEARCH="win64"
 export mono_ver=6.1.2
 export gecko_ver=2.47.2
-export pw_libs_ver="_v16"
+export pw_libs_ver="_v17"
 
 export WINEDIR="${PORT_WINE_PATH}/data/dist"
 export WINEPREFIX="${PORT_WINE_PATH}/data/pfx"
diff --git a/data_from_portwine/vkBasalt.conf b/data_from_portwine/vkBasalt.conf
index a44c365c..5f8c4401 100644
--- a/data_from_portwine/vkBasalt.conf
+++ b/data_from_portwine/vkBasalt.conf
@@ -1,19 +1,19 @@
-reshadeTexturePath = /home/xuser/.local/share/reshade/Textures
-reshadeIncludePath = /home/xuser/.local/share/reshade
-FakeMotionBlur = /home/xuser/.local/share/reshade/Shaders/FakeMotionBlur.fx
-FXAA = /home/xuser/.local/share/reshade/Shaders/FXAA.fx
-GaussianBlur = /home/xuser/.local/share/reshade/Shaders/GaussianBlur.fx
-HQ4X = /home/xuser/.local/share/reshade/Shaders/HQ4X.fx
-Layer = /home/xuser/.local/share/reshade/Shaders/Layer.fx
-LevelsPlus = /home/xuser/.local/share/reshade/Shaders/LevelsPlus.fx
-MagicBloom = /home/xuser/.local/share/reshade/Shaders/MagicBloom.fx
-ReflectiveBumpMapping = /home/xuser/.local/share/reshade/Shaders/ReflectiveBumpMapping.fx
-SMAA = /home/xuser/.local/share/reshade/Shaders/SMAA.fx
-Tonemap = /home/xuser/.local/share/reshade/Shaders/Tonemap.fx
-Vignette = /home/xuser/.local/share/reshade/Shaders/Vignette.fx
-Curves = /home/xuser/.local/share/reshade/Shaders/Curves.fx
-FakeHDR = /home/xuser/.local/share/reshade/Shaders/FakeHDR.fx
+reshadeTexturePath = /usr/local/share/reshade/Textures
+reshadeIncludePath = /usr/local/share/reshade/
+FakeMotionBlur = /usr/local/share/reshade/shaders/FakeMotionBlur.fx
+FXAA = /usr/local/share/reshade/shaders/FXAA.fx
+GaussianBlur = /usr/local/share/reshade/shaders/GaussianBlur.fx
+HQ4X = /usr/local/share/reshade/shaders/HQ4X.fx
+Layer = /usr/local/share/reshade/shaders/Layer.fx
+LevelsPlus = /usr/local/share/reshade/shaders/LevelsPlus.fx
+MagicBloom = /usr/local/share/reshade/shaders/MagicBloom.fx
+ReflectiveBumpMapping = /usr/local/share/reshade/shaders/ReflectiveBumpMapping.fx
+SMAA = /usr/local/share/reshade/shaders/SMAA.fx
+Tonemap = /usr/local/share/reshade/shaders/Tonemap.fx
+Vignette = /usr/local/share/reshade/shaders/Vignette.fx
+Curves = /usr/local/share/reshade/shaders/Curves.fx
+FakeHDR = /usr/local/share/reshade/shaders/FakeHDR.fx
 
-casSharpness=0.8
+casSharpness=0.75
 toggleKey = Home
 effects = Curves:cas