202 lines
6.9 KiB
Bash
Executable File
202 lines
6.9 KiB
Bash
Executable File
#!/bin/bash
|
||
# Author: PortWINE-Linux.ru
|
||
########################################################################
|
||
[ $(id -u) -eq 0 ] && echo "Do not run this script as root!" && zenity --error --text "Do not run this script as root!" && exit 1
|
||
########################################################################
|
||
sszen() {
|
||
zenity --progress --title="Settings..." --text="Updating start parameters" --pulsate --auto-close --auto-kill --width=450
|
||
}
|
||
########################################################################
|
||
pwzen() {
|
||
zenity --progress --title="Settings..." --text="Please wait!" --pulsate --auto-close --auto-kill --width=450
|
||
}
|
||
########################################################################
|
||
export kill_winedevice=0
|
||
export kill_explorer=0
|
||
########################################################################
|
||
cd "$(dirname "`readlink -f "$0"`")"
|
||
export link="$(pwd)"
|
||
cd "${link}/../../"
|
||
export PORT_WINE_PATH="$(pwd)"
|
||
cd "${link}"
|
||
. "${link}"/vars
|
||
export config_path="${PORT_WINE_PATH}/data/tmp"
|
||
if [ ! -d "${config_path}" ]; then
|
||
mkdir -p "${config_path}"
|
||
fi
|
||
if [ ! -e "${config_path}/${portname}_loc" ]; then
|
||
SET_LANG=`zenity --title "Install $portname" --text "Select the language\nВыберите язык" --list --radiolist \
|
||
--column="Set (Выбор)" --column "Language (Язык):" \
|
||
TRUE "RUS" \
|
||
FALSE "ENG" `
|
||
echo "${SET_LANG}" > "${config_path}/${portname}_loc"
|
||
fi
|
||
. "${link}"/lang
|
||
if [ ! -e "${config_path}/${portname}_ver" ]; then
|
||
echo "10" > "${config_path}/${portname}_ver"
|
||
fi
|
||
if [ ! -f "${config_path}/dxvk_on" ]; then
|
||
start_settings=`zenity --title "${ss_title}" --text "${ss_text}" --list --radiolist \
|
||
--column="${inst_set}" --column "${ss_ver}" --column "${ss_dr}" --width=600 --height=250 \
|
||
FALSE "OpenGL" "${ss_ogl_2}" \
|
||
FALSE "DXVK+HUD" "${ss_ogl_3} + HUD" \
|
||
TRUE "DXVK" "${ss_ogl_3}" `
|
||
if [ $? -eq 1 ];then exit 1; fi
|
||
case $start_settings in
|
||
"OpenGL")
|
||
echo "0" > "${config_path}/dxvk_on" ;;
|
||
"DXVK")
|
||
echo "1" > "${config_path}/dxvk_on" ;;
|
||
"DXVK+HUD")
|
||
echo "2" > "${config_path}/dxvk_on" ;;
|
||
esac
|
||
fi
|
||
read "var_dxvk_on" < "${config_path}/dxvk_on"
|
||
export "var_dxvk_on"
|
||
########################################################################
|
||
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"
|
||
export WINEDLLPATH="${WINEDIR}/lib64/wine:${WINEDIR}/lib/wine"
|
||
export WINESERVER="${WINEDIR}/bin/wineserver"
|
||
export WINEBOOT="${WINEDIR}/bin/wineboot"
|
||
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 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
|
||
export host_lib_paths=$host_lib_paths$lib_path_prefix:
|
||
done < "${config_path}"/default_lib_paths
|
||
host_lib_paths="${WINELIB}/pinned_libs_32:${WINELIB}/pinned_libs_64:$host_lib_paths"
|
||
portwine_runtime_libs_paths="$host_lib_paths${WINELIB}/lib/i386-linux-gnu:${WINELIB}/usr/lib/i386-linux-gnu:${WINELIB}/lib/x86_64-linux-gnu:${WINELIB}/usr/lib/x86_64-linux-gnu:${WINELIB}/lib:${WINELIB}/usr/lib"
|
||
if [ ! -z "${LD_LIBRARY_PATH}" ]; then
|
||
export LD_LIBRARY_PATH="$portwine_runtime_libs_paths:${LD_LIBRARY_PATH-}"
|
||
else
|
||
export LD_LIBRARY_PATH="$portwine_runtime_libs_paths"
|
||
fi
|
||
echo "runtime libs is enabled"
|
||
else
|
||
echo "runtime libs is disabled"
|
||
fi
|
||
|
||
export optirun_on=
|
||
if [ -x "`which nvidia-settings 2>/dev/null`" ]; then
|
||
if [ -x "`which primusrun 2>/dev/null`" ]; then
|
||
export optirun_on="primusrun"
|
||
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
|
||
elif [ -x "`which optirun 2>/dev/null`" ]; then
|
||
export optirun_on="optirun -b primus"
|
||
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
|
||
fi
|
||
export __NV_PRIME_RENDER_OFFLOAD=1
|
||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||
export __GL_SYNC_TO_VBLANK=0
|
||
export __GL_SHADER_DISK_CACHE_PATH="${PATH_TO_GAME}"
|
||
export __GL_SHADER_DISK_CACHE=1
|
||
export __GL_SHADER_DISK_CACHE_SIZE=1000000000
|
||
export __GL_THREADED_OPTIMIZATIONS=1
|
||
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=1 > /dev/null
|
||
export DXVK_CONFIG_FILE="${PORT_WINE_PATH}/data/dxvk_nvidia.conf"
|
||
if [ ! -z "${WINEDLLOVERRIDES}" ]; then
|
||
export WINEDLLOVERRIDES="nvapi,nvapi64=;${WINEDLLOVERRIDES}"
|
||
else
|
||
export WINEDLLOVERRIDES="nvapi,nvapi64="
|
||
fi
|
||
echo "runtime libs is disabled"
|
||
else
|
||
export DRI_PRIME=1
|
||
export vblank_mode=0
|
||
export mesa_glthread=true
|
||
local AMD_ATI="$(lspci | grep AMD/ATI)"
|
||
if [ ! -z "${AMD_ATI}" ]; then
|
||
# 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"
|
||
else
|
||
echo "ACO is disabled"
|
||
fi
|
||
fi
|
||
fi
|
||
export DXVK_STATE_CACHE_PATH="${PATH_TO_GAME}"
|
||
export DXVK_STATE_CACHE=1
|
||
if [ "${var_dxvk_on}" -eq "0" ]; then
|
||
export DXVK_STATE_CACHE=0
|
||
elif [ "${var_dxvk_on}" -eq "1" ]; then
|
||
export DXVK_HUD=0
|
||
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/"
|
||
if [ ! -d "${def_pfx}" ]; then
|
||
"${PROTONRUN}" "run" | pwzen
|
||
fi
|
||
export PROTON_NO_FSYNC=0
|
||
if [ "$(ulimit -n)" -lt 50000 ]; then
|
||
export PROTON_NO_ESYNC=1
|
||
echo "ESYNC is disabled"
|
||
else
|
||
export PROTON_NO_ESYNC=0
|
||
echo "ESYNC is enabled"
|
||
fi
|
||
export int_xneur=0
|
||
if [ $(pgrep xneur)>'0' ]; then
|
||
killall xneur
|
||
export int_xneur=1
|
||
fi
|
||
if [ -x "`which "gamemoderun" 2>/dev/null`" ]; then
|
||
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
|
||
}
|
||
########################################################################
|
||
WAIT_WINESERVER ()
|
||
{
|
||
sleep 3
|
||
while [ $(pgrep wineserver)>'0' ]; do
|
||
sleep 2
|
||
done
|
||
}
|
||
########################################################################
|
||
KILL9_WINEDEVICE ()
|
||
{
|
||
if [ "${kill_winedevice}" -eq "1" ]; then
|
||
sleep 10
|
||
killall -r -s9 winedevice
|
||
fi
|
||
if [ "${kill_explorer}" -eq "1" ]; then
|
||
sleep 10
|
||
killall -r -s9 explorer
|
||
fi
|
||
}
|
||
########################################################################
|
||
STOP_PORTWINE ()
|
||
{
|
||
#WAIT_WINESERVER
|
||
ADD_IN_STOP_PORTWINE
|
||
if [ "$int_xneur" -eq "1" ]; then
|
||
xneur &
|
||
fi
|
||
#killall -r -s9 winedevice
|
||
rm -f "${PORT_WINE_PATH}"/0
|
||
rm -f "${link}"/0
|
||
}
|