From 9203a72ef4b3a0d890ee3dc426043cfa8f107aff Mon Sep 17 00:00:00 2001
From: Mikhail Tergoev <fidel@altlinux.org>
Date: Thu, 11 Jul 2024 19:53:45 +0300
Subject: [PATCH 1/3] fix auto close HYP.exe after installing

---
 data_from_portwine/changelog_ru                         | 2 ++
 data_from_portwine/scripts/functions_helper             | 2 +-
 data_from_portwine/scripts/pw_autoinstall/PW_HO_YO_PLAY | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/data_from_portwine/changelog_ru b/data_from_portwine/changelog_ru
index 864cd2d0..9c2fdc8d 100755
--- a/data_from_portwine/changelog_ru
+++ b/data_from_portwine/changelog_ru
@@ -2,6 +2,8 @@
 -----------------------------------------
 История изменений:
 
+fix disable CAS
+
 ###Scripts version 2313### Дата: 11.07.2024 / Размер скачиваемого обновления: 4 мегабайта
 * добавлены все настройки gamescope в интерфейс PortProton (огромное спасибо Htylol)
 * добавлена экспериментальная возможность запуска нативной версии wine-wayland с сторонней версией wine, которая скомпилирована с данной функцией (спасибо Boria138)
diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper
index c1607e4c..05dade0f 100755
--- a/data_from_portwine/scripts/functions_helper
+++ b/data_from_portwine/scripts/functions_helper
@@ -858,7 +858,7 @@ export -f kill_portwine
 
 pw_kill_autostart () {
     if [[ -z "${2}" ]]
-    then SWAIT=5
+    then SWAIT=3
     else SWAIT="${2}"
     fi
     sleep 5
diff --git a/data_from_portwine/scripts/pw_autoinstall/PW_HO_YO_PLAY b/data_from_portwine/scripts/pw_autoinstall/PW_HO_YO_PLAY
index 1defcaea..3350a8b6 100755
--- a/data_from_portwine/scripts/pw_autoinstall/PW_HO_YO_PLAY
+++ b/data_from_portwine/scripts/pw_autoinstall/PW_HO_YO_PLAY
@@ -11,7 +11,7 @@ start_portwine
 if try_download "https://ys-api-os.mihoyo.com/event/download_porter/link/ys_global/genshinimpactpc/default" "${PW_AUTOINSTALL_EXE}" no_mirror
 then
     pw_start_progress_bar_block "Installing HoYoPlay Launcher."
-    pw_kill_autostart launcher.exe &
+    pw_kill_autostart HYP.exe &
     export PATH_TO_GAME="${PW_USER_TEMP}"
     pw_run "${PW_AUTOINSTALL_EXE}"
     export portwine_exe="$WINEPREFIX/drive_c/Program Files/HoYoPlay/launcher.exe"

From 2210356fec600cfa3dbb6f77391b6e8c8cf84d41 Mon Sep 17 00:00:00 2001
From: Mikhail Tergoev <fidel@altlinux.org>
Date: Thu, 11 Jul 2024 21:25:35 +0300
Subject: [PATCH 2/3] fixed PW_NO_RESTART_PPDB

---
 data_from_portwine/scripts/functions_helper   | 23 +++++++++++++++----
 .../scripts/pw_autoinstall/PW_WOSB            |  2 +-
 data_from_portwine/scripts/start.sh           | 15 ++++++------
 3 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper
index 05dade0f..ac8502dc 100755
--- a/data_from_portwine/scripts/functions_helper
+++ b/data_from_portwine/scripts/functions_helper
@@ -1275,13 +1275,17 @@ pw_init_db () {
             elif [[ $(echo "$PW_FIND_DB_FILE" | wc -l) -eq 1 ]] ; then
                 PORTWINE_DB_FILE="${PW_FIND_DB_FILE}"
             fi
+
             IFS="$orig_IFS"
-            if [[ -f "${PW_FIND_DB_FILE}" ]] && [[ -z $(grep "^export PW_DISABLED_CREATE_DB=1" "${PW_FIND_DB_FILE}") ]] ; then
+            if [[ -f "${PW_FIND_DB_FILE}" ]] \
+            && [[ "${PW_DISABLED_CREATE_DB}" != 1 ]] \
+            && [[ -z $(grep "^export PW_DISABLED_CREATE_DB=1" "${PW_FIND_DB_FILE}") ]]
+            then
                 try_copy_file "${PW_FIND_DB_FILE}" "${portwine_exe}".ppdb
                 PORTWINE_DB_FILE="${portwine_exe}".ppdb
             fi
-            if [[ ! -z $(echo "${portwine_exe}" | grep "/data/prefixes/") ]] && \
-                [[ -z $(echo "${portwine_exe}" | grep "/data/prefixes/DEFAULT/") ]]
+            if [[ ! -z $(echo "${portwine_exe}" | grep "/data/prefixes/") ]] \
+            && [[ -z $(echo "${portwine_exe}" | grep "/data/prefixes/DEFAULT/") ]]
             then
                 PW_PREFIX_NAME=$(echo "${portwine_exe}" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}')
             fi
@@ -1464,6 +1468,10 @@ update_winetricks () {
 }
 
 edit_db_from_gui () {
+    if [[ "${PW_DISABLED_CREATE_DB}" == 1 ]] ; then
+        print_warning "Skipped edit_db_from_gui"
+        return 0
+    fi
     print_info "edit_db_from_gui PORTWINE_DB_FILE=$PORTWINE_DB_FILE"
     if [[ ! -z "$PORTWINE_DB_FILE" ]] \
     && [[ -f "$PORTWINE_DB_FILE" ]]
@@ -1501,7 +1509,9 @@ edit_user_conf_from_gui () {
 }
 
 pw_create_gui_png () {
-    if [[ -z "$PORTPROTON_NAME" ]] ; then
+    if [[ -z "$PORTPROTON_NAME" ]] \
+    || [[ "$PW_NO_RESTART_PPDB" == "1" ]]
+    then
         if [[ ! -z "${PORTWINE_CREATE_SHORTCUT_NAME}" ]] ; then
             PORTPROTON_NAME="${PORTWINE_CREATE_SHORTCUT_NAME}"
         else
@@ -4401,6 +4411,9 @@ portwine_create_shortcut () {
     [[ ! -e ${portwine_exe} ]] && return 1
     pw_create_gui_png
 
+print_error "portwine_exe: $portwine_exe"
+print_error "PORTPROTON_NAME: ${PORTPROTON_NAME}"
+
     if [[ "$1" == "block_name" ]] ; then
         export name_desktop="${PORTPROTON_NAME}"
         OUTPUT=$("${pw_yad}" --title="$(gettext "Choices")" --form \
@@ -4513,7 +4526,7 @@ portwine_create_shortcut () {
             unset PW_SKIP_RESTART_STEAM
         fi
 
-        if [[ "$PW_NO_RESTART" != "1" ]] ; then
+        if [[ "$PW_NO_RESTART_PPDB" != "1" ]] ; then
             print_info "Restarting PP..."
             export SKIP_CHECK_UPDATES=1
             /usr/bin/env bash -c ${pw_full_command_line[*]} &
diff --git a/data_from_portwine/scripts/pw_autoinstall/PW_WOSB b/data_from_portwine/scripts/pw_autoinstall/PW_WOSB
index d22660e2..0fe8c661 100755
--- a/data_from_portwine/scripts/pw_autoinstall/PW_WOSB
+++ b/data_from_portwine/scripts/pw_autoinstall/PW_WOSB
@@ -20,7 +20,7 @@ then
     portwine_exe="$WINEPREFIX/drive_c/WoSB/launcher.exe"
     pw_stop_progress_bar
 
-    export PW_NO_RESTART="1"
+    export PW_NO_RESTART_PPDB="1"
     if [[ "$LANGUAGE" == "ru" ]] ; then
         export PORTWINE_CREATE_SHORTCUT_NAME="World of Sea Battle RU"
         pw_create_unique_exe "wosb_launcher_ru"
diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh
index 6de03372..94b18fdf 100755
--- a/data_from_portwine/scripts/start.sh
+++ b/data_from_portwine/scripts/start.sh
@@ -27,7 +27,11 @@ export pw_full_command_line=("$0" $*)
 
 MISSING_DESKTOP_FILE=0
 
-if [[ -f "$1" ]] ; then
+if [[ "$1" == *.ppack ]] ; then
+    export PW_NO_RESTART_PPDB="1"
+    export PW_DISABLED_CREATE_DB="1"
+    portwine_exe="$1"
+elif [[ -f "$1" ]] ; then
     portwine_exe="$(realpath "$1")"
 elif [[ -f "$OLDPWD/$1" ]] && [[ "$1" == *.exe ]] ; then
     portwine_exe="$(realpath "$OLDPWD/$1")"
@@ -72,7 +76,7 @@ else
 fi
 
 unset MANGOHUD MANGOHUD_DLSYM PW_NO_ESYNC PW_NO_FSYNC PW_VULKAN_USE WINEDLLOVERRIDES PW_NO_WRITE_WATCH PW_YAD_SET PW_ICON_FOR_YAD
-unset PW_CHECK_AUTOINSTALL PW_VKBASALT_EFFECTS PW_VKBASALT_FFX_CAS PORTWINE_DB PORTWINE_DB_FILE PW_DISABLED_CREATE_DB RADV_PERFTEST
+unset PW_CHECK_AUTOINSTALL PW_VKBASALT_EFFECTS PW_VKBASALT_FFX_CAS PORTWINE_DB PORTWINE_DB_FILE RADV_PERFTEST
 unset CHK_SYMLINK_FILE PW_MESA_GL_VERSION_OVERRIDE PW_VKD3D_FEATURE_LEVEL PATH_TO_GAME PW_START_DEBUG PORTPROTON_NAME PW_PATH
 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
@@ -324,9 +328,8 @@ EOF
         if [[ -f "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut" ]] ; then
             while IFS= read -r line
             do
-                export PW_NO_RESTART="1"
                 export portwine_exe="$PORT_WINE_PATH/data/prefixes/$PW_PREFIX_NAME/$line"
-                portwine_create_shortcut "$PORT_WINE_PATH/data/prefixes/$PW_PREFIX_NAME/$line"
+                portwine_create_shortcut
             done < "$PORT_WINE_PATH/data/prefixes/$PW_PREFIX_NAME/.create_shortcut"
         fi
         yad_info "$(gettext "Unpack is DONE for prefix:") <b>\"${PW_PREFIX_NAME}\"</b>."
@@ -721,9 +724,7 @@ case "${VULKAN_MOD}" in
 esac
 
 init_wine_ver
-if [[ -f "${PORTWINE_DB_FILE}" ]] \
-&& [[ "${PW_DISABLED_CREATE_DB}" != 1 ]]
-then
+if [[ -f "${PORTWINE_DB_FILE}" ]] ; then
     edit_db_from_gui PW_VULKAN_USE PW_WINE_USE PW_PREFIX_NAME
 fi
 

From 154f0e17db4a8259d2dc132f78d65d3e475c903d Mon Sep 17 00:00:00 2001
From: Mikhail Tergoev <fidel@altlinux.org>
Date: Thu, 11 Jul 2024 21:33:32 +0300
Subject: [PATCH 3/3] Scripts version 2314

---
 data_from_portwine/changelog_en | 5 +++++
 data_from_portwine/changelog_ru | 5 ++++-
 data_from_portwine/scripts/var  | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/data_from_portwine/changelog_en b/data_from_portwine/changelog_en
index fbb0a50b..6786bd67 100755
--- a/data_from_portwine/changelog_en
+++ b/data_from_portwine/changelog_en
@@ -2,6 +2,11 @@ You can help us in the development of the project on the website: https://linux-
 ----------------------------------------
 Changelog:
 
+###Scripts version 2314### Date: 11.07.2024 / Download update size: 4 megabytes
+* HOTFIX - create multiple shortcuts when unpacking a prefix backup
+* fixed the disable of CAS in the vkBasalt menu (0 in the menu is -1 in the variable)
+* fixed the auto-shutdown of the HoYoPlay launcher after the initial installation
+
 ###Scripts version 2313### Date: 11.07.2024 / Download update size: 4 megabytes
 * added all gamescope settings to the interface (thanks Htylol)
 * added the experimental ability to run the native version of wine-wayland with a third-party version of wine, which is compiled with this function (thanks Boria138)
diff --git a/data_from_portwine/changelog_ru b/data_from_portwine/changelog_ru
index 9c2fdc8d..c45340e0 100755
--- a/data_from_portwine/changelog_ru
+++ b/data_from_portwine/changelog_ru
@@ -2,7 +2,10 @@
 -----------------------------------------
 История изменений:
 
-fix disable CAS
+###Scripts version 2314### Дата: 11.07.2024 / Размер скачиваемого обновления: 4 мегабайта
+* HOTFIX - создание нескольких ярлыков при распаковке резервной копии префикса
+* исправлено полное отключение CAS в меню vkBasalt (0 в меню равно -1 в переменной)
+* исправлено автовыключение лончера HoYoPlay после первичной установки
 
 ###Scripts version 2313### Дата: 11.07.2024 / Размер скачиваемого обновления: 4 мегабайта
 * добавлены все настройки gamescope в интерфейс PortProton (огромное спасибо Htylol)
diff --git a/data_from_portwine/scripts/var b/data_from_portwine/scripts/var
index 51c6d2b8..ce61ec40 100755
--- a/data_from_portwine/scripts/var
+++ b/data_from_portwine/scripts/var
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #Author: Castro-Fidel (linux-gaming.ru)
-#SCRIPTS_NEXT_VERSION=2313
+#SCRIPTS_NEXT_VERSION=2314
 ########################################################################
 export LANGUAGES_LIST="ru es"
 export PW_VKBASALT="0"