PortWINE/data_from_portwine/scripts/runlib
2020-06-10 00:24:06 +03:00

218 lines
7.9 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Author: PortWINE-Linux.ru
########################################################################
[ $(id -u) = 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
}
########################################################################
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
########################################################################
export port_on_run="${PORT_WINE_PATH}/data/port_on"
export WINEDIR="${PORT_WINE_PATH}"/data/dist
export WINELIB="${PORT_WINE_PATH}"/data/libs
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
########################################################################
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=500 --height=220 \
TRUE "DXVK" "${ss_ogl_3}" \
FALSE "OpenGL" "${ss_ogl_2}" `
if [ $? -eq 1 ];then exit 1; fi
case $start_settings in
"OpenGL")
echo "off" > "${config_path}/dxvk_on" ;;
"DXVK")
hud_settings=`zenity --list --title "HUD" --text "${hud_text}" --list --checklist \
--column="${inst_set}" --column="HUD info:" --column="${hud_info}" --width=800 --height=550 \
FALSE "fps" "${hud_fps}" \
FALSE "devinfo" "${hud_devinfo}" \
FALSE "frametimes" "${hud_frametimes}" \
FALSE "submissions" "${hud_submissions}" \
FALSE "drawcalls" "${hud_drawcalls}" \
FALSE "pipelines" "${hud_pipelines}" \
FALSE "memory" "${hud_memory}" \
FALSE "gpuload" "${hud_gpuload}" \
FALSE "version" "${hud_version}" \
FALSE "api" "${hud_api}" \
FALSE "compiler" "${hud_compiler}" \
FALSE "samplers" "${hud_samplers}" `
if [ ! -z $hud_settings ]; then
for hud_set in $hud_settings
do
echo "${hud_set}" >> "${config_path}/dxvk_on"
done
sed -i "s/|/,/g" "${config_path}/dxvk_on"
else
echo "0" > "${config_path}/dxvk_on"
fi ;;
esac
fi
read "var_dxvk_on" < "${config_path}/dxvk_on"
export "var_dxvk_on"
if [ "${var_dxvk_on}" != "off" ]; then
export DXVK_HUD="${var_dxvk_on}"
export DXVK_STATE_CACHE_PATH="${PATH_TO_GAME}"
export DXVK_STATE_CACHE=1
export PW_USE_WINED3D=0
export PW_DXGI_FOR_VKD3D=0
export PW_NO_D9VK=0
export PW_NO_D3D11=0
export PW_NO_D3D10=0
echo "Use DXVK mod."
echo "DXVK_HUD=${var_dxvk_on}"
else
export DXVK_STATE_CACHE=0
export PW_USE_WINED3D=1
export PW_DXGI_FOR_VKD3D=1
export PW_NO_D9VK=0
export PW_NO_D3D11=0
export PW_NO_D3D10=0
export PW_OLD_GL_STRING=0
echo "Use OpenGL mod."
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
else
export DRI_PRIME=1
export vblank_mode=0
export MESA_GLSL_CACHE_DIR="${PATH_TO_GAME}"
export mesa_glthread=true
export AMD_ATI="$(lspci | grep AMD/ATI)"
if [ ! -z "${AMD_ATI}" ]; then
if [ "${PW_ACO}" = "1" ]; then
export RADV_PERFTEST=aco
echo "ACO is enabled"
else
echo "ACO is disabled"
fi
fi
fi
export DXVK_CONFIG_FILE="${PORT_WINE_PATH}/data/dxvk.conf"
########################################################################
export def_pfx="${PORT_WINE_PATH}/data/dist/share/default_pfx/"
if [ ! -d "${def_pfx}" ]; then
"${port_on_run}" "run" | pwzen
fi
export PW_NO_FSYNC=0
if [ "$(ulimit -n)" -lt 50000 ]; then
export PW_NO_ESYNC=1
echo "ESYNC is disabled"
else
export PW_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
}
########################################################################
STOP_PORTWINE ()
{
#WAIT_WINESERVER
ADD_IN_STOP_PORTWINE
if [ "$int_xneur" = "1" ]; then
xneur &
fi
#killall -r -s9 winedevice
rm -f "${PORT_WINE_PATH}"/0
rm -f "${link}"/0
}