From 39eea0f34ac6cb25eb8f68a8e0f044df4d1fa7d2 Mon Sep 17 00:00:00 2001 From: Mikhail Tergoev Date: Fri, 25 Oct 2024 10:59:05 +0300 Subject: [PATCH] fixed gamemode in native PP --- data_from_portwine/changelog_ru | 2 + data_from_portwine/scripts/functions_helper | 88 ++++++++++----------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/data_from_portwine/changelog_ru b/data_from_portwine/changelog_ru index 7a89fbda..0a6b80b1 100755 --- a/data_from_portwine/changelog_ru +++ b/data_from_portwine/changelog_ru @@ -2,6 +2,8 @@ ----------------------------------------- История изменений: +* исправлено использование gamemode в нативной версии PortProton + ###Scripts version 2366### / Дата: 24.10.2024 / Размер скачиваемого обновления: 4 мегабайта * удалена автоустановка "CatsLauncher" по причине переезда игры "Передний край" в "vkPlay" * обновлена версия меню трея (спасибо Htylol) diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index a33d8a94..d78d4445 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -2897,54 +2897,52 @@ start_portwine () { if check_gamescope_session ; then export PW_GAMEMODERUN_SLR="" - elif [[ "$PW_USE_GAMEMODE" = "1" ]] && [[ -n "$DBUS_SESSION_BUS_ADDRESS" ]]; then - if ! check_flatpak ; then - if systemctl is-active --quiet ananicy.service \ - || systemctl is-active --quiet ananicy-cpp.service - then - export GAMEMODERUN=0 - export PW_GAMEMODERUN_SLR="" - - if command -v powerprofilesctl &>/dev/null ; then - if powerprofilesctl list | grep -q 'performance:'; then - export PW_POWERPROFILECTL_SLR="powerprofilesctl launch -p performance --" - print_info "Gamemode replaced by powerprofilectl to avoid conflict with ananicy." - else - export PW_POWERPROFILECTL_SLR="" - fi + elif [[ "$PW_USE_GAMEMODE" = "1" ]] \ + && [[ -n "$DBUS_SESSION_BUS_ADDRESS" ]] + then + if command -v systemctl \ + && (systemctl is-active --quiet ananicy.service \ + || systemctl is-active --quiet ananicy-cpp.service) + then + export GAMEMODERUN=0 + export PW_GAMEMODERUN_SLR="" + if command -v powerprofilesctl &>/dev/null ; then + if powerprofilesctl list | grep -q 'performance:' ; then + export PW_POWERPROFILECTL_SLR="powerprofilesctl launch -p performance --" + print_info "Gamemode replaced by powerprofilectl to avoid conflict with ananicy." + else + export PW_POWERPROFILECTL_SLR="" fi fi + elif check_flatpak ; then + export GAMEMODERUN=1 + PW_GAMEMODERUN_SLR="gamemoderun" + print_info "Gamemode will be launched." + elif command -v gamemoded &>/dev/null ; then + export GAMEMODERUN=1 + PW_GAMEMODERUN_SLR="gamemoderun" + systemctl enable --now --user gamemoded &>/dev/null + print_info "Gamemode will be launched." + elif [[ "$PW_USE_RUNTIME" == 1 ]] ; then + export GAMEMODERUN=1 + if ! pidof gamemoded &>/dev/null ; then + GAMEMODEAUTO_NAME="libgamemodeauto.so.0" + if [[ -n "${PW_LD_PRELOAD}" ]]; then + export PW_LD_PRELOAD="${PW_LD_PRELOAD}:${GAMEMODEAUTO_NAME}" + else + export PW_LD_PRELOAD="${GAMEMODEAUTO_NAME}" + fi + + env LD_LIBRARY_PATH="${PW_PLUGINS_PATH}/portable/lib/lib64:${PW_PLUGINS_PATH}/portable/lib/lib32" \ + "${PW_PLUGINS_PATH}/portable/bin/gamemoded" &>/dev/null & + + print_info "Gamemode will be launched." + sleep 0.1 + fi else - if command -v gamemoded &>/dev/null ; then - export GAMEMODERUN=1 - PW_GAMEMODERUN_SLR="gamemoderun" - systemctl enable --now --user gamemoded &>/dev/null - print_info "Gamemode will be launched." - elif check_flatpak ; then - export GAMEMODERUN=1 - PW_GAMEMODERUN_SLR="gamemoderun" - print_info "Gamemode will be launched." - elif [[ "$PW_USE_RUNTIME" == 1 ]] ; then - export GAMEMODERUN=1 - if ! pidof gamemoded &>/dev/null ; then - GAMEMODEAUTO_NAME="libgamemodeauto.so.0" - if [[ -n "${PW_LD_PRELOAD}" ]]; then - export PW_LD_PRELOAD="${PW_LD_PRELOAD}:${GAMEMODEAUTO_NAME}" - else - export PW_LD_PRELOAD="${GAMEMODEAUTO_NAME}" - fi - - env LD_LIBRARY_PATH="${PW_PLUGINS_PATH}/portable/lib/lib64:${PW_PLUGINS_PATH}/portable/lib/lib32" \ - "${PW_PLUGINS_PATH}/portable/bin/gamemoded" &>/dev/null & - - print_info "Gamemode will be launched." - sleep 0.1 - fi - else - export GAMEMODERUN=0 - export PW_GAMEMODERUN_SLR="" - print_info "Gamemode is not installed or disabled in vars script or db file: PW_USE_GAMEMODE=$PW_USE_GAMEMODE" - fi + export GAMEMODERUN=0 + export PW_GAMEMODERUN_SLR="" + print_info "Gamemode is not installed or disabled in vars script or db file: PW_USE_GAMEMODE=$PW_USE_GAMEMODE" fi else export GAMEMODERUN=0