From caa0ddcb07ee435f7ee45281ee21a05560663d14 Mon Sep 17 00:00:00 2001
From: Htylol <dixperm909@yandex.ru>
Date: Thu, 12 Sep 2024 01:29:33 +0500
Subject: [PATCH] Added open directory

---
 data_from_portwine/scripts/functions_helper | 10 +++++++++-
 data_from_portwine/scripts/start.sh         |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper
index 37155c1b..8d12d7c0 100755
--- a/data_from_portwine/scripts/functions_helper
+++ b/data_from_portwine/scripts/functions_helper
@@ -4696,7 +4696,7 @@ gui_userconf () {
 
     KEY_USERCONF_GUI=$RANDOM
 
-    "${pw_yad}" --plug=$KEY_USERCONF_GUI --tabnum="1" --form --columns=3 --separator=" " --text-align=center \
+    "${pw_yad}" --plug=$KEY_USERCONF_GUI --tabnum="1" --form --columns=2 --separator=" " --text-align=center \
     --text "$(gettext "Change settings for") <b>user.conf</b>\n $(gettext "<b>NOTE:</b> To display help for each item, simply hover your mouse over the text")" \
     --align-buttons --homogeneous-column --gui-type-text="${PANED_GUI_TYPE_TEXT_UP}" --gui-type-layout="${PANED_GUI_TYPE_LAYOUT_UP}" \
     --field="   $(gettext "Change mirror to") $NEW_MIRROR"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"$(gettext "Depending on which mirror is selected, updates will be downloaded from there.")":"FBTN" '@bash -c "button_click --userconf change_mirror"' \
@@ -5585,6 +5585,14 @@ change_download_grid () {
 }
 export -f change_download_grid
 
+open_game_folder () {
+    xdg-open "${PATH_TO_GAME}"
+    /usr/bin/env bash -c ${pw_full_command_line[*]} &
+    print_info "Restarting PP after open game folder..."
+    exit 0
+}
+export -f open_game_folder
+
 change_gui_start () {
     if [[ "$PW_GUI_START" == "NOTEBOOK" ]] ; then
         sed -i 's/="NOTEBOOK"/="PANED"/g' "$USER_CONF"
diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh
index b206ccb7..8a368ee8 100755
--- a/data_from_portwine/scripts/start.sh
+++ b/data_from_portwine/scripts/start.sh
@@ -594,6 +594,7 @@ if [[ -f "${portwine_exe}" ]] ; then
             --gui-type-layout="${START_GUI_TYPE_LAYOUT_NOTEBOOK}" \
             --field="   $(gettext "Base settings")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Edit database file for") ${PORTWINE_DB}":"FBTN" '@bash -c "button_click --start 118"' \
             --field="   $(gettext "Settings user.conf")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Settings for user.conf")":"FBTN" '@bash -c "button_click --start 128"' \
+            --field="   $(gettext "Open directory")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Open directory with <b>.ppdb</b> file")":"FBTN" '@bash -c "button_click --start open_game_folder"' \
             --field="   vkBasalt"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Enable vkBasalt by default to improve graphics in games running on Vulkan. (The HOME hotkey disables vkbasalt)")":"FBTN" '@bash -c "button_click --start 120"' \
             --field="   MangoHud"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Enable Mangohud by default (R_SHIFT + F12 keyboard shortcuts disable Mangohud)")":"FBTN" '@bash -c "button_click --start 122"' \
             --field="   dgVoodoo2"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Enable dgVoodoo2 by default (This wrapper fixes many compatibility and rendering issues when running old games)")":"FBTN" '@bash -c "button_click --start 124"' \
@@ -638,6 +639,7 @@ if [[ -f "${portwine_exe}" ]] ; then
             --align-buttons --homogeneous-row --homogeneous-column \
             --field="   $(gettext "Base settings")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Edit database file for") ${PORTWINE_DB}":"FBTN" '@bash -c "button_click --start 118"' \
             --field="   $(gettext "Settings user.conf")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Settings for user.conf")":"FBTN" '@bash -c "button_click --start 128"' \
+            --field="   $(gettext "Open directory")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Open directory with <b>.ppdb</b> file")":"FBTN" '@bash -c "button_click --start open_game_folder"' \
             --field="   vkBasalt"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Enable vkBasalt by default to improve graphics in games running on Vulkan. (The HOME hotkey disables vkbasalt)")":"FBTN" '@bash -c "button_click --start 120"' \
             --field="   MangoHud"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Enable Mangohud by default (R_SHIFT + F12 keyboard shortcuts disable Mangohud)")":"FBTN" '@bash -c "button_click --start 122"' \
             --field="   dgVoodoo2"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE.png"!"$(gettext "Enable dgVoodoo2 by default (This wrapper fixes many compatibility and rendering issues when running old games)")":"FBTN" '@bash -c "button_click --start 124"' \
@@ -902,6 +904,7 @@ esac
     change_branch) change_branch ;;
     change_gui_start) change_gui_start ;;
     change_download_grid) change_download_grid ;;
+    open_game_folder) open_game_folder ;;
     118) gui_edit_db ;;
     120) gui_vkbasalt ;;
     122) gui_mangohud ;;