149 lines
5.2 KiB
Bash
Executable File
149 lines
5.2 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
|
||
}
|
||
########################################################################
|
||
wine_pids=$(ls -l /proc/*/exe 2>/dev/null | grep -E 'wine(64)?-preloader|wineserver' | perl -pe 's;^.*/proc/(\d+)/exe.*$;$1;g;')
|
||
if ! [ -z "${wine_pids}" ] ; then
|
||
kill -9 ${wine_pids}
|
||
fi
|
||
########################################################################
|
||
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"
|
||
#if [ ! -x "`which "gamemode" 2>/dev/null`" ]
|
||
#then
|
||
# LD_PRELOAD="$LD_PRELOAD:/usr/${LIB}/libgamemodeauto.so"
|
||
# var_gamemode="gamemoderun"
|
||
#else
|
||
# var_gamemode=""
|
||
#fi
|
||
########################################################################
|
||
WINEDIR="${PORT_WINE_PATH}"/data/dist
|
||
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 LD_LIBRARY_PATH="${WINEDIR}/lib64/wine:${WINEDIR}/lib/wine:${WINELIB}/pinned_libs_32:${WINELIB}/pinned_libs_64:/usr/lib/x86_64-linux-gnu/libfakeroot:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/local/lib:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib:/usr/lib/i386-linux-gnu/i686:/usr/lib/i386-linux-gnu/sse2:/usr/lib/i386-linux-gnu/i686/sse2:${WINELIB}/i386/lib/i386-linux-gnu:${WINELIB}/i386/lib:${WINELIB}/i386/usr/lib/i386-linux-gnu:${WINELIB}/i386/usr/lib:${WINELIB}/amd64/lib/x86_64-linux-gnu:${WINELIB}/amd64/lib:${WINELIB}/amd64/usr/lib/x86_64-linux-gnu:${WINELIB}/amd64/usr/lib"
|
||
########################################################################
|
||
export DXVK_STATE_CACHE_PATH="${PATH_TO_GAME}"
|
||
export DXVK_STATE_CACHE=1
|
||
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
|
||
export mesa_glthread=true
|
||
export DRI_PRIME=1
|
||
|
||
export urlg="http://portwine-linux.ru/donate"
|
||
########################################################################
|
||
|
||
START_PORTWINE ()
|
||
{
|
||
sh "${link}"/port_update
|
||
if [ "${var_dxvk_on}" -eq "1" ]
|
||
then
|
||
export DXVK_HUD=0
|
||
elif [ "${var_dxvk_on}" -eq "2" ]
|
||
then
|
||
export DXVK_HUD="fps,devinfo"
|
||
fi
|
||
export def_pfx="${PORT_WINE_PATH}data/dist/share/default_pfx/"
|
||
if [ ! -d "${def_pfx}" ]
|
||
then
|
||
"${PROTONRUN}" "run" | pwzen
|
||
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
|
||
sleep 3
|
||
killall -r -s9 winedevice
|
||
rm -f "${PORT_WINE_PATH}"/0
|
||
rm -f "${link}"/0
|
||
}
|