From e958e49b9373483c93f5f55a7e75b318f3ccd97c Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Sat, 18 Jan 2025 17:02:49 +0500 Subject: [PATCH] use start.sh --- data_from_portwine/scripts/add_in_steam.sh | 45 ++------------------- data_from_portwine/scripts/functions_helper | 24 +++++++++++ data_from_portwine/scripts/start.sh | 9 +++++ 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/data_from_portwine/scripts/add_in_steam.sh b/data_from_portwine/scripts/add_in_steam.sh index 2aef70c5..d0137db9 100755 --- a/data_from_portwine/scripts/add_in_steam.sh +++ b/data_from_portwine/scripts/add_in_steam.sh @@ -293,7 +293,7 @@ parseSteamShortcutEntryLaunchOptions() { } parseSteamTargetExe() { - grep -E '^[^# ]*?(rungame|flatpak|start\.sh)' "$1" | head -n 1 | sed 's/ "\$@"//' | awk -F'"' '{print $(NF-1)}' + grep -E '^[^# ]*?(flatpak|start\.sh)' "$1" | head -n 1 | sed 's/ "\$@"//' | awk -F'"' '{print $(NF-1)}' } restartSteam() { @@ -480,10 +480,10 @@ addNonSteamGame() { create_new_dir "${STEAM_SCRIPTS}" cat <<-EOF > "${NOSTSHPATH}" #!/usr/bin/env bash + export LD_PRELOAD= export START_FROM_STEAM=1 export START_FROM_FLATPAK=$(check_flatpak && echo 1 || echo 0) - source "${PORT_SCRIPTS_PATH}/add_in_steam.sh" - rungame "${portwine_exe}" "\$@" + "${PORT_SCRIPTS_PATH}/start.sh" "${portwine_exe}" "\$@" EOF chmod u+x "${NOSTSHPATH}" @@ -505,42 +505,3 @@ addNonSteamGame() { return 1 fi } - -rungame() { - export portwine_exe="${1:-}" - if [[ -n "${portwine_exe:-}" ]]; then - if [[ -n "${STEAM_COMPAT_DATA_PATH:-}" ]]; then - cd "$(dirname "${portwine_exe}")" - export PORTWINE_DB_FILE="${portwine_exe}.ppdb" - export PORT_SCRIPTS_PATH=$(readlink -f "${BASH_SOURCE[0]%/*}") - export PORT_WINE_PATH=${PORT_SCRIPTS_PATH%/*/*} - export PORT_WINE_TMP_PATH="${PORT_WINE_PATH}/data/tmp" - [[ -f "${PORT_WINE_PATH}/data/user.conf" ]] && source "${PORT_WINE_PATH}/data/user.conf" - [[ -f "${PORTWINE_DB_FILE}" ]] && source "${PORTWINE_DB_FILE}" - source "${PORT_SCRIPTS_PATH}/functions_helper" - PORT_WINE_PREFIX="${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME:-DEFAULT}" - for path in "ProgramData" "users/Public" "users/steamuser"; do - mkdir -p "${PORT_WINE_PREFIX}/drive_c/${path}" - if [[ ! -L "${WINEPREFIX}/drive_c/${path}" ]]; then - mkdir -p "${WINEPREFIX}/drive_c/users/" - rm -rf "${WINEPREFIX}/drive_c/${path}" - ln -sr "${PORT_WINE_PREFIX}/drive_c/${path}" "${WINEPREFIX}/drive_c/${path}" - fi - done - [[ $PW_LOG != 1 ]] && debug_timer --start -s "PW_TIME_IN_GAME" - "${STEAM_COMPAT_TOOL_PATHS%%:*}/proton" "run" "${portwine_exe}" "${@:2}" - if [[ $PW_LOG != 1 ]] && [[ -n $START_PW_TIME_IN_GAME ]] ; then - debug_timer --end -s "PW_TIME_IN_GAME" - PW_TIME_IN_GAME=$(( PW_TIME_IN_GAME / 1000 )) - search_desktop_file - fi - else - export LD_PRELOAD= - if [[ "${START_FROM_FLATPAK:-0}" == 1 ]] && command -v "flatpak" &>/dev/null; then - flatpak run ru.linux_gaming.PortProton "${portwine_exe}" - else - "${PORT_SCRIPTS_PATH}/start.sh" "${portwine_exe}" - fi - fi - fi -} diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 8bc28868..f14063fb 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -4370,6 +4370,30 @@ pw_yad_form_vulkan () { fi } +steamplay_launch () { + if [[ -n "${portwine_exe:-}" ]]; then + cd "$(dirname "${portwine_exe}")" + export PORTWINE_DB_FILE="${portwine_exe}.ppdb" + [[ -f "${PORTWINE_DB_FILE}" ]] && source "${PORTWINE_DB_FILE}" + PORT_WINE_PREFIX="${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME:-DEFAULT}" + for path in "ProgramData" "users/Public" "users/steamuser"; do + mkdir -p "${PORT_WINE_PREFIX}/drive_c/${path}" + if [[ ! -L "${WINEPREFIX}/drive_c/${path}" ]]; then + mkdir -p "${WINEPREFIX}/drive_c/users/" + rm -rf "${WINEPREFIX}/drive_c/${path}" + ln -sr "${PORT_WINE_PREFIX}/drive_c/${path}" "${WINEPREFIX}/drive_c/${path}" + fi + done + [[ $PW_LOG != 1 ]] && debug_timer --start -s "PW_TIME_IN_GAME" + echo "${STEAM_COMPAT_TOOL_PATHS%%:*}/proton" "run" "${portwine_exe}" "$@" + if [[ $PW_LOG != 1 ]] && [[ -n $START_PW_TIME_IN_GAME ]] ; then + debug_timer --end -s "PW_TIME_IN_GAME" + PW_TIME_IN_GAME=$(( PW_TIME_IN_GAME / 1000 )) + search_desktop_file + fi + fi +} + portwine_launch () { start_portwine unset PW_VD_TMP diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index 1d55a7bb..c6d138bc 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -6,6 +6,10 @@ export url_site="https://linux-gaming.ru/portproton/" export url_cloud="https://cloud.linux-gaming.ru/portproton" export url_git="https://git.linux-gaming.ru/CastroFidel/PortWINE" ######################################################################## +if [[ "${START_FROM_FLATPAK:-0}" == 1 ]] && command -v "flatpak" &>/dev/null; then + flatpak run ru.linux_gaming.PortProton "$@" + exit +fi echo ' █░░ █ █▄░█ █░█ ▀▄▀ ▄▄ █▀▀ ▄▀█ █▀▄▀█ █ █▄░█ █▀▀ ░ █▀█ █░█ █▄▄ █ █░▀█ █▄█ █░█ ░░ █▄█ █▀█ █░▀░█ █ █░▀█ █▄█ ▄ █▀▄ █▄█ @@ -191,6 +195,11 @@ if [[ $TRANSLATIONS_VER != "$scripts_install_ver" ]] ; then source "$PW_CACHE_LANG_PATH/$LANGUAGE" fi +if [[ -n "${STEAM_COMPAT_DATA_PATH:-}" ]]; then + steamplay_launch "${@:2}" + exit +fi + # check PortProton theme if [[ -n "$GUI_THEME" ]] \ && [[ -f "$PW_GUI_THEMES_PATH/$GUI_THEME.pptheme" ]]