Commit c0c48c32 authored by Mikhail Tergoev's avatar Mikhail Tergoev

Merge branch 'Boria138-cpu-limit'

parents d9c9747b c6622177
......@@ -236,6 +236,9 @@ if [[ "${update_loc}" == "RUS" ]] ; then
export loc_gui_mango_fps="Ограничить FPS (0 - выключено)"
export loc_gui_mango_fps_help="Включение ограничения количества кадров в секунду средстами MANGOHUD встроенного в PortProton."
export loc_gui_cpu_limit="Ограничить использование ядер процессора (0 - не ограничивать)"
export loc_gui_cpu_limit_help="Ограничения количества ядер процессора полезно для игр на движке Unity (Рекомендуется выставить значение равное ${half_cores})"
export loc_gui_check_new_wine="Проверяем новые версии WINE на GitHub"
export loc_gui_check_new_wine_error="Не удается установить соединение с GitHub\nдля проверки новых версии WINE."
export loc_gui_set_new_wine="Выберите версию WINE для загрузки:"
......@@ -484,6 +487,9 @@ A brief instruction:
export loc_gui_mango_fps="MANGOHUD FPS LIMIT (0-disabled)"
export loc_gui_mango_fps_help="Enabling FPS limits using MANGOHUD built into ${portname}"
export loc_gui_cpu_limit="Limit the use of processor cores (0 - do not limit)"
export loc_gui_cpu_limit_help="Limiting the number of CPU cores is useful for Unity games (It is recommended to set the value equal to ${half_cores})"
export loc_gui_check_new_wine="Check new version WINE from GitHub"
export loc_gui_check_new_wine_error="Error: check wine from github."
export loc_gui_set_new_wine="Select WINE for download:"
......
......@@ -663,6 +663,10 @@ unset PW_NAME_D_NAME PW_NAME_D_ICON PW_NAME_D_EXEC PW_EXEC_FROM_DESKTOP PW_ALL_D
export portname=PortProton
logical_cores=$(grep -c "^processor" /proc/cpuinfo)
half_cores=$((logical_cores / 2))
export half_cores
cd "$(dirname "`readlink -f "$0"`")" && export PORT_SCRIPTS_PATH="$(pwd)"
cd "${PORT_SCRIPTS_PATH}/../../" && export PORT_WINE_PATH="$(pwd)"
export PORT_WINE_TMP_PATH="${PORT_WINE_PATH}/data/tmp"
......
......@@ -155,7 +155,14 @@ pw_gui_for_edit_db () {
else
FPS_LIMIT_VAR=0
fi
if [[ -n $WINE_CPU_TOPOLOGY ]] ; then
CPU_LIMIT_VAR="`echo ${WINE_CPU_TOPOLOGY%%:*}`"
else
CPU_LIMIT_VAR=0
fi
echo "FPS_LIMIT_VAR=$FPS_LIMIT_VAR"
echo "CPU_LIMIT_VAR=$CPU_LIMIT_VAR"
unset ADD_CHK_BOX_EDIT_DB
edit_db_field_add () {
for int_to_boole in $@ ; do
......@@ -187,8 +194,8 @@ pw_gui_for_edit_db () {
--field=":LBL" "" \
--field="${loc_gui_arg_exe}!${loc_gui_arg_exe_help} :CBE" "\\${LAUNCH_PARAMETERS[@]}!-dx11 -skipintro 1" \
--field=":LBL" "" \
--field="${loc_gui_mango_fps}!${loc_gui_mango_fps_help} :SCL" ${FPS_LIMIT_VAR} 2>/dev/null 1> "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" 2>/dev/null &
--field="${loc_gui_cpu_limit}!${loc_gui_cpu_limit_help}" ${CPU_LIMIT_VAR} \
--field="${loc_gui_mango_fps}!${loc_gui_mango_fps_help} :SCL" ${FPS_LIMIT_VAR} 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="650" \
--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" \
......@@ -218,12 +225,20 @@ pw_gui_for_edit_db () {
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}'`
FPS_LIMIT="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $7}'`"
CPU_LIMIT="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $7}'`"
FPS_LIMIT="`cat "${PORT_WINE_TMP_PATH}/tmp_output_yad_fps_limit" | awk -F"%" '{print $8}'`"
if [ "${FPS_LIMIT}" != 0 ] ; then
export MANGOHUD_CONFIG=${MANGOHUD_CONFIG},fps_limit=${FPS_LIMIT}
export PW_MANGOHUD=1
fi
if [ "${CPU_LIMIT}" != 0 ] ; then
cores=${CPU_LIMIT}
topology="${cores}:$(seq -s, 0 $((cores - 1)))"
export WINE_CPU_TOPOLOGY="$topology"
else
unset WINE_CPU_TOPOLOGY
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
return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment