Commit c0c9de36 authored by Mikhail Tergoev's avatar Mikhail Tergoev

Merge branch 'Boria138-update-fps-limit'

parents cd895d5e c3affc95
......@@ -3313,22 +3313,22 @@ gui_MangoHud () {
PW_MH_frametime_INFO=$(eval_gettext 'Display frametime next to FPS text')
PW_MH_wine_INFO=$(eval_gettext 'Show current Wine or Proton version in use')
unset ADD_GUI_MH GUI_MH_RESULT
unset ADD_GUI_MH GUI_MH_RESULT ADD_GUI_MH_FPS GUI_MH_FPS_RESULT
GET_REFRESH_RATE="30!45!60!75!120!144!165!240"
GET_REFRESH_RATE=(30 40 45 48 60 75 90 120 144 165 175 240)
if [[ -z "$FPS_LIMIT" ]]; then
FPS_LIMIT_VAR="disabled"
else
FPS_LIMIT_VAR="${FPS_LIMIT}"
fi
if [ -n "$MANGOHUD_CONFIG" ]; then
if [ ! -z "$MANGOHUD_CONFIG" ]; then
PW_MANGOHUD_CONFIG=($(echo "$MANGOHUD_CONFIG" | tr ',' '\n' | grep -v '='))
else
PW_MANGOHUD_CONFIG=($(echo "$DEFAULT_MANGOHUD_CONFIG" | tr ',' '\n' | grep -v '='))
fi
if [ ! -z "$PW_FPS_LIMIT" ]; then
PW_FPS_LIMIT_VAR=($(echo "$PW_FPS_LIMIT" | tr '' '\n' | grep -v '='))
elif [ ! -z "$FPS_LIMIT" ] ; then
PW_FPS_LIMIT_VAR=($(echo "$FPS_LIMIT" | tr '' '\n' | grep -v '='))
fi
for add_list_mh in "${LIST_MH[@]}"; do
PW_MH_GUI_HELP="PW_MH_${add_list_mh}_INFO"
if [[ -n "$(grep -wo "$add_list_mh" <<<"${PW_MANGOHUD_CONFIG[@]}")" ]] ; then
......@@ -3338,6 +3338,14 @@ gui_MangoHud () {
fi
done
for add_list_mh_fps in "${GET_REFRESH_RATE[@]}"; do
if [[ -n "$(grep -wo "$add_list_mh_fps" <<<"${PW_FPS_LIMIT_VAR[@]}")" ]]; then
ADD_GUI_MH_FPS+="--field=${CHKBOX_SPACE}$add_list_mh_fps:${THEME_CHKBOX}%TRUE%"
else
ADD_GUI_MH_FPS+="--field=${CHKBOX_SPACE}$add_list_mh_fps:${THEME_CHKBOX}%FALSE%"
fi
done
export old_IFS=$IFS
export IFS="%"
"${pw_yad_v13_0}" --plug=$KEY_MH_GUI --tabnum="1" --form --columns=4 --separator=" " \
......@@ -3345,11 +3353,14 @@ gui_MangoHud () {
${ADD_GUI_MH} 1> "${PORT_WINE_TMP_PATH}/tmp_yad_mh_set" 2>/dev/null &
export IFS="${old_IFS}"
"${pw_yad_v13_0}" --plug=$KEY_MH_GUI --tabnum="2" --separator=" " --form \
--field="$(eval_gettext "MANGOHUD FPS LIMIT")!$(eval_gettext "Enabling FPS limits using MANGOHUD built into PortProton") :CB" "${FPS_LIMIT_VAR}!disabled!${GET_REFRESH_RATE}" \
1> "${PORT_WINE_TMP_PATH}/tmp_yad_mh_fps_limit" 2>/dev/null &
export old_IFS=$IFS
export IFS="%"
"${pw_yad_v13_0}" --plug=$KEY_MH_GUI --tabnum="2" --form --columns=10 --separator=" " \
--text-align=center --text="$(eval_gettext "Enabling fps limitation with MANGOHUD tools built into PortProton (Keys <b>L_SHIFT + F1</b> Toggles fps limitation)\n")" \
${ADD_GUI_MH_FPS} 1> "${PORT_WINE_TMP_PATH}/tmp_yad_mh_fps_limit" 2>/dev/null &
export IFS="${old_IFS}"
"${pw_yad_v13_0}" --paned --key="$KEY_MH_GUI" --height="600" --title="MangoHud" --center \
"${pw_yad_v13_0}" --paned --key="$KEY_MH_GUI" --height="700" --title="MangoHud" --center \
--separator=" " --window-icon="$PW_GUI_ICON_PATH/portproton.svg" \
--button="$(eval_gettext "CANCEL THE CHANGES")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(eval_gettext "Cancel the current changes and return to the previous menu")":1 \
--button="$(eval_gettext "DISABLE MANGOHUD")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(eval_gettext "Disable MangoHud and go to the previous menu")":182 \
......@@ -3364,8 +3375,7 @@ gui_MangoHud () {
;;
182)
export PW_MANGOHUD=0
export FPS_LIMIT="disabled"
edit_db_from_gui PW_MANGOHUD FPS_LIMIT
edit_db_from_gui PW_MANGOHUD PW_FPS_LIMIT
export SKIP_CHECK_UPDATES=1
/usr/bin/env bash -c ${pw_full_command_line[*]} &
exit 0
......@@ -3376,12 +3386,11 @@ gui_MangoHud () {
esac
YAD_MH_SET=$(<"${PORT_WINE_TMP_PATH}/tmp_yad_mh_set")
FPS_LIMIT=$(cat "${PORT_WINE_TMP_PATH}/tmp_yad_mh_fps_limit" | awk '{print $1}')
YAD_MH_FPS_LIMIT=$(<"${PORT_WINE_TMP_PATH}/tmp_yad_mh_fps_limit")
MONITOR_HEIGHT="$(echo $PW_SCREEN_RESOLUTION | awk -F'x' '{print $2}')"
MH_FONT_SIZE="font_size=$(( MONITOR_HEIGHT / 45 ))"
export INT_COUNT_MH=0
for read_list_mh in ${YAD_MH_SET} ; do
if [[ "$read_list_mh" == "TRUE" ]]
......@@ -3390,16 +3399,33 @@ gui_MangoHud () {
((INT_COUNT_MH++))
done
export INT_COUNT_MH_FPS=0
for read_list_mh_fps in ${YAD_MH_FPS_LIMIT} ; do
if [[ "$read_list_mh_fps" == "TRUE" ]]
then export GUI_MH_FPS_RESULT+="${GET_REFRESH_RATE[$INT_COUNT_MH_FPS]}+"
fi
((INT_COUNT_MH_FPS++))
done
GUI_MH_FPS_RESULT="${GUI_MH_FPS_RESULT}"
if [ "$(echo "${GUI_MH_FPS_RESULT}" | awk -F'+' '{print $2}')" ] ; then
export PW_FPS_LIMIT="${GUI_MH_FPS_RESULT%+}"
if [[ ! "${GUI_MH_RESULT}" =~ "show_fps_limit" ]] ; then
GUI_MH_RESULT="${GUI_MH_RESULT}show_fps_limit,"
fi
else
export PW_FPS_LIMIT="${GUI_MH_FPS_RESULT%+}"
fi
if [[ ! -z "$MH_FONT_SIZE" ]]
then GUI_MH_RESULT="${GUI_MH_RESULT}${MH_FONT_SIZE}"
else GUI_MH_RESULT="${GUI_MH_RESULT%,}"
fi
if [[ "${FPS_LIMIT}" != "disabled" ]] ; then
export GUI_MH_RESULT=${GUI_MH_RESULT},fps_limit=${FPS_LIMIT}
export PW_MANGOHUD=1
elif [[ "${FPS_LIMIT}" == "disabled" ]]
then export GUI_MH_RESULT="$(echo ${GUI_MH_RESULT} | sed "s/,fps_limit=${FPS_LIMIT_VAR}//" | sed "s/,fps_limit=disabled//")"
if [[ ! -z "$PW_FPS_LIMIT" ]]; then
GUI_MH_RESULT="${GUI_MH_RESULT},fps_limit=$PW_FPS_LIMIT"
elif [[ "$FPS_LIMIT" == "disabled" ]] ; then
GUI_MH_RESULT="${GUI_MH_RESULT},fps_limit=0"
fi
if [[ "${GUI_MH_RESULT}" =~ "fps_only" ]]; then
......@@ -3409,7 +3435,7 @@ gui_MangoHud () {
export MANGOHUD_CONFIG="${GUI_MH_RESULT}"
edit_db_from_gui MANGOHUD_CONFIG PW_MANGOHUD FPS_LIMIT
edit_db_from_gui MANGOHUD_CONFIG PW_MANGOHUD PW_FPS_LIMIT
export SKIP_CHECK_UPDATES=1
/usr/bin/env bash -c ${pw_full_command_line[*]} &
exit 0
......
......@@ -72,7 +72,7 @@ unset PW_CHECK_AUTOINSTAL PW_VKBASALT_EFFECTS PW_VKBASALT_FFX_CAS PORTWINE_DB PO
unset CHK_SYMLINK_FILE PW_MESA_GL_VERSION_OVERRIDE MESA_GL_VERSION_OVERRIDE PATH_TO_GAME PW_START_DEBUG PORTPROTON_NAME FLATPAK_IN_USE
unset PW_PREFIX_NAME WINEPREFIX VULKAN_MOD PW_WINE_VER PW_ADD_TO_ARGS_IN_RUNTIME PW_GAMEMODERUN_SLR AMD_VULKAN_ICD PW_WINE_CPU_TOPOLOGY
unset PW_NAME_D_NAME PW_NAME_D_ICON PW_NAME_D_EXEC PW_EXEC_FROM_DESKTOP PW_ALL_DF PW_GENERATE_BUTTONS PW_NAME_D_ICON PW_NAME_D_ICON_48
unset MANGOHUD_CONFIG PW_WINE_USE WINEDLLPATH WINE WINEDIR WINELOADER WINESERVER PW_USE_RUNTIME PORTWINE_CREATE_SHORTCUT_NAME MIRROR
unset MANGOHUD_CONFIG PW_FPS_LIMIT PW_WINE_USE WINEDLLPATH WINE WINEDIR WINELOADER WINESERVER PW_USE_RUNTIME PORTWINE_CREATE_SHORTCUT_NAME MIRROR
unset PW_LOCALE_SELECT
export PORT_WINE_TMP_PATH="${PORT_WINE_PATH}/data/tmp"
......
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