forked from CastroFidel/PortWINE
		
	
		
			
				
	
	
		
			593 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			593 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| # Author: Castro-Fidel (linux-gaming.ru)
 | |
| ########################################################################
 | |
| zenity_info () {
 | |
|     echo "INFO: $@"
 | |
|     zenity --info --no-wrap --text "$@" 2> /dev/null
 | |
| }
 | |
| export -f zenity_info
 | |
| 
 | |
| zenity_error () {
 | |
|     echo "ERROR: $@"
 | |
|     zenity --error --no-wrap --text "$@" 2> /dev/null
 | |
| }
 | |
| export -f zenity_error
 | |
| 
 | |
| zenity_error_download () {
 | |
|     `zenity --question --title "$loc_gui_error" --text "$loc_gui_error_download\n" --no-wrap --ok-label="Repeat" --cancel-label="Skip" `
 | |
|     if [[ "$?" != 0 ]] ; then
 | |
|         return 1
 | |
|     else
 | |
|         return 0
 | |
|     fi
 | |
| }
 | |
| 
 | |
| sszen() {
 | |
|     zenity --progress --title="$loc_gui_settings" --text="$loc_gui_sett_info" --pulsate --auto-close --width=500 --height=90 --no-cancel
 | |
| }
 | |
| 
 | |
| gui_question () {
 | |
|     `zenity --question --title "${inst_set}." --text "$1" --no-wrap ` &> /dev/null
 | |
|     [ $? -eq "0" ] && return 0 || return 1
 | |
| }
 | |
| 
 | |
| 
 | |
| pw_start_progress_bar_cover () {
 | |
|     PW_GIF_FILE="$1"
 | |
|     PW_GIF_SIZE_X=`file "${PW_GIF_FILE}" | awk '{print $7 + 20}'`
 | |
|     PW_GIF_SIZE_Y=`file "${PW_GIF_FILE}" | awk '{print $9 + 20}'`
 | |
|     "${pw_yad}" --picture --filename="${PW_GIF_FILE}" --close-on-unfocus --no-buttons --undecorated --center \
 | |
|     --skip-taskbar --width=$PW_GIF_SIZE_X --height=$PW_GIF_SIZE_Y > /dev/null 2>&1 &
 | |
|     export PW_YAD_PID_PROGRESS_BAR_COVER="$!"
 | |
|     return 0
 | |
| }
 | |
| 
 | |
| pw_update_pfx_cover_gui () {
 | |
|     PW_KEY_PROGRESS_BAR=$RANDOM
 | |
|     PW_GIF_FILE="${PW_GUI_ICON_PATH}/covers/pw_update_pfx_cover.gif"
 | |
|     PW_GIF_SIZE_X=`file "${PW_GIF_FILE}" | awk '{print $7 + 40}'`
 | |
|     PW_GIF_SIZE_Y=`file "${PW_GIF_FILE}" | awk '{print $9 + 80}'`
 | |
|     echo "UPDATE PREFIX..." > "${PORT_WINE_TMP_PATH}/update_pfx_log"
 | |
|     unset PW_TIMER
 | |
|     while read -r line || [[ ! -z `pgrep -a yad | grep "yad_v12_3 --notebook --key="$PW_KEY_PROGRESS_BAR"" | awk '{print $1}'` ]] ; do
 | |
|             sleep 0.005
 | |
|             if [[ ! -z "${line}" ]] && [[ -z "`echo "${line}" | grep -i "gstreamer"`" ]] \
 | |
|                                     && [[ -z "`echo "${line}" | grep -i "kerberos"`" ]] \
 | |
|                                     && [[ -z "`echo "${line}" | grep -i "ntlm"`" ]]
 | |
|             then
 | |
|                 echo "# ${line}"
 | |
|             fi
 | |
|             if [[ "${PW_TIMER}" != 1 ]] ; then
 | |
|                 sleep 3
 | |
|                 PW_TIMER=1
 | |
|             fi
 | |
|     done < "${PORT_WINE_TMP_PATH}/update_pfx_log" | "${pw_yad_v12_3}" --plug=$PW_KEY_PROGRESS_BAR --tabnum="2" --text-info --tail  2>/dev/null &
 | |
|     "${pw_yad_v12_3}" --plug=$PW_KEY_PROGRESS_BAR --tabnum="1" --picture --filename="${PW_GIF_FILE}" --image-on-top 2>/dev/null &
 | |
| 
 | |
|     "${pw_yad_v12_3}" --notebook --key="$PW_KEY_PROGRESS_BAR" --tab=LOGO --tab=TERMINAL --no-buttons --undecorated \
 | |
|     --center --auto-close --skip-taskbar --width=$PW_GIF_SIZE_X --height=$PW_GIF_SIZE_Y --tab-pos=bottom 2>/dev/null &
 | |
|     export PW_YAD_PID_PFX_COVER_UI="$!"
 | |
|     return 0
 | |
| }
 | |
| 
 | |
| pw_start_progress_bar_cs () {
 | |
|     "${pw_yad}" --progress --progress-text="$@" --pulsate --close-on-unfocus \
 | |
|     --no-buttons --undecorated --center --skip-taskbar --width=500 --wrap-width=500 > /dev/null 2>&1 &
 | |
|     export PW_YAD_PID_PROGRESS_BAR_CS="$!"
 | |
|     return 0
 | |
| }
 | |
| 
 | |
| pw_start_progress_bar_block () {
 | |
|     "${pw_yad}" --progress --progress-text="$@" --pulsate \
 | |
|     --no-buttons --undecorated --center --skip-taskbar --width=500 --wrap-width=500 > /dev/null 2>&1 &
 | |
|     export PW_YAD_PID_PROGRESS_BAR_BLOCK="$!"
 | |
|     return 0
 | |
| }
 | |
| 
 | |
| pw_stop_progress_bar () {
 | |
|     for PW_KILL_YAD_PID in "$PW_YAD_PID_PROGRESS_BAR_BLOCK" "$PW_YAD_PID_PROGRESS_BAR_CS" \
 | |
|                            "$PW_YAD_PID_PFX_COVER_UI" "$PW_YAD_PID_PROGRESS_BAR_COVER"
 | |
|     do
 | |
|         kill -s SIGUSR1 "$PW_KILL_YAD_PID" > /dev/null 2>&1
 | |
|     done
 | |
|     return 0
 | |
| }
 | |
| export -f pw_stop_progress_bar
 | |
| 
 | |
| pw_stop_progress_bar_cover () {
 | |
|     kill -s KILL "$PW_YAD_PID_PROGRESS_BAR_COVER" > /dev/null 2>&1
 | |
|     return 0
 | |
| }
 | |
| export -f pw_stop_progress_bar_cover
 | |
| 
 | |
| open_changelog () {
 | |
|     "${pw_yad}" --title="$loc_gui_changelog" --borders=3 --no-buttons --text-align=center \
 | |
|     --text-info --show-uri --wrap --width=1200 --height=700 --uri-color=red \
 | |
|     --filename="${PORT_WINE_PATH}/data/${PW_CHANGELOG_FILE}"
 | |
| }
 | |
| export -f open_changelog
 | |
| 
 | |
| pw_tray_icon () {
 | |
|     if [ ! -z "`pgrep -a yad_v12_3 | grep "\--notification" | awk '{print $1}'`" ] ; then
 | |
|         kill -s SIGUSR1 "`pgrep -a yad_v12_3 | grep "\--notification" | awk '{print $1}'`"
 | |
|     fi
 | |
| 
 | |
|     tray_icon_click () {
 | |
|         echo ""
 | |
|     }
 | |
|     export -f tray_icon_click
 | |
| 
 | |
|     pw_tray_winefile () {
 | |
|         pw_run winefile "C:\\users\\${USER}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\"
 | |
|     }
 | |
|     export -f pw_tray_winefile
 | |
| 
 | |
|     pw_tray_taskmgr () {
 | |
|         pw_run taskmgr
 | |
|     }
 | |
|     export -f pw_tray_taskmgr
 | |
| 
 | |
|     tray_icon_click_exit () {
 | |
|         pw_stop_progress_bar
 | |
|         stop_portwine
 | |
|     }
 | |
|     export -f tray_icon_click_exit
 | |
| 
 | |
|     "${pw_yad_v12_3}" --notification --no-middle \
 | |
|     --window-icon="$PW_GUI_ICON_PATH/port_proton.png" \
 | |
|     --image="$PW_GUI_ICON_PATH/port_proton.png" \
 | |
|     --command="bash -c tray_icon_click" \
 | |
|     --tooltip="PortProton" \
 | |
|     --menu="| \
 | |
|   ${loc_tray_winefile}!bash -c pw_tray_winefile!"$PW_GUI_ICON_PATH/port_winefile.png"|| \
 | |
|   ${loc_tray_tascmng}!bash -c pw_tray_taskmgr!"$PW_GUI_ICON_PATH/port_winefile.png"|| \
 | |
|   ${loc_tray_cangelog}!bash -c open_changelog!"$PW_GUI_ICON_PATH/port_changelog.png"|| \
 | |
|   ${loc_tray_force_exit}    !bash -c tray_icon_click_exit!"$PW_GUI_ICON_PATH/port_exit.png"||" 2>/dev/null &
 | |
| 
 | |
|     return 0
 | |
| }
 | |
| 
 | |
| pw_gui_for_edit_db () {
 | |
|     KEY_EDIT_DB_GUI=$RANDOM
 | |
|     if echo "${MANGOHUD_CONFIG}" | grep "fps_limit" ; then
 | |
|         FPS_LIMIT_VAR="$(echo ${MANGOHUD_CONFIG} | sed 's/.*fps_limit=//' | awk -F, '{print $1}')"
 | |
|     else
 | |
|         FPS_LIMIT_VAR="disabled"
 | |
|     fi
 | |
|     if [[ ! -z "${PW_WINE_CPU_TOPOLOGY}" ]] && [[ "${PW_WINE_CPU_TOPOLOGY}" != "disabled" ]] ; then
 | |
|         CPU_LIMIT_VAR="`echo ${PW_WINE_CPU_TOPOLOGY%%:*}`"
 | |
|     else
 | |
|         CPU_LIMIT_VAR="disabled"
 | |
|     fi
 | |
|     if [[ ! -z "${PW_AMD_VULKAN_USE}" ]] && [[ "${PW_AMD_VULKAN_USE}" != "disabled" ]] ; then
 | |
|         AMD_VULKAN_VAR="${PW_AMD_VULKAN_USE}"
 | |
|     else
 | |
|         AMD_VULKAN_VAR="disabled"
 | |
|     fi
 | |
| 
 | |
|     GET_REFRASH_RATE="30!45!60!75!120!144!165!240"
 | |
| 
 | |
|     logical_cores=$(grep -c "^processor" /proc/cpuinfo)
 | |
|     if [[ "${logical_cores}" -le "4" ]] ; then
 | |
|         GET_LOGICAL_CORE="1!$(seq -s! 1 $((${logical_cores} - 1)))"
 | |
|     else
 | |
|         GET_LOGICAL_CORE="1!2!$(seq -s! 4 4 $((${logical_cores} - 1)))"
 | |
|     fi
 | |
| 
 | |
|     unset ADD_CHK_BOX_EDIT_DB
 | |
|     edit_db_field_add () {
 | |
|         for int_to_boole in $@ ; do
 | |
|             if [ "${!int_to_boole}" == "1" ]
 | |
|             then export ${int_to_boole}="TRUE"
 | |
|             else export ${int_to_boole}="FALSE"
 | |
|             fi
 | |
|             TMP_HELP_FOR_GUI="${int_to_boole}_INFO"
 | |
|             int_to_boole_non_pw="`echo ${int_to_boole} | sed 's/^PW_//' `"
 | |
|             ADD_CHK_BOX_EDIT_DB+="--field=  ${int_to_boole_non_pw}    !${!TMP_HELP_FOR_GUI}:CHK%${!int_to_boole}%"
 | |
|         done
 | |
|     }
 | |
|     edit_db_field_add $@
 | |
|     old_IFS=$IFS
 | |
|     IFS="%"
 | |
|     "${pw_yad_v12_3}" --plug=$KEY_EDIT_DB_GUI --tabnum="1" --form --separator=" " --columns=4 ${ADD_CHK_BOX_EDIT_DB} \
 | |
|     1> "${PORT_WINE_TMP_PATH}/tmp_output_yad_edit_db" 2>/dev/null &
 | |
|     IFS=$old_IFS
 | |
| 
 | |
|     case ${PW_WINDOWS_VER} in
 | |
|          "7") ADD_WINVER_EDIT_DB="7!10!XP" ;;
 | |
|         "XP") ADD_WINVER_EDIT_DB="XP!7!10" ;;
 | |
|            *) ADD_WINVER_EDIT_DB="10!7!XP" ;;
 | |
|     esac
 | |
|     "${pw_yad_v12_3}" --plug=$KEY_EDIT_DB_GUI --tabnum="2" --form --separator="%" --columns=1 \
 | |
|     --field="${loc_gui_ver_windows}!${loc_gui_ver_windows_help} :CB" "${ADD_WINVER_EDIT_DB}" \
 | |
|     --field="${loc_gui_aut_winetricks}!${loc_gui_aut_winetricks_help} :CBE" "${PW_DLL_INSTALL}!vcrun2019 corefonts lucida" \
 | |
|     --field="${loc_gui_winedllover}!${loc_gui_winedllover_help} :CBE" "${WINEDLLOVERRIDES}!libglesv2=!d3dx9_36,d3dx9_42=n,b;mfc120=b,n" \
 | |
|     --field=":LBL" "" \
 | |
|     --field="${loc_gui_arg_exe}!${loc_gui_arg_exe_help} :CBE" "\\${LAUNCH_PARAMETERS[@]}!-dx11 -skipintro 1" \
 | |
|     --field=":LBL" "" \
 | |
|     --field="${loc_gui_cpu_limit}!${loc_gui_cpu_limit_help} :CB" "${CPU_LIMIT_VAR}!disabled!${GET_LOGICAL_CORE}" \
 | |
|     --field="${loc_gui_amd_vulkan_select}!${loc_gui_amd_vulkan_select_help} :CB" "${AMD_VULKAN_VAR}!disabled!amdvlk!amdgpupro!radv!radv_gpl!radv_aco" \
 | |
|     --field="${loc_gui_mango_fps}!${loc_gui_mango_fps_help} :CB" "${FPS_LIMIT_VAR}!disabled!${GET_REFRASH_RATE}"  2>/dev/null 1> "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" 2>/dev/null &
 | |
|     "${pw_yad_v12_3}" --paned --key="$KEY_EDIT_DB_GUI" --title "EDIT_DB" --text-align=center --height="700" \
 | |
|     --text "${loc_gui_edit_db} <b>${PORTWINE_DB}</b>\n ${loc_gui_edit_db_help}" --separator=" " --borders=3 \
 | |
|     --window-icon="$PW_GUI_ICON_PATH/port_proton.png" \
 | |
|     --button="${loc_gui_cancel}"!!"${loc_gui_cancel_help}":1 \
 | |
|     --button="${loc_gui_open_db}"!!"${loc_gui_open_db_help}":150 \
 | |
|     --button="${loc_gui_save_changes}"!!"${loc_gui_save_changes_help}":0 2>/dev/null
 | |
|     YAD_STATUS="$?"
 | |
|     case "$YAD_STATUS" in
 | |
|           1) /usr/bin/env bash -c ${pw_full_command_line[*]} & exit 0 ;;
 | |
|         150) xdg-open "${PORTWINE_DB_FILE}" & exit 0 ;;
 | |
|         252) exit 0 ;;
 | |
|     esac
 | |
|     output_yad_edit_db=(`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_edit_db"`)
 | |
|     bool_from_yad=0
 | |
|     edit_db_field_read () {
 | |
|         for boole_to_int in $@ ; do
 | |
|             export ${boole_to_int}=${output_yad_edit_db[$bool_from_yad]}
 | |
|             if [ "${!boole_to_int}" == "TRUE" ]
 | |
|             then export ${boole_to_int}="1"
 | |
|             else export ${boole_to_int}="0"
 | |
|             fi
 | |
|             export bool_from_yad=$(( ${bool_from_yad} + 1 ))
 | |
|         done
 | |
|     }
 | |
|     edit_db_field_read $@
 | |
|     PW_WINDOWS_VER="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $1}'`"
 | |
|     PW_DLL_INSTALL=`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $2}'`
 | |
|     WINEDLLOVERRIDES=`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $3}'`
 | |
|     LAUNCH_PARAMETERS=`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $5}'`
 | |
|     CPU_LIMIT="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $7}'`"
 | |
|     PW_AMD_VULKAN_USE="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $8}'`"
 | |
|     FPS_LIMIT="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $9}'`"
 | |
| 
 | |
|     if [[ "${FPS_LIMIT}" != "disabled" ]] && [[ "${FPS_LIMIT_VAR}" != "disabled" ]] ; then
 | |
|         export MANGOHUD_CONFIG="$(echo ${MANGOHUD_CONFIG} | sed "s/fps_limit=${FPS_LIMIT_VAR}/fps_limit=${FPS_LIMIT}/")"
 | |
|         export PW_MANGOHUD=1
 | |
|     elif [[ "${FPS_LIMIT}" != "disabled" ]] && [[ "${FPS_LIMIT_VAR}" == "disabled" ]] ; then
 | |
|         export MANGOHUD_CONFIG=${MANGOHUD_CONFIG},fps_limit=${FPS_LIMIT}
 | |
|         export PW_MANGOHUD=1
 | |
|     elif [[ "${FPS_LIMIT}" == "disabled" ]] && [[ "${FPS_LIMIT_VAR}" != "disabled" ]] ; then
 | |
|         export MANGOHUD_CONFIG="$(echo ${MANGOHUD_CONFIG} | sed "s/,fps_limit=${FPS_LIMIT_VAR}//")"
 | |
|     fi
 | |
|     if [[ "${CPU_LIMIT}" != "disabled" ]] ; then
 | |
|         export PW_WINE_CPU_TOPOLOGY="${CPU_LIMIT}:$(seq -s, 0 $((${CPU_LIMIT} - 1)))"
 | |
|     else
 | |
|             export PW_WINE_CPU_TOPOLOGY="disabled"
 | |
|     fi
 | |
|     if [[ "${PW_AMD_VULKAN_USE}" == "amdvlk" ]] ; then
 | |
|         export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
 | |
|         if grep -i -q -E '(rosa|redos|nobara|linuxmint|ubuntu|centos|rhel|fedora)' "/etc/os-release" ; then
 | |
|             export VK_ICD_FILENAMES="/opt/amdgpu/etc/vulkan/icd.d/amd_icd32.json:/opt/amdgpu/etc/vulkan/icd.d/amd_icd64.json"
 | |
|         elif grep -i -q "altlinux" '/etc/os-release' ; then
 | |
|             export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/amd_icd.json"
 | |
|         else
 | |
|             export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/amd_icd32.json:/usr/share/vulkan/icd.d/amd_icd64.json"
 | |
|         fi
 | |
|     elif [[ "${PW_AMD_VULKAN_USE}" == "amdgpupro" ]] ; then
 | |
|         export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
 | |
|         if grep -i -q -E '(rosa|redos|nobara|linuxmint|ubuntu|centos|rhel|fedora)' "/etc/os-release" ; then
 | |
|             export VK_ICD_FILENAMES="/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json"
 | |
|             var_ld_library_path_update "/opt/amdgpu/libdrm/lib64:/opt/amdgpu/libdrm/lib32"
 | |
|         else
 | |
|             export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/amd_pro_icd32.json:/usr/share/vulkan/icd.d/amd_pro_icd64.json"
 | |
|         fi
 | |
|     elif [[ "${PW_AMD_VULKAN_USE}" == "radv" ]] ; then
 | |
|         export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
 | |
|         export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json"
 | |
|     elif [[ "${PW_AMD_VULKAN_USE}" == "radv_aco" ]] ; then
 | |
|         export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
 | |
|         var_radv_perftest_config_update aco
 | |
|         export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json"
 | |
|     elif [[ "${PW_AMD_VULKAN_USE}" == "radv_gpl" ]] ; then
 | |
|         export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
 | |
|         var_radv_perftest_config_update gpl
 | |
|         export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/radeon_icd.i686.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json"
 | |
|     fi
 | |
|     echo "pw_gui_for_edit_db PORTWINE_DB_FILE=$PORTWINE_DB_FILE"
 | |
|     edit_db_from_gui $@ MANGOHUD_CONFIG LAUNCH_PARAMETERS PW_WINDOWS_VER PW_DLL_INSTALL WINEDLLOVERRIDES PW_WINE_CPU_TOPOLOGY PW_AMD_VULKAN_USE
 | |
|     return 0
 | |
| }
 | |
| 
 | |
| 
 | |
| gui_proton_downloader () {
 | |
|     if [[ "$1" == "silent" ]] && [[ -d "${PORT_WINE_PATH}/data/dist/${PW_WINE_USE}" ]] ; then
 | |
|         return 0
 | |
|     fi
 | |
|     pw_start_progress_bar_block "$loc_gui_check_new_wine"
 | |
|     #PROTON_GE
 | |
|     export PROTON_GE_GIT=($(curl -s "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases" | grep "browser_download_url.*\.tar\.gz" | cut -d \" -f 4))
 | |
|     try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
 | |
|     if [[ ! -z "${PROTON_GE_GIT}" ]] ; then
 | |
|         for PGEGIT in ${PROTON_GE_GIT[@]} ; do
 | |
|             echo ${PGEGIT} | awk -F/ '{print $NF}' | sed 's/.tar.gz//' >> "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
 | |
|         done
 | |
|         sed -i '/Proton-6.5-GE-2/,$d' "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
 | |
|         sed -i '/github-action/d' "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
 | |
|     fi
 | |
| 
 | |
|     #WINE_KRON4EK
 | |
|     export WINE_KRON4EK=($(curl -s "https://api.github.com/repos/Kron4ek/Wine-Builds/releases" | grep "browser_download_url.*\.tar\.xz" | cut -d \" -f 4))
 | |
|     try_remove_file "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
 | |
|     if [[ ! -z "${WINE_KRON4EK}" ]] ; then
 | |
|         for PGEGIT in ${WINE_KRON4EK[@]} ; do
 | |
|             echo ${PGEGIT} | awk -F/ '{print $NF}' | sed 's/.tar.xz//' >> "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
 | |
|         done
 | |
|         sed -i '/6.3/,$d' "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
 | |
|         sed -i '/-x86/d' "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
 | |
|     fi
 | |
| 
 | |
|     #WINE_GE_CUSTOM
 | |
|     export WINE_GE_CUSTOM=($(curl -s "https://api.github.com/repos/GloriousEggroll/wine-ge-custom/releases" | grep "browser_download_url.*\.tar\.xz" | cut -d \" -f 4))
 | |
|     try_remove_file "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
 | |
|     if [[ ! -z "${WINE_GE_CUSTOM}" ]] ; then
 | |
|         for PGEGIT in ${WINE_GE_CUSTOM[@]} ; do
 | |
|             echo ${PGEGIT} | awk -F/ '{print $NF}' | sed 's/.tar.xz//' >> "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
 | |
|         done
 | |
|         sed -i '/6.23/,$d' "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
 | |
|     fi
 | |
| 
 | |
|     #PROTON_LG
 | |
|     export PROTON_PW_GIT=($(curl -s "https://api.github.com/repos/Castro-Fidel/wine_builds/releases" | grep "browser_download_url.*\.tar\.xz" | cut -d \" -f 4))
 | |
|     try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
 | |
|     if [[ ! -z "${PROTON_PW_GIT}" ]] ; then
 | |
|         for PPWGIT in ${PROTON_PW_GIT[@]} ; do
 | |
|             echo ${PPWGIT} | awk -F/ '{print $NF}' | sed 's/.tar.xz//' >> "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
 | |
|         done
 | |
|         sed -i /${PW_WINE_LG_VER}/d "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
 | |
|         sed -i '/plugins/d' "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
 | |
|     fi
 | |
|     pw_stop_progress_bar
 | |
|     if [[ -z "${PROTON_GE_GIT}" ]] || [[ -z "${PROTON_PW_GIT}" ]] ; then
 | |
|         zenity_error "$loc_gui_check_new_wine_error"
 | |
|         /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|         exit 0
 | |
|     fi
 | |
|     for INSTALLING_VERSION_IN_DIST in `ls "${PORT_WINE_PATH}/data/dist/"` ; do
 | |
|         sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
 | |
|         sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
 | |
|         sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
 | |
|         sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
 | |
|     done
 | |
| 	#Installed wine
 | |
| 	ls -l ${PORT_WINE_PATH}/data/dist | awk '{print $9}' | sed '/^$/d' > ${PORT_WINE_TMP_PATH}/tmp_installed_wine
 | |
|     if [[ "$1" != "silent" ]] ; then
 | |
|         #GUI
 | |
|         export KEY_WINE=$RANDOM
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_pw_set"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_kron4ek_set"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_set"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_ge_custom_set"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_installed_wine_set"
 | |
| 
 | |
|         `"${pw_yad}" --plug=$KEY_WINE --tabnum=1 --list --separator="" --listen \
 | |
|         --column "$loc_gui_set_new_wine" < "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git" 1> "${PORT_WINE_TMP_PATH}/tmp_proton_pw_set" 2>/dev/null` &
 | |
|         `"${pw_yad}" --plug=$KEY_WINE --tabnum=2 --list --separator="" --listen \
 | |
|         --column "$loc_gui_set_new_wine" < "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git" 1> "${PORT_WINE_TMP_PATH}/tmp_kron4ek_set" 2>/dev/null` &
 | |
|         `"${pw_yad}" --plug=$KEY_WINE --tabnum=3 --list --separator="" --listen \
 | |
|         --column "$loc_gui_set_new_wine" < "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git" 1> "${PORT_WINE_TMP_PATH}/tmp_proton_set" 2>/dev/null` &
 | |
|         `"${pw_yad}" --plug=$KEY_WINE --tabnum=4 --list --separator="" --listen \
 | |
|         --column "$loc_gui_set_new_wine" < "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git" 1> "${PORT_WINE_TMP_PATH}/tmp_ge_custom_set" 2>/dev/null` &
 | |
|         `"${pw_yad}" --plug=$KEY_WINE --tabnum=5 --list --separator="" --listen \
 | |
|         --column "$loc_gui_del_wine" < "${PORT_WINE_TMP_PATH}/tmp_installed_wine" 1> "${PORT_WINE_TMP_PATH}/tmp_installed_wine_set" 2>/dev/null` &
 | |
|         `"${pw_yad}" --key=$KEY_WINE --notebook --width=500 --height=600 --text-align=center \
 | |
|         --window-icon="$PW_GUI_ICON_PATH/port_proton.png" --title "WINE MANAGER" --separator="" \
 | |
|         --tab-pos=top --tab="PROTON-LG" --tab="WINE-KRON4EK"  --tab="PROTON-GE" --tab="WINE-GE-CUSTOM" --tab="$loc_gui_installed_wine" 2>/dev/null`
 | |
|         YAD_WINE_STATUS="$?"
 | |
|         if [[ "$YAD_WINE_STATUS" == "1" || "$YAD_WINE_STATUS" == "252" ]] ; then
 | |
|             /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|             exit 0
 | |
|         fi
 | |
| 
 | |
|         if [ ! -z `cat "${PORT_WINE_TMP_PATH}/tmp_proton_set" | awk '{print $1}'` ] ; then
 | |
|             export VERSION_WINE_GIT="`cat "${PORT_WINE_TMP_PATH}/tmp_proton_set"`"
 | |
|         elif [ ! -z `cat "${PORT_WINE_TMP_PATH}/tmp_proton_pw_set" | awk '{print $1}'` ] ; then
 | |
|             export VERSION_WINE_GIT="`cat "${PORT_WINE_TMP_PATH}/tmp_proton_pw_set"`"
 | |
|         elif [ ! -z `cat "${PORT_WINE_TMP_PATH}/tmp_kron4ek_set" | awk '{print $1}'` ] ; then
 | |
|             export VERSION_WINE_GIT="`cat "${PORT_WINE_TMP_PATH}/tmp_kron4ek_set"`"
 | |
|         elif [ ! -z `cat "${PORT_WINE_TMP_PATH}/tmp_ge_custom_set" | awk '{print $1}'` ] ; then
 | |
|             export VERSION_WINE_GIT="`cat "${PORT_WINE_TMP_PATH}/tmp_ge_custom_set"`"
 | |
|         elif [ ! -z `cat "${PORT_WINE_TMP_PATH}/tmp_installed_wine_set" | awk '{print $1}'` ] ; then
 | |
|             export VERSION_INSTALLED_WINE="`cat "${PORT_WINE_TMP_PATH}/tmp_installed_wine_set"`"
 | |
|         else
 | |
|             print_info "Nothing to do."
 | |
|             /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|             exit 0
 | |
|         fi
 | |
| 
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
 | |
|         try_remove_file "${PORT_WINE_TMP_PATH}/tmp_installed_wine"
 | |
| 
 | |
|     elif [[ "$1" == "silent" ]] && [[ ! -z "$2" ]] ; then
 | |
|         VERSION_WINE_GIT="$2"
 | |
|     fi
 | |
| 
 | |
|     for GIVE_WINE_URL in ${PROTON_GE_GIT[@]} ${PROTON_PW_GIT[@]} ${WINE_KRON4EK[@]} ${WINE_GE_CUSTOM[@]} ; do
 | |
|         if [ ! -z `echo ${GIVE_WINE_URL} | grep -i "${VERSION_WINE_GIT}"` ] ; then
 | |
|             export URL_VERSION_PROTON_GIT="${GIVE_WINE_URL}"
 | |
|             break
 | |
|         fi
 | |
|     done
 | |
| 
 | |
| 	if [[ ! -z "${VERSION_INSTALLED_WINE}" ]]; then
 | |
| 		try_remove_dir "${PORT_WINE_PATH}/data/dist/${VERSION_INSTALLED_WINE}"
 | |
| 		unset VERSION_INSTALLED_WINE
 | |
|         /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|         exit 0
 | |
| 	fi
 | |
| 
 | |
|     print_info "Download and install ${VERSION_WINE_GIT}..."
 | |
|     PW_WINE_ARCHIVE="$(echo ${URL_VERSION_PROTON_GIT} | awk -F'/' '{print $NF}' | awk -F'.tar' '{print $1}')"
 | |
|     if try_download_to_path "${URL_VERSION_PROTON_GIT}" "${PORT_WINE_PATH}/data/tmp/" ; then
 | |
|         for archive_type in "gz" "xz" ; do
 | |
|             if [ -f "${PORT_WINE_PATH}/data/tmp/${PW_WINE_ARCHIVE}.tar.${archive_type}" ] ; then
 | |
|                 if unpack_tar_${archive_type} "${PORT_WINE_PATH}/data/tmp/${PW_WINE_ARCHIVE}.tar.${archive_type}" "${PORT_WINE_PATH}/data/dist/" ; then
 | |
|                     try_remove_file "${PORT_WINE_PATH}/data/tmp/${PW_WINE_ARCHIVE}.tar.${archive_type}"
 | |
|                     if [ ! -z "${portwine_exe}" ]; then
 | |
|                         PW_WINE_USE=${VERSION_WINE_GIT}
 | |
|                         edit_db_from_gui PW_WINE_USE
 | |
|                     fi
 | |
|                 else
 | |
|                     try_remove_file "${PORT_WINE_PATH}/data/tmp/${PW_WINE_ARCHIVE}.tar.${archive_type}"
 | |
|                     try_remove_dir "${PORT_WINE_PATH}/data/dist/${PW_WINE_ARCHIVE}"
 | |
|                     zenity_error_download && gui_proton_downloader || exit 1
 | |
|                 fi
 | |
|             fi
 | |
|         done
 | |
|     else
 | |
|         zenity_error_download && gui_proton_downloader || exit 1
 | |
|     fi
 | |
| 
 | |
|     if [[ "$1" != "silent" ]] ; then
 | |
|         /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|         exit 0
 | |
|     else
 | |
|         init_wine_ver
 | |
|     fi
 | |
| }
 | |
| export -f gui_proton_downloader
 | |
| 
 | |
| gui_vkBasalt () {
 | |
|     KEY_FX_GUI=$RANDOM
 | |
|     FILE_VKBASALT_CONF="${PORT_WINE_PATH}/data/vkBasalt.conf"
 | |
|     LIST_FX=(`grep -E '.fx$|.fxh$' "${FILE_VKBASALT_CONF}" | awk '{print $1}'`)
 | |
|     GET_FX_IN_FILE=(`echo ${PW_VKBASALT_EFFECTS} | sed s/"cas:"// | sed s/":"/" "/g`)
 | |
|     unset ADD_GUI_FX GUI_FX_RESULT
 | |
|     for add_list_fx in ${LIST_FX[@]} ; do
 | |
|         PW_VKBASALT_GUI_HELP="PW_${add_list_fx}_INFO"
 | |
|         if [[ ! -z `echo " ${GET_FX_IN_FILE[@]} " | grep " ${add_list_fx} "` ]] ; then
 | |
|             ADD_GUI_FX+="--field=$add_list_fx!${!PW_VKBASALT_GUI_HELP}:CHK%TRUE%"
 | |
|         else
 | |
|             ADD_GUI_FX+="--field=$add_list_fx!${!PW_VKBASALT_GUI_HELP}:CHK%FALSE%"
 | |
|         fi
 | |
|     done
 | |
|     if [[ ! -z "${PW_VKBASALT_FFX_CAS}" ]] ; then
 | |
|         VKBASALT_FFX_CAS_GUI=`bc -s <<< "${PW_VKBASALT_FFX_CAS}*100" | sed 's/\..*//'`
 | |
|     else
 | |
|         VKBASALT_FFX_CAS_GUI=75
 | |
|     fi
 | |
|     export old_IFS=$IFS
 | |
|     export IFS="%"
 | |
|     "${pw_yad_v12_3}" --plug=$KEY_FX_GUI --tabnum="1" --form --columns=5 --separator=" " \
 | |
|     --text-align=center --text="$loc_gui_vkbasalt_top" \
 | |
|     ${ADD_GUI_FX} 1> "${PORT_WINE_TMP_PATH}/tmp_yad_basalt_set" 2>/dev/null &
 | |
|     export IFS="${old_IFS}"
 | |
| 
 | |
|     "${pw_yad_v12_3}" --plug=$KEY_FX_GUI --tabnum="2" --separator=" " --form \
 | |
|     --field="AMD FidelityFX - Contrast Adaptive Sharpening"!"$loc_gui_ffx_cas":SCL "${VKBASALT_FFX_CAS_GUI}" \
 | |
|     1> "${PORT_WINE_TMP_PATH}/tmp_yad_cas_set" 2>/dev/null &
 | |
| 
 | |
|     "${pw_yad_v12_3}" --paned --key="$KEY_FX_GUI" --height="650" --title="vkBasalt" --center --borders=3 \
 | |
|     --separator=" " --window-icon="$PW_GUI_ICON_PATH/port_proton.png" \
 | |
|     --button="$loc_gui_cancel"!!"$loc_gui_cancel_help":1 \
 | |
|     --button="$loc_gui_disabled_vkbas"!!"$loc_gui_disabled_vkbas_help":180 \
 | |
|     --button="$loc_gui_save_changes"!!"$loc_gui_save_changes_help":182 2>/dev/null
 | |
|     YAD_VKBASALT_STATUS="$?"
 | |
|     case "${YAD_VKBASALT_STATUS}" in
 | |
|         1|252)
 | |
|             /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|             exit 0 ;;
 | |
|         180)
 | |
|             export ENABLE_VKBASALT=0 ;;
 | |
|         182)
 | |
|             export ENABLE_VKBASALT=1 ;;
 | |
|     esac
 | |
|     YAD_BASALT_SET=`cat "${PORT_WINE_TMP_PATH}/tmp_yad_basalt_set"`
 | |
|     YAD_CAS_SET=`cat "${PORT_WINE_TMP_PATH}/tmp_yad_cas_set" | sed s/" "//g`
 | |
| 
 | |
|     INT_COUNT_FX=0
 | |
|     for read_list_fx in ${YAD_BASALT_SET} ; do
 | |
|         if [[ "$read_list_fx" == "TRUE" ]] ; then
 | |
|             export GUI_FX_RESULT+="${LIST_FX[$INT_COUNT_FX]}:"
 | |
|         fi
 | |
|         export INT_COUNT_FX=$(( ${INT_COUNT_FX} + 1 ))
 | |
|     done
 | |
|     GUI_FX_RESULT="${GUI_FX_RESULT}cas"
 | |
|     export PW_VKBASALT_EFFECTS="${GUI_FX_RESULT}"
 | |
| 
 | |
|     if [[ "$YAD_CAS_SET" == "0" ]] ; then
 | |
|         export PW_VKBASALT_FFX_CAS="0"
 | |
|     elif [[ "$YAD_CAS_SET" == "100" ]] ; then
 | |
|         export PW_VKBASALT_FFX_CAS="1"
 | |
|     else
 | |
|         export PW_VKBASALT_FFX_CAS="0`bc -s <<< "scale=2; $YAD_CAS_SET/100"`"
 | |
|     fi
 | |
|     edit_db_from_gui PW_VKBASALT_EFFECTS PW_VKBASALT_FFX_CAS ENABLE_VKBASALT
 | |
|     /usr/bin/env bash -c ${pw_full_command_line[*]} &
 | |
|     exit 0
 | |
| }
 | |
| 
 | |
| portwine_create_shortcut () {
 | |
|     pw_create_gui_png
 | |
|     name_desktop="${PORTPROTON_NAME}"
 | |
|     OUTPUT=$("${pw_yad}" --title="${inst_set}." --form --borders=3 \
 | |
|     --window-icon "$PW_GUI_ICON_PATH/port_proton.png" \
 | |
|     --image "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" \
 | |
|     --field="${sc_info}":LBL "" \
 | |
|     --field="${sc_name}:" "${name_desktop}" \
 | |
|     --field="${sc_menu_desktop}":CHK "TRUE" \
 | |
|     --button="$loc_gui_create_shortcut":0)
 | |
|     if [ $? -eq "0" ]; then
 | |
|         name_desktop=$(echo "$OUTPUT" | awk -F'|' '{ print $2 }')
 | |
|         create_menu_desktop_shortcut=$(echo "$OUTPUT" | awk -F'|' '{ print $3 }')
 | |
| 
 | |
|         try_remove_file "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
| 
 | |
|         mv -f "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" "${PORT_WINE_PATH}/data/img/${name_desktop}.png"
 | |
| 
 | |
|         echo "[Desktop Entry]" > "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         echo "Name=${name_desktop}" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         if [ -z "${PW_CHECK_AUTOINSTAL}" ]
 | |
|         then echo "Exec=env "\"${PORT_SCRIPTS_PATH}/start.sh\" \"${portwine_exe}\" "" \
 | |
|         >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         else echo "Exec=env "\"${PORT_SCRIPTS_PATH}/start.sh\" \"${portwine_exe}\" "" \
 | |
|         >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         fi
 | |
|         echo "Type=Application" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         echo "Categories=Game" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         echo "StartupNotify=true" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         echo "Path="${PORT_SCRIPTS_PATH}/"" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         echo "Icon="${PORT_WINE_PATH}/data/img/${name_desktop}.png"" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
|         chmod u+x "${PORT_WINE_PATH}/${name_desktop}.desktop"
 | |
| 
 | |
|         if [[ "${create_menu_desktop_shortcut}" == "TRUE" ]]; then
 | |
|             try_remove_file "${HOME}/.local/share/applications/${name_desktop}.desktop"
 | |
|             cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/.local/share/applications/"
 | |
|             if [[ -d "${HOME}/Desktop" ]] ; then
 | |
|                 cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Desktop/"
 | |
|             elif [[ -d "${HOME}/Рабочий стол" ]] ; then
 | |
|                 cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Рабочий стол/"
 | |
|             fi
 | |
|         fi
 | |
| 
 | |
| 
 | |
|         [[ "$1" != silent ]] && xdg-open "${PORT_WINE_PATH}" 2>1 >/dev/null &
 | |
|     fi
 | |
| }
 | |
| 
 | |
| portwine_delete_shortcut () {
 | |
|     rm -f "$(grep -il "${portwine_exe}" "${HOME}/.local/share/applications"/*.desktop)" $>/dev/null
 | |
|     rm -f "$(grep -il "${portwine_exe}" "${PORT_WINE_PATH}"/*.desktop)" $>/dev/null
 | |
|     if [[ -d "${HOME}/Desktop" ]] ; then
 | |
|         rm -f "$(grep -il "${portwine_exe}" "${HOME}/Desktop"/*.desktop)" $>/dev/null
 | |
|     elif [[ -d "${HOME}/Рабочий стол" ]] ; then
 | |
|         rm -f "$(grep -il "${portwine_exe}" "${HOME}/Рабочий стол"/*.desktop)" $>/dev/null
 | |
|     fi
 | |
| }
 | |
| 
 | |
| portwine_missing_shortcut () {
 | |
|     "${pw_yad}" --title="${loc_gui_error}." --form --borders=3 \
 | |
|     --window-icon "$PW_GUI_ICON_PATH/port_proton.png" \
 | |
|     --image "$PW_GUI_ICON_PATH/error_file.png" \
 | |
|     --text "$loc_gui_missing_shortcut" \
 | |
|     --button="$loc_gui_delete_shortcut":0 \
 | |
|     --button="$loc_cancel":1
 | |
|     if [ $? -eq "0" ] ; then
 | |
|         portwine_delete_shortcut
 | |
|     fi
 | |
|     exit 0
 | |
| }
 |