mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-07-04 10:23:39 +00:00
Compare commits
48 Commits
v1.6
...
199e548767
Author | SHA1 | Date | |
---|---|---|---|
199e548767 | |||
8087ffe564 | |||
b2b2312ce9 | |||
4ad9603aa3 | |||
709cb6dbae | |||
810f21415e | |||
3e982b3303 | |||
cfeb3a841f | |||
60af93add3 | |||
b64eaf88c5 | |||
e8d96c45a0 | |||
d8826f608c | |||
07a99d3aa1 | |||
b4791a0b7d | |||
e43a59ce7b | |||
fc98118ac5 | |||
4fd9fec8f7 | |||
130704107b | |||
15cad464e3 | |||
cabfd03c29 | |||
33170fae78 | |||
b701ea5e3d | |||
05d75ec82f | |||
2f97a8eb2d | |||
cb3fc5d0d7 | |||
c42d459ef2 | |||
675621c4c3 | |||
c07e673c0d | |||
b85df29d6d | |||
7f3d84a8bc | |||
6533cf98bd | |||
c7c8cd1ecd | |||
e0d149494d | |||
9800420d73 | |||
eae146ce02 | |||
b4248fb264 | |||
d5dbec7b3f | |||
d4e8298743 | |||
8ee730bf35 | |||
b6eea7b224 | |||
c9c3c07866 | |||
2e883423d3 | |||
12a3a51eb4 | |||
aec6ffbfc0 | |||
96b15262f5 | |||
9986f62566 | |||
a2397c28f0 | |||
e8891b42e6 |
11
README.md
11
README.md
@ -23,7 +23,10 @@ Keybinds are backed up to *$XDG_CONFIG_HOME/starcitizen-lug/keybinds/*
|
|||||||
`Manage Lutris Runners`
|
`Manage Lutris Runners`
|
||||||
- Quickly install and delete Lutris wine runners
|
- Quickly install and delete Lutris wine runners
|
||||||
|
|
||||||
`User Folder Maintenance and Troubleshooting`
|
`Manage DXVK Versions`
|
||||||
|
- Quickly install and delete DXVK versions for Lutris
|
||||||
|
|
||||||
|
`Maintenance and Troubleshooting`
|
||||||
- `Switch the helper between LIVE and PTU`
|
- `Switch the helper between LIVE and PTU`
|
||||||
- Toggle between targeting LIVE or PTU for all of the above options. Defaults to LIVE on each run.
|
- Toggle between targeting LIVE or PTU for all of the above options. Defaults to LIVE on each run.
|
||||||
|
|
||||||
@ -34,12 +37,15 @@ Keybinds are backed up to *$XDG_CONFIG_HOME/starcitizen-lug/keybinds/*
|
|||||||
- To re-import your keybinds from within the game, select them from the list:
|
- To re-import your keybinds from within the game, select them from the list:
|
||||||
- *Options->Keybindings->Control Profiles*
|
- *Options->Keybindings->Control Profiles*
|
||||||
|
|
||||||
- `Delete my shaders only`
|
- `Delete my shaders folder only`
|
||||||
- Sometimes all you need to do between major version updates is delete your shaders directory.
|
- Sometimes all you need to do between major version updates is delete your shaders directory.
|
||||||
|
|
||||||
- `Delete my DXVK cache`
|
- `Delete my DXVK cache`
|
||||||
- A troubleshooting step that sometimes helps fix various issues and crashes.
|
- A troubleshooting step that sometimes helps fix various issues and crashes.
|
||||||
|
|
||||||
|
- `Display Helper and Star Citizen directories`
|
||||||
|
- Show all the directories currently in use by both the Helper and Star Citizen.
|
||||||
|
|
||||||
- `Reset Helper configs`
|
- `Reset Helper configs`
|
||||||
- Delete the configs saved by the helper in *$XDG_CONFIG_HOME/starcitizen-lug/*
|
- Delete the configs saved by the helper in *$XDG_CONFIG_HOME/starcitizen-lug/*
|
||||||
|
|
||||||
@ -62,4 +68,5 @@ Arch Linux: https://aur.archlinux.org/packages/lug-helper/
|
|||||||
- https://github.com/pstn
|
- https://github.com/pstn
|
||||||
- https://github.com/gort818
|
- https://github.com/gort818
|
||||||
- https://github.com/victort
|
- https://github.com/victort
|
||||||
|
- https://github.com/Wrzlprnft
|
||||||
- Runner Downloader inspired by https://github.com/richardtatum/sc-runner-updater
|
- Runner Downloader inspired by https://github.com/richardtatum/sc-runner-updater
|
||||||
|
598
lug-helper.sh
598
lug-helper.sh
@ -15,7 +15,7 @@
|
|||||||
# - Check your system for optimal settings and
|
# - Check your system for optimal settings and
|
||||||
# change them as needed to prevent crashes.
|
# change them as needed to prevent crashes.
|
||||||
#
|
#
|
||||||
# - Easily install and remove Lutris wine Runners.
|
# - Easily install and remove Lutris wine Runners and DXVK versions.
|
||||||
#
|
#
|
||||||
# - Qickly wipe your Star Citizen USER folder as is recommended
|
# - Qickly wipe your Star Citizen USER folder as is recommended
|
||||||
# by CIG after major version updates.
|
# by CIG after major version updates.
|
||||||
@ -43,10 +43,17 @@
|
|||||||
# Contributor: https://github.com/pstn
|
# Contributor: https://github.com/pstn
|
||||||
# Contributor: https://github.com/gort818
|
# Contributor: https://github.com/gort818
|
||||||
# Contributor: https://github.com/victort
|
# Contributor: https://github.com/victort
|
||||||
|
# Contributor: https://github.com/Wrzlprnft
|
||||||
# Runner Downloader inspired by:
|
# Runner Downloader inspired by:
|
||||||
# https://github.com/richardtatum/sc-runner-updater
|
# https://github.com/richardtatum/sc-runner-updater
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
# Check if script is run as root
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
echo "This script is not supposed to be run as root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for dependencies
|
# Check for dependencies
|
||||||
if [ ! -x "$(command -v curl)" ]; then
|
if [ ! -x "$(command -v curl)" ]; then
|
||||||
# Print to stderr and also try warning the user through notify-send
|
# Print to stderr and also try warning the user through notify-send
|
||||||
@ -75,12 +82,20 @@ conf_subdir="starcitizen-lug"
|
|||||||
tmp_dir="$(mktemp -d --suffix=".lughelper")"
|
tmp_dir="$(mktemp -d --suffix=".lughelper")"
|
||||||
trap 'rm -r "$tmp_dir"' EXIT
|
trap 'rm -r "$tmp_dir"' EXIT
|
||||||
|
|
||||||
# The game's user subdirectory name
|
######## Game Directories ##################################################
|
||||||
user_subdir_name="USER"
|
|
||||||
# The location within the USER directory to which the game exports keybinds
|
|
||||||
keybinds_export_path="Controls/Mappings"
|
|
||||||
|
|
||||||
dxvk_cache_file="StarCitizen.dxvk-cache"
|
# The game's base directory name
|
||||||
|
sc_base_dir="StarCitizen"
|
||||||
|
# The default install location within a WINE prefix:
|
||||||
|
install_path="drive_c/Program Files/Roberts Space Industries/$sc_base_dir"
|
||||||
|
|
||||||
|
# The names of the live/ptu directories
|
||||||
|
live_dir="LIVE"
|
||||||
|
ptu_dir="PTU"
|
||||||
|
|
||||||
|
# Remaining directory paths are set at the end of the getdirs() function
|
||||||
|
|
||||||
|
######## Runners ###########################################################
|
||||||
|
|
||||||
# Lutris wine runners directory
|
# Lutris wine runners directory
|
||||||
runners_dir="$data_dir/lutris/runners/wine"
|
runners_dir="$data_dir/lutris/runners/wine"
|
||||||
@ -92,14 +107,33 @@ runners_dir="$data_dir/lutris/runners/wine"
|
|||||||
runner_sources=(
|
runner_sources=(
|
||||||
"RawFox" "https://api.github.com/repos/rawfoxDE/raw-wine/releases"
|
"RawFox" "https://api.github.com/repos/rawfoxDE/raw-wine/releases"
|
||||||
"Molotov/Snatella" "https://api.github.com/repos/snatella/wine-runner-sc/releases"
|
"Molotov/Snatella" "https://api.github.com/repos/snatella/wine-runner-sc/releases"
|
||||||
|
"/dev/null" "https://api.github.com/repos/gort818/wine-sc-lug/releases"
|
||||||
|
"GloriousEggroll" "https://api.github.com/repos/GloriousEggroll/wine-ge-custom/releases"
|
||||||
)
|
)
|
||||||
# Set a maximum number of runner versions to display from each url
|
# Set a maximum number of runner versions to display from each url
|
||||||
max_runners=20
|
max_runners=20
|
||||||
|
|
||||||
|
######## DXVK ##############################################################
|
||||||
|
|
||||||
|
# Lutris dxvk directory
|
||||||
|
dxvk_dir="$data_dir/lutris/runtime/dxvk"
|
||||||
|
# URLs for downloading dxvk versions
|
||||||
|
# Elements in this array must be added in quoted pairs of: "description" "url"
|
||||||
|
# The first string in the pair is expected to contain the runner description
|
||||||
|
# The second is expected to contain the github api releases url
|
||||||
|
# ie. "Sporif Async" "https://api.github.com/repos/Sporif/dxvk-async/releases"
|
||||||
|
dxvk_sources=(
|
||||||
|
"Sporif Async" "https://api.github.com/repos/Sporif/dxvk-async/releases"
|
||||||
|
)
|
||||||
|
# Set a maximum number of runner versions to display from each url
|
||||||
|
max_dxvks=20
|
||||||
|
|
||||||
# Pixels to add for each Zenity menu option
|
# Pixels to add for each Zenity menu option
|
||||||
# used to dynamically determine the height of menus
|
# used to dynamically determine the height of menus
|
||||||
menu_option_height="25"
|
menu_option_height="25"
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
|
||||||
# Use logo installed by a packaged version of this script if available
|
# Use logo installed by a packaged version of this script if available
|
||||||
# Otherwise, default to the logo in the same directory
|
# Otherwise, default to the logo in the same directory
|
||||||
if [ -f "/usr/share/pixmaps/lug-logo.png" ]; then
|
if [ -f "/usr/share/pixmaps/lug-logo.png" ]; then
|
||||||
@ -110,6 +144,11 @@ else
|
|||||||
lug_logo="info"
|
lug_logo="info"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Github repo and script version info
|
||||||
|
repo="the-sane/lug-helper"
|
||||||
|
releases_url="https://github.com/the-sane/lug-helper/releases"
|
||||||
|
current_version="v1.11"
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
@ -242,6 +281,7 @@ message() {
|
|||||||
# This text will be displayed above the menu options.
|
# This text will be displayed above the menu options.
|
||||||
# Zenity supports Pango Markup for text formatting.
|
# Zenity supports Pango Markup for text formatting.
|
||||||
# - The integer "menu_height" specifies the height of the zenity menu.
|
# - The integer "menu_height" specifies the height of the zenity menu.
|
||||||
|
# - The string "cancel_label" should contain the text of the cancel button.
|
||||||
#
|
#
|
||||||
# The final element in each array is expected to be a quit option.
|
# The final element in each array is expected to be a quit option.
|
||||||
#
|
#
|
||||||
@ -263,6 +303,8 @@ menu() {
|
|||||||
debug_print exit "Script error: The string 'menu_text_terminal' was not set\nbefore calling the menu function. Aborting."
|
debug_print exit "Script error: The string 'menu_text_terminal' was not set\nbefore calling the menu function. Aborting."
|
||||||
elif [ -z "$menu_height" ]; then
|
elif [ -z "$menu_height" ]; then
|
||||||
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting."
|
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting."
|
||||||
|
elif [ -z "$cancel_label" ]; then
|
||||||
|
debug_print exit "Script error: The string 'menu_height' was not set\nbefore calling the menu function. Aborting."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use Zenity if it is available
|
# Use Zenity if it is available
|
||||||
@ -282,7 +324,7 @@ menu() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Display the zenity radio button menu
|
# Display the zenity radio button menu
|
||||||
choice="$(zenity --list --radiolist --width="480" --height="$menu_height" --text="$menu_text_zenity" --title="Star Citizen LUG Helper" --hide-header --window-icon=$lug_logo --column="" --column="Option" "${zen_options[@]}" 2>/dev/null)"
|
choice="$(zenity --list --radiolist --width="480" --height="$menu_height" --text="$menu_text_zenity" --title="Star Citizen LUG Helper" --hide-header --cancel-label "$cancel_label" --window-icon=$lug_logo --column="" --column="Option" "${zen_options[@]}" 2>/dev/null)"
|
||||||
|
|
||||||
# Loop through the options array to match the chosen option
|
# Loop through the options array to match the chosen option
|
||||||
matched="false"
|
matched="false"
|
||||||
@ -360,7 +402,7 @@ getdirs() {
|
|||||||
fi
|
fi
|
||||||
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
||||||
game_path="$(cat "$conf_dir/$conf_subdir/$game_conf")"
|
game_path="$(cat "$conf_dir/$conf_subdir/$game_conf")"
|
||||||
if [ ! -d "$game_path" ] || [ "$(basename "$game_path")" != "StarCitizen" ]; then
|
if [ ! -d "$game_path" ] || [ "$(basename "$game_path")" != "$sc_base_dir" ]; then
|
||||||
debug_print continue "Unexpected game path found in config file, ignoring."
|
debug_print continue "Unexpected game path found in config file, ignoring."
|
||||||
game_path=""
|
game_path=""
|
||||||
fi
|
fi
|
||||||
@ -387,15 +429,15 @@ getdirs() {
|
|||||||
|
|
||||||
# Get the game path
|
# Get the game path
|
||||||
if [ -z "$game_path" ]; then
|
if [ -z "$game_path" ]; then
|
||||||
if [ -d "$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen" ] &&
|
if [ -d "$wine_prefix/$install_path" ] &&
|
||||||
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"; then
|
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/$install_path"; then
|
||||||
game_path="$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
game_path="$wine_prefix/$install_path"
|
||||||
else
|
else
|
||||||
while game_path="$(zenity --file-selection --directory --title="Select your Star Citizen directory" --filename="$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen" 2>/dev/null)"; do
|
while game_path="$(zenity --file-selection --directory --title="Select your Star Citizen directory" --filename="$wine_prefix/$install_path" 2>/dev/null)"; do
|
||||||
if [ "$?" -eq -1 ]; then
|
if [ "$?" -eq -1 ]; then
|
||||||
message warning "An unexpected error has occurred. The Helper is unable to proceed."
|
message warning "An unexpected error has occurred. The Helper is unable to proceed."
|
||||||
return 1
|
return 1
|
||||||
elif [ "$(basename "$game_path")" != "StarCitizen" ]; then
|
elif [ "$(basename "$game_path")" != "$sc_base_dir" ]; then
|
||||||
message warning "You must select the Star Citizen base game directory.\n\nFor Example: prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
message warning "You must select the Star Citizen base game directory.\n\nFor Example: prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
||||||
else
|
else
|
||||||
# All good or cancel
|
# All good or cancel
|
||||||
@ -428,17 +470,17 @@ getdirs() {
|
|||||||
|
|
||||||
# Get the game path
|
# Get the game path
|
||||||
if [ -z "$game_path" ]; then
|
if [ -z "$game_path" ]; then
|
||||||
if [ -d "$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen" ] &&
|
if [ -d "$wine_prefix/$install_path" ] &&
|
||||||
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"; then
|
message question "Is this your Star Citizen game directory?\n\n$wine_prefix/$install_path"; then
|
||||||
game_path="$wine_prefix/drive_c/Program Files/Roberts Space Industries/StarCitizen"
|
game_path="$wine_prefix/$install_path"
|
||||||
else
|
else
|
||||||
printf "\nEnter the full path to your Star Citizen installation directory (case sensitive)\n"
|
printf "\nEnter the full path to your Star Citizen installation directory (case sensitive)\n"
|
||||||
printf "ie. /home/USER/Games/star-citizen/drive_c/Program Files/Roberts Space Industries/StarCitizen\n"
|
printf "ie. /home/USER/Games/star-citizen/drive_c/Program Files/Roberts Space Industries/StarCitizen\n"
|
||||||
while read -rp ": " game_path; do
|
while read -rp ": " game_path; do
|
||||||
if [ ! -d "$game_path" ]; then
|
if [ ! -d "$game_path" ]; then
|
||||||
printf "That directory is invalid or does not exist. Please try again.\n\n"
|
printf "That directory is invalid or does not exist. Please try again.\n\n"
|
||||||
elif [ "$(basename "$game_path")" != "StarCitizen" ]; then
|
elif [ "$(basename "$game_path")" != "$sc_base_dir" ]; then
|
||||||
printf "You must enter the full path to the directory named 'StarCitizen'\n\n"
|
printf "You must enter the full path to the directory named '$sc_base_dir'\n\n"
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -452,12 +494,57 @@ getdirs() {
|
|||||||
echo "$game_path" > "$conf_dir/$conf_subdir/$game_conf"
|
echo "$game_path" > "$conf_dir/$conf_subdir/$game_conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set some remaining directory paths
|
######## Set remaining directory paths #####################################
|
||||||
user_dir="$game_path/$live_or_ptu/$user_subdir_name"
|
# $live_or_ptu is set in the set_version() function
|
||||||
keybinds_dir="$user_dir/$keybinds_export_path"
|
############################################################################
|
||||||
|
# The game's user directory
|
||||||
|
user_dir="$game_path/$live_or_ptu/USER/Client/0"
|
||||||
|
# The location within the USER directory to which the game exports keybinds
|
||||||
|
keybinds_dir="$user_dir/Controls/Mappings"
|
||||||
|
# Shaders directory
|
||||||
|
shaders_dir="$user_dir/shaders"
|
||||||
|
# dxvk cache file
|
||||||
|
dxvk_cache="$game_path/$live_or_ptu/StarCitizen.dxvk-cache"
|
||||||
|
# Where to store backed up keybinds
|
||||||
backup_path="$conf_dir/$conf_subdir"
|
backup_path="$conf_dir/$conf_subdir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Display all directories currently used by this helper and Star Citizen
|
||||||
|
display_dirs() {
|
||||||
|
# Helper configs and keybinds
|
||||||
|
if [ -d "$conf_dir/$conf_subdir" ]; then
|
||||||
|
dirs_list+=("\n\nHelper configuration:\n$conf_dir/$conf_subdir\n\nKeybind backups:\n$conf_dir/$conf_subdir/keybinds")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wine prefix
|
||||||
|
if [ -f "$conf_dir/$conf_subdir/$wine_conf" ]; then
|
||||||
|
dirs_list+="\n\nWine prefix:\n$(cat "$conf_dir/$conf_subdir/$wine_conf")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Star Citizen installation
|
||||||
|
if [ -f "$conf_dir/$conf_subdir/$game_conf" ]; then
|
||||||
|
dirs_list+="\n\nStar Citizen game directory:\n$(cat "$conf_dir/$conf_subdir/$game_conf")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lutris runners
|
||||||
|
if [ -d "$runners_dir" ]; then
|
||||||
|
dirs_list+="\n\nLutris Runners:\n$runners_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lutris dxvk
|
||||||
|
if [ -d "$runners_dir" ]; then
|
||||||
|
dirs_list+="\n\nLutris DXVK Versions:\n$dxvk_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Formatting
|
||||||
|
message_heading="These directories are currently being used by this Helper and Star Citizen"
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
message_heading="<b>$message_heading</b>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
message info "$message_heading\n${dirs_list[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
# Save exported keybinds, wipe the USER directory, and restore keybinds
|
# Save exported keybinds, wipe the USER directory, and restore keybinds
|
||||||
sanitize() {
|
sanitize() {
|
||||||
# Prompt user to back up the current keybinds in the game
|
# Prompt user to back up the current keybinds in the game
|
||||||
@ -511,6 +598,7 @@ sanitize() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#--------------------- begin preflight check functions -----------------------#
|
||||||
#------------------------- begin mapcount functions --------------------------#
|
#------------------------- begin mapcount functions --------------------------#
|
||||||
|
|
||||||
# Check if setting vm.max_map_count was successful
|
# Check if setting vm.max_map_count was successful
|
||||||
@ -637,17 +725,27 @@ filelimit_check() {
|
|||||||
|
|
||||||
#------------------------- end filelimit functions ---------------------------#
|
#------------------------- end filelimit functions ---------------------------#
|
||||||
|
|
||||||
|
|
||||||
# Check total system memory
|
# Check total system memory
|
||||||
memory_check() {
|
memory_check() {
|
||||||
memtotal="$(awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
|
memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf "%.1f \n", $2/1024/1024}' /proc/meminfo)"
|
||||||
if awk 'BEGIN {exit !("$memtotal" < 15)}'; then
|
if [ ${memtotal%.*} -ge "15" ]; then
|
||||||
preflight_pass+=("Your system has $memtotal GB of memory.")
|
preflight_pass+=("Your system has $memtotal GB of memory.")
|
||||||
else
|
else
|
||||||
preflight_fail+=("Your system has $memtotal GB of memory.\nWe recommend at least 16 GB to avoid crashes.")
|
preflight_fail+=("Your system has $memtotal GB of memory.\nWe recommend at least 16 GB to avoid crashes.")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check CPU for the required AVX extension
|
||||||
|
avx_check() {
|
||||||
|
if grep -q "avx" /proc/cpuinfo; then
|
||||||
|
preflight_pass+=("Your CPU supports the necessary AVX instruction set.")
|
||||||
|
else
|
||||||
|
preflight_fail+=("Your CPU does not appear to support AVX instructions.\nThis requirement was added to Star Citizen in version 3.11")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------- end preflight check functions ---------------------#
|
||||||
|
|
||||||
# Delete the shaders directory
|
# Delete the shaders directory
|
||||||
rm_shaders() {
|
rm_shaders() {
|
||||||
# Get/Set directory paths
|
# Get/Set directory paths
|
||||||
@ -657,8 +755,6 @@ rm_shaders() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shaders_dir="$user_dir/shaders"
|
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [ ! -d "$shaders_dir" ]; then
|
if [ ! -d "$shaders_dir" ]; then
|
||||||
message warning "Shaders directory not found. There is nothing to delete!\n\n$shaders_dir"
|
message warning "Shaders directory not found. There is nothing to delete!\n\n$shaders_dir"
|
||||||
@ -683,8 +779,6 @@ rm_dxvkcache() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dxvk_cache="$game_path/$live_or_ptu/$dxvk_cache_file"
|
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [ ! -f "$dxvk_cache" ]; then
|
if [ ! -f "$dxvk_cache" ]; then
|
||||||
message warning "Unable to find the DXVK cache file. There is nothing to delete!\n\n$dxvk_cache"
|
message warning "Unable to find the DXVK cache file. There is nothing to delete!\n\n$dxvk_cache"
|
||||||
@ -699,12 +793,10 @@ rm_dxvkcache() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------- begin runner functions ----------------------------#
|
|
||||||
|
|
||||||
# Restart lutris
|
# Restart lutris
|
||||||
lutris_restart() {
|
lutris_restart() {
|
||||||
if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep lutris)" ]; then
|
if [ "$lutris_needs_restart" = "true" ] && [ "$(pgrep lutris)" ]; then
|
||||||
if message question "Lutris must be restarted to detect runner changes.\nWould you like this Helper to restart it for you?"; then
|
if message question "Lutris must be restarted to detect the changes.\nWould you like this Helper to restart it for you?"; then
|
||||||
debug_print continue "Restarting Lutris..."
|
debug_print continue "Restarting Lutris..."
|
||||||
pkill -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
|
pkill -SIGTERM lutris && nohup lutris </dev/null &>/dev/null &
|
||||||
fi
|
fi
|
||||||
@ -712,6 +804,8 @@ lutris_restart() {
|
|||||||
lutris_needs_restart="false"
|
lutris_needs_restart="false"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------- begin runner functions ----------------------------#
|
||||||
|
|
||||||
# Delete the selected runner
|
# Delete the selected runner
|
||||||
runner_delete() {
|
runner_delete() {
|
||||||
# This function expects an index number for the array
|
# This function expects an index number for the array
|
||||||
@ -762,6 +856,9 @@ runner_select_delete() {
|
|||||||
menu_height="400"
|
menu_height="400"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
}
|
}
|
||||||
@ -789,6 +886,9 @@ runner_install() {
|
|||||||
*.tgz)
|
*.tgz)
|
||||||
runner_name="$(basename "$runner_file" .tgz)"
|
runner_name="$(basename "$runner_file" .tgz)"
|
||||||
;;
|
;;
|
||||||
|
*.tar.xz)
|
||||||
|
runner_name="$(basename "$runner_file" .tar.xz)"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
debug_print exit "Unknown archive filetype in runner_install function. Aborting."
|
debug_print exit "Unknown archive filetype in runner_install function. Aborting."
|
||||||
;;
|
;;
|
||||||
@ -843,7 +943,7 @@ runner_install() {
|
|||||||
# Get the path of the first item listed in the archive
|
# Get the path of the first item listed in the archive
|
||||||
# This should either be a subdirectory or the path ./
|
# This should either be a subdirectory or the path ./
|
||||||
# depending on how the archive was created
|
# depending on how the archive was created
|
||||||
first_filepath="$(stdbuf -oL tar -tzf "$tmp_dir/$runner_file" | head -n 1)"
|
first_filepath="$(stdbuf -oL tar -tf "$tmp_dir/$runner_file" | head -n 1)"
|
||||||
|
|
||||||
# Extract the runner
|
# Extract the runner
|
||||||
case "$first_filepath" in
|
case "$first_filepath" in
|
||||||
@ -852,10 +952,10 @@ runner_install() {
|
|||||||
debug_print continue "Installing runner into $runners_dir/$runner_name..."
|
debug_print continue "Installing runner into $runners_dir/$runner_name..."
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Use Zenity progress bar
|
# Use Zenity progress bar
|
||||||
mkdir -p "$runners_dir/$runner_name" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name" | \
|
mkdir -p "$runners_dir/$runner_name" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name" | \
|
||||||
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
||||||
else
|
else
|
||||||
mkdir -p "$runners_dir/$runner_name" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name"
|
mkdir -p "$runners_dir/$runner_name" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir/$runner_name"
|
||||||
fi
|
fi
|
||||||
lutris_needs_restart="true"
|
lutris_needs_restart="true"
|
||||||
;;
|
;;
|
||||||
@ -864,10 +964,10 @@ runner_install() {
|
|||||||
debug_print continue "Installing runner into $runners_dir..."
|
debug_print continue "Installing runner into $runners_dir..."
|
||||||
if [ "$use_zenity" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Use Zenity progress bar
|
# Use Zenity progress bar
|
||||||
mkdir -p "$runners_dir" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir" | \
|
mkdir -p "$runners_dir" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir" | \
|
||||||
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing runner...\n" 2>/dev/null
|
||||||
else
|
else
|
||||||
mkdir -p "$runners_dir" && tar -xzf "$tmp_dir/$runner_file" -C "$runners_dir"
|
mkdir -p "$runners_dir" && tar -xf "$tmp_dir/$runner_file" -C "$runners_dir"
|
||||||
fi
|
fi
|
||||||
lutris_needs_restart="true"
|
lutris_needs_restart="true"
|
||||||
;;
|
;;
|
||||||
@ -886,7 +986,8 @@ runner_select_install() {
|
|||||||
debug_print exit "Script error: The runner_select_install function expects a numerical argument. Aborting."
|
debug_print exit "Script error: The runner_select_install function expects a numerical argument. Aborting."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Store the url from the selected contributor
|
# Store info from the selected contributor
|
||||||
|
contributor_name="${runner_sources[$1]}"
|
||||||
contributor_url="${runner_sources[$1+1]}"
|
contributor_url="${runner_sources[$1+1]}"
|
||||||
|
|
||||||
# Check the provided contributor url to make sure we know how to handle it
|
# Check the provided contributor url to make sure we know how to handle it
|
||||||
@ -901,11 +1002,22 @@ runner_select_install() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Check GlibC version against the requirements of the selected runner
|
||||||
|
if [ "$contributor_name" = "/dev/null" ]; then
|
||||||
|
required_glibc="2.33"
|
||||||
|
system_glibc="$(ldd --version | awk '/ldd/{print $NF}')"
|
||||||
|
|
||||||
|
if [ "$(bc <<< "$required_glibc > $system_glibc")" = "1" ]; then
|
||||||
|
message warning "Your glibc version is incompatible with the selected runner.\n\nSystem glibc: v$system_glibc\nMinimum required glibc: v$required_glibc"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Fetch a list of runner versions from the selected contributor
|
# Fetch a list of runner versions from the selected contributor
|
||||||
# To add new sources, handle them here, in the if statement
|
# To add new sources, handle them here, in the if statement
|
||||||
# just above, and the runner_install function above
|
# just above, and the runner_install function above
|
||||||
if [ "$runner_url_type" = "github" ]; then
|
if [ "$runner_url_type" = "github" ]; then
|
||||||
runner_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | xargs basename -a))
|
runner_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | grep -vE "*.sha512sum" | xargs basename -a))
|
||||||
else
|
else
|
||||||
debug_print exit "Script error: Unknown api/url format in runner_sources array. Aborting."
|
debug_print exit "Script error: Unknown api/url format in runner_sources array. Aborting."
|
||||||
fi
|
fi
|
||||||
@ -937,6 +1049,9 @@ runner_select_install() {
|
|||||||
*.tgz)
|
*.tgz)
|
||||||
runner_name="$(basename "${runner_versions[i]}" .tgz)"
|
runner_name="$(basename "${runner_versions[i]}" .tgz)"
|
||||||
;;
|
;;
|
||||||
|
*.tar.xz)
|
||||||
|
runner_name="$(basename "${runner_versions[i]}" .tar.xz)"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
debug_print exit "Unknown archive filetype in runner_select_install function. Aborting."
|
debug_print exit "Unknown archive filetype in runner_select_install function. Aborting."
|
||||||
;;
|
;;
|
||||||
@ -961,6 +1076,9 @@ runner_select_install() {
|
|||||||
menu_height="400"
|
menu_height="400"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
}
|
}
|
||||||
@ -1008,6 +1126,9 @@ runner_manage() {
|
|||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
done
|
done
|
||||||
@ -1018,6 +1139,330 @@ runner_manage() {
|
|||||||
|
|
||||||
#-------------------------- end runner functions -----------------------------#
|
#-------------------------- end runner functions -----------------------------#
|
||||||
|
|
||||||
|
#------------------------- begin dxvk functions ----------------------------#
|
||||||
|
|
||||||
|
# Delete the selected dxvk
|
||||||
|
dxvk_delete() {
|
||||||
|
# This function expects an index number for the array
|
||||||
|
# installed_dxvks to be passed in as an argument
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
debug_print exit "Script error: The dxvk_delete function expects an argument. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
dxvk_to_delete="$1"
|
||||||
|
if message question "Are you sure you want to delete the following DXVK?\n\n${installed_dxvks[$dxvk_to_delete]}"; then
|
||||||
|
rm -r "${installed_dxvks[$dxvk_to_delete]}"
|
||||||
|
debug_print continue "Deleted ${installed_dxvks[$dxvk_to_delete]}"
|
||||||
|
lutris_needs_restart="true"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# List installed dxvks for deletion
|
||||||
|
dxvk_select_delete() {
|
||||||
|
# Configure the menu
|
||||||
|
menu_text_zenity="Select the DXVK version you want to remove:"
|
||||||
|
menu_text_terminal="Select the DXVK version you want to remove:"
|
||||||
|
menu_text_height="65"
|
||||||
|
goback="Return to the DXVK management menu"
|
||||||
|
unset installed_dxvks
|
||||||
|
unset menu_options
|
||||||
|
unset menu_actions
|
||||||
|
|
||||||
|
# Create an array containing all directories in the dxvk_dir
|
||||||
|
for dxvks_list in "$dxvk_dir"/*; do
|
||||||
|
if [ -d "$dxvks_list" ]; then
|
||||||
|
installed_dxvks+=("$dxvks_list")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create menu options for the installed dxvks
|
||||||
|
for (( i=0; i<"${#installed_dxvks[@]}"; i++ )); do
|
||||||
|
menu_options+=("$(basename "${installed_dxvks[i]}")")
|
||||||
|
menu_actions+=("dxvk_delete $i")
|
||||||
|
done
|
||||||
|
|
||||||
|
# Complete the menu by adding the option to go back to the previous menu
|
||||||
|
menu_options+=("$goback")
|
||||||
|
menu_actions+=(":") # no-op
|
||||||
|
|
||||||
|
# Calculate the total height the menu should be
|
||||||
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
if [ "$menu_height" -gt "400" ]; then
|
||||||
|
menu_height="400"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
|
# Call the menu function. It will use the options as configured above
|
||||||
|
menu
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download and install the selected dxvk
|
||||||
|
# Note: The variables dxvk_versions, contributor_url, and dxvk_url_type
|
||||||
|
# are expected to be set before calling this function
|
||||||
|
dxvk_install() {
|
||||||
|
# This function expects an index number for the array
|
||||||
|
# dxvk_versions to be passed in as an argument
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
debug_print exit "Script error: The dxvk_install function expects a numerical argument. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the dxvk filename including file extension
|
||||||
|
dxvk_file="${dxvk_versions[$1]}"
|
||||||
|
|
||||||
|
# Get the selected dxvk name minus the file extension
|
||||||
|
# To add new file extensions, handle them here and in
|
||||||
|
# the dxvk_select_install function below
|
||||||
|
case "$dxvk_file" in
|
||||||
|
*.tar.gz)
|
||||||
|
dxvk_name="$(basename "$dxvk_file" .tar.gz)"
|
||||||
|
;;
|
||||||
|
*.tgz)
|
||||||
|
dxvk_name="$(basename "$dxvk_file" .tgz)"
|
||||||
|
;;
|
||||||
|
*.tar.xz)
|
||||||
|
dxvk_name="$(basename "$dxvk_file" .tar.xz)"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
debug_print exit "Unknown archive filetype in dxvk_install function. Aborting."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Get the selected dxvk url
|
||||||
|
# To add new sources, handle them here and in the
|
||||||
|
# dxvk_select_install function below
|
||||||
|
if [ "$dxvk_url_type" = "github" ]; then
|
||||||
|
dxvk_dl_url="$(curl -s "$contributor_url" | grep "browser_download_url.*$dxvk_file" | cut -d \" -f4)"
|
||||||
|
else
|
||||||
|
debug_print exit "Script error: Unknown api/url format in dxvk_sources array. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
if [ -z "$dxvk_dl_url" ]; then
|
||||||
|
message warning "Could not find the requested DXVK. The source API may be down or rate limited."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download the dxvk to the tmp directory
|
||||||
|
debug_print continue "Downloading $dxvk_dl_url into $tmp_dir/$dxvk_file..."
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
# Format the curl progress bar for zenity
|
||||||
|
mkfifo "$tmp_dir/lugpipe"
|
||||||
|
cd "$tmp_dir" && curl -#LO "$dxvk_dl_url" > "$tmp_dir/lugpipe" 2>&1 & curlpid="$!"
|
||||||
|
stdbuf -oL tr '\r' '\n' < "$tmp_dir/lugpipe" | \
|
||||||
|
grep --line-buffered -ve "100" | grep --line-buffered -o "[0-9]*\.[0-9]" | \
|
||||||
|
(
|
||||||
|
trap 'kill "$curlpid"' ERR
|
||||||
|
zenity --progress --auto-close --title="Star Citizen LUG Helper" --text="Downloading DXVK. This might take a moment.\n" 2>/dev/null
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "$?" -eq 1 ]; then
|
||||||
|
# User clicked cancel
|
||||||
|
debug_print continue "Download aborted. Removing $tmp_dir/$dxvk_file..."
|
||||||
|
rm "$tmp_dir/$dxvk_file"
|
||||||
|
rm "$tmp_dir/lugpipe"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
rm "$tmp_dir/lugpipe"
|
||||||
|
else
|
||||||
|
# Standard curl progress bar
|
||||||
|
(cd "$tmp_dir" && curl -LO "$dxvk_dl_url")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
if [ ! -f "$tmp_dir/$dxvk_file" ]; then
|
||||||
|
debug_print exit "Script error: The requested DXVK file was not downloaded. Aborting"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the path of the first item listed in the archive
|
||||||
|
# This should either be a subdirectory or the path ./
|
||||||
|
# depending on how the archive was created
|
||||||
|
first_filepath="$(stdbuf -oL tar -tf "$tmp_dir/$dxvk_file" | head -n 1)"
|
||||||
|
|
||||||
|
# Extract the dxvk
|
||||||
|
case "$first_filepath" in
|
||||||
|
# If the files in the archive begin with ./ there is no subdirectory
|
||||||
|
./*)
|
||||||
|
debug_print continue "Installing DXVK into $dxvk_dir/$dxvk_name..."
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
# Use Zenity progress bar
|
||||||
|
mkdir -p "$dxvk_dir/$dxvk_name" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir/$dxvk_name" | \
|
||||||
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing DXVK...\n" 2>/dev/null
|
||||||
|
else
|
||||||
|
mkdir -p "$dxvk_dir/$dxvk_name" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir/$dxvk_name"
|
||||||
|
fi
|
||||||
|
lutris_needs_restart="true"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# dxvks with a subdirectory in the archive
|
||||||
|
debug_print continue "Installing DXVK into $dxvk_dir..."
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
# Use Zenity progress bar
|
||||||
|
mkdir -p "$dxvk_dir" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir" | \
|
||||||
|
zenity --progress --pulsate --no-cancel --auto-close --title="Star Citizen LUG Helper" --text="Installing DXVK...\n" 2>/dev/null
|
||||||
|
else
|
||||||
|
mkdir -p "$dxvk_dir" && tar -xf "$tmp_dir/$dxvk_file" -C "$dxvk_dir"
|
||||||
|
fi
|
||||||
|
lutris_needs_restart="true"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Cleanup tmp download
|
||||||
|
debug_print continue "Removing $tmp_dir/$dxvk_file..."
|
||||||
|
rm "$tmp_dir/$dxvk_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# List available dxvks for download
|
||||||
|
dxvk_select_install() {
|
||||||
|
# This function expects an element number for the array
|
||||||
|
# dxvk_sources to be passed in as an argument
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
debug_print exit "Script error: The dxvk_select_install function expects a numerical argument. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Store info from the selected contributor
|
||||||
|
contributor_name="${dxvk_sources[$1]}"
|
||||||
|
contributor_url="${dxvk_sources[$1+1]}"
|
||||||
|
|
||||||
|
# Check the provided contributor url to make sure we know how to handle it
|
||||||
|
# To add new sources, add them here and handle in the if statement
|
||||||
|
# just below and the dxvk_install function above
|
||||||
|
case "$contributor_url" in
|
||||||
|
https://api.github.com*)
|
||||||
|
dxvk_url_type="github"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
debug_print exit "Script error: Unknown api/url format in dxvk_sources array. Aborting."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Fetch a list of dxvk versions from the selected contributor
|
||||||
|
# To add new sources, handle them here, in the if statement
|
||||||
|
# just above, and the dxvk_install function above
|
||||||
|
if [ "$dxvk_url_type" = "github" ]; then
|
||||||
|
dxvk_versions=($(curl -s "$contributor_url" | awk '/browser_download_url/ {print $2}' | grep -vE "*.sha512sum" | xargs basename -a))
|
||||||
|
else
|
||||||
|
debug_print exit "Script error: Unknown api/url format in dxvk_sources array. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
if [ "${#dxvk_versions[@]}" -eq 0 ]; then
|
||||||
|
message warning "No DXVK versions were found. The source API may be down or rate limited."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure the menu
|
||||||
|
menu_text_zenity="Select the DXVK version you want to install:"
|
||||||
|
menu_text_terminal="Select the DXVK version you want to install:"
|
||||||
|
menu_text_height="65"
|
||||||
|
goback="Return to the DXVK management menu"
|
||||||
|
unset menu_options
|
||||||
|
unset menu_actions
|
||||||
|
|
||||||
|
# Iterate through the versions, check if they are installed,
|
||||||
|
# and add them to the menu options
|
||||||
|
# To add new file extensions, handle them here and in
|
||||||
|
# the dxvk_install function above
|
||||||
|
for (( i=0; i<"$max_dxvks" && i<"${#dxvk_versions[@]}"; i++ )); do
|
||||||
|
# Get the dxvk name minus the file extension
|
||||||
|
case "${dxvk_versions[i]}" in
|
||||||
|
*.tar.gz)
|
||||||
|
dxvk_name="$(basename "${dxvk_versions[i]}" .tar.gz)"
|
||||||
|
;;
|
||||||
|
*.tgz)
|
||||||
|
dxvk_name="$(basename "${dxvk_versions[i]}" .tgz)"
|
||||||
|
;;
|
||||||
|
*.tar.xz)
|
||||||
|
dxvk_name="$(basename "${dxvk_versions[i]}" .tar.xz)"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
debug_print exit "Unknown archive filetype in dxvk_select_install function. Aborting."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Add the dxvk names to the menu
|
||||||
|
if [ -d "$dxvk_dir/$dxvk_name" ]; then
|
||||||
|
menu_options+=("$dxvk_name [installed]")
|
||||||
|
else
|
||||||
|
menu_options+=("$dxvk_name")
|
||||||
|
fi
|
||||||
|
menu_actions+=("dxvk_install $i")
|
||||||
|
done
|
||||||
|
|
||||||
|
# Complete the menu by adding the option to go back to the previous menu
|
||||||
|
menu_options+=("$goback")
|
||||||
|
menu_actions+=(":") # no-op
|
||||||
|
|
||||||
|
# Calculate the total height the menu should be
|
||||||
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
if [ "$menu_height" -gt "400" ]; then
|
||||||
|
menu_height="400"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
|
# Call the menu function. It will use the options as configured above
|
||||||
|
menu
|
||||||
|
}
|
||||||
|
|
||||||
|
# Manage Lutris dxvks
|
||||||
|
dxvk_manage() {
|
||||||
|
# Check if Lutris is installed
|
||||||
|
if [ ! -x "$(command -v lutris)" ]; then
|
||||||
|
message info "Lutris does not appear to be installed."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if [ ! -d "$dxvk_dir" ]; then
|
||||||
|
message info "Lutris DXVK directory not found. Unable to continue.\n\n$dxvk_dir"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The dxvk management menu will loop until the user cancels
|
||||||
|
looping_menu="true"
|
||||||
|
while [ "$looping_menu" = "true" ]; do
|
||||||
|
# Configure the menu
|
||||||
|
menu_text_zenity="<b><big>Manage Your DXVK Versions</big>\n\nThe DXVK versions below may help improve game performance</b>\n\nYou may choose from the following options:"
|
||||||
|
menu_text_terminal="Manage Your DXVK Versions\n\nThe DXVK versions below may help improve game performance\nYou may choose from the following options:"
|
||||||
|
menu_text_height="140"
|
||||||
|
|
||||||
|
# Configure the menu options
|
||||||
|
delete="Remove an installed DXVK"
|
||||||
|
back="Return to the main menu"
|
||||||
|
unset menu_options
|
||||||
|
unset menu_actions
|
||||||
|
|
||||||
|
# Loop through the dxvk_sources array and create a menu item
|
||||||
|
# for each one. Even numbered elements will contain the dxvk name
|
||||||
|
for (( i=0; i<"${#dxvk_sources[@]}"; i=i+2 )); do
|
||||||
|
# Set the options to be displayed in the menu
|
||||||
|
menu_options+=("Install a DXVK from ${dxvk_sources[i]}")
|
||||||
|
# Set the corresponding functions to be called for each of the options
|
||||||
|
menu_actions+=("dxvk_select_install $i")
|
||||||
|
done
|
||||||
|
|
||||||
|
# Complete the menu by adding options to remove a dxvk
|
||||||
|
# or go back to the previous menu
|
||||||
|
menu_options+=("$delete" "$back")
|
||||||
|
menu_actions+=("dxvk_select_delete" "menu_loop_done")
|
||||||
|
|
||||||
|
# Calculate the total height the menu should be
|
||||||
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
|
# Call the menu function. It will use the options as configured above
|
||||||
|
menu
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if lutris needs to be restarted after making changes
|
||||||
|
lutris_restart
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------- end dxvk functions -----------------------------#
|
||||||
|
|
||||||
# Check that the system is optimized for Star Citizen
|
# Check that the system is optimized for Star Citizen
|
||||||
preflight_check() {
|
preflight_check() {
|
||||||
# Initialize variables
|
# Initialize variables
|
||||||
@ -1031,6 +1476,7 @@ preflight_check() {
|
|||||||
|
|
||||||
# Call the optimization functions to perform the checks
|
# Call the optimization functions to perform the checks
|
||||||
memory_check
|
memory_check
|
||||||
|
avx_check
|
||||||
mapcount_check
|
mapcount_check
|
||||||
filelimit_check
|
filelimit_check
|
||||||
|
|
||||||
@ -1065,7 +1511,13 @@ preflight_check() {
|
|||||||
|
|
||||||
# Display the results of the preflight check
|
# Display the results of the preflight check
|
||||||
if [ -z "$preflight_fail_string" ]; then
|
if [ -z "$preflight_fail_string" ]; then
|
||||||
message info "Preflight Check Complete\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string"
|
# Formatting
|
||||||
|
message_heading="Preflight Check Complete"
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
message_heading="<b>$message_heading</b>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
message info "$message_heading\n\nYour system is optimized for Star Citizen!\n\n$preflight_pass_string"
|
||||||
else
|
else
|
||||||
if [ -z "$preflight_action_funcs" ]; then
|
if [ -z "$preflight_action_funcs" ]; then
|
||||||
message warning "$preflight_pass_string$preflight_fail_string"
|
message warning "$preflight_pass_string$preflight_fail_string"
|
||||||
@ -1134,17 +1586,21 @@ maintenance_menu() {
|
|||||||
sanitize_msg="Delete my Star Citizen USER folder and preserve my keybinds"
|
sanitize_msg="Delete my Star Citizen USER folder and preserve my keybinds"
|
||||||
shaders_msg="Delete my shaders folder only (Do this after each game update)"
|
shaders_msg="Delete my shaders folder only (Do this after each game update)"
|
||||||
vidcache_msg="Delete my DXVK cache"
|
vidcache_msg="Delete my DXVK cache"
|
||||||
|
dirs_msg="Display Helper and Star Citizen directories"
|
||||||
reset_msg="Reset Helper configs"
|
reset_msg="Reset Helper configs"
|
||||||
quit_msg="Return to the main menu"
|
quit_msg="Return to the main menu"
|
||||||
|
|
||||||
# Set the options to be displayed in the menu
|
# Set the options to be displayed in the menu
|
||||||
menu_options=("$version_msg" "$sanitize_msg" "$shaders_msg" "$vidcache_msg" "$reset_msg" "$quit_msg")
|
menu_options=("$version_msg" "$sanitize_msg" "$shaders_msg" "$vidcache_msg" "$dirs_msg" "$reset_msg" "$quit_msg")
|
||||||
# Set the corresponding functions to be called for each of the options
|
# Set the corresponding functions to be called for each of the options
|
||||||
menu_actions=("set_version" "sanitize" "rm_shaders" "rm_dxvkcache" "reset_helper" "menu_loop_done")
|
menu_actions=("set_version" "sanitize" "rm_shaders" "rm_dxvkcache" "display_dirs" "reset_helper" "menu_loop_done")
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Go Back"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
done
|
done
|
||||||
@ -1153,7 +1609,7 @@ maintenance_menu() {
|
|||||||
# Get a random Penguin's Star Citizen referral code
|
# Get a random Penguin's Star Citizen referral code
|
||||||
referral_randomizer() {
|
referral_randomizer() {
|
||||||
# Populate the referral codes array
|
# Populate the referral codes array
|
||||||
referral_codes=("STAR-4TZD-6KMM" "STAR-4XM2-VM99" "STAR-2NPY-FCR2" "STAR-T9Z9-7W6P" "STAR-VLBF-W2QR" "STAR-BYR6-YHMF" "STAR-3X2H-VZMX" "STAR-BRWN-FB9T" "STAR-FG6Y-N4Q4" "STAR-VLD6-VZRG" "STAR-T9KF-LV77" "STAR-4XHB-R7RF" "STAR-9NVF-MRN7" "STAR-3Q4W-9TC3" "STAR-3SBK-7QTT" "STAR-XFBT-9TTK" "STAR-F3H9-YPHN" "STAR-BYK6-RCCL" "STAR-XCKH-W6T7" "STAR-H292-39WK" "STAR-ZRT5-PJB7" "STAR-GMBP-SH9Y" "STAR-PLWB-LMFY")
|
referral_codes=("STAR-4TZD-6KMM" "STAR-4XM2-VM99" "STAR-2NPY-FCR2" "STAR-T9Z9-7W6P" "STAR-VLBF-W2QR" "STAR-BYR6-YHMF" "STAR-3X2H-VZMX" "STAR-BRWN-FB9T" "STAR-FG6Y-N4Q4" "STAR-VLD6-VZRG" "STAR-T9KF-LV77" "STAR-4XHB-R7RF" "STAR-9NVF-MRN7" "STAR-3Q4W-9TC3" "STAR-3SBK-7QTT" "STAR-XFBT-9TTK" "STAR-F3H9-YPHN" "STAR-BYK6-RCCL" "STAR-XCKH-W6T7" "STAR-H292-39WK" "STAR-ZRT5-PJB7" "STAR-GMBP-SH9Y" "STAR-PLWB-LMFY" "STAR-TNZN-H4ZT" "STAR-T5G5-L2GJ" "STAR-6TPV-7QH2" "STAR-THHD-TV3Y" "STAR-7ZFS-PK2L" "STAR-SRQN-43TB" "STAR-9TDG-D4H9" "STAR-BPH3-THJC" "STAR-HL3M-R5KC" "STAR-GBS5-LTVB" "STAR-CJ3Y-KZZ4" "STAR-5GRM-7HBY" "STAR-G2GX-Y2QJ" "STAR-YWY3-H4XX" "STAR-6VGM-PTKC" "STAR-T6MZ-QFHX" "STAR-T2K6-LXFW" "STAR-XN25-9CJJ" "STAR-47V3-4QGB")
|
||||||
# Pick a random array element. Scale a floating point number for
|
# Pick a random array element. Scale a floating point number for
|
||||||
# a more random distribution than simply calling RANDOM
|
# a more random distribution than simply calling RANDOM
|
||||||
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
|
random_code="${referral_codes[$(awk '{srand($2); print int(rand()*$1)}' <<< "${#referral_codes[@]} $RANDOM")]}"
|
||||||
@ -1163,15 +1619,15 @@ referral_randomizer() {
|
|||||||
|
|
||||||
# Toggle between the LIVE and PTU game directories for all Helper functions
|
# Toggle between the LIVE and PTU game directories for all Helper functions
|
||||||
set_version() {
|
set_version() {
|
||||||
if [ "$live_or_ptu" = "LIVE" ]; then
|
if [ "$live_or_ptu" = "$live_dir" ]; then
|
||||||
live_or_ptu="PTU"
|
live_or_ptu="$ptu_dir"
|
||||||
message info "The Helper will now target your Star Citizen PTU installation."
|
message info "The Helper will now target your Star Citizen PTU installation."
|
||||||
elif [ "$live_or_ptu" = "PTU" ]; then
|
elif [ "$live_or_ptu" = "$ptu_dir" ]; then
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
message info "The Helper will now target your Star Citizen LIVE installation."
|
message info "The Helper will now target your Star Citizen LIVE installation."
|
||||||
else
|
else
|
||||||
debug_print continue "Unexpected game version provided. Defaulting to the LIVE installation."
|
debug_print continue "Unexpected game version provided. Defaulting to the LIVE installation."
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1185,6 +1641,19 @@ reset_helper() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get the latest release version of a repo. Expects "user/repo_name" as input
|
||||||
|
# Credits for this go to https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
|
||||||
|
get_latest_release() {
|
||||||
|
# Sanity check
|
||||||
|
if [ "$#" -lt 1 ]; then
|
||||||
|
debug_print exit "Script error: The get_latest_release function expects one argument. Aborting."
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
|
||||||
|
grep '"tag_name":' | # Get tag line
|
||||||
|
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
|
||||||
|
}
|
||||||
|
|
||||||
quit() {
|
quit() {
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
@ -1201,9 +1670,22 @@ if [ -x "$(command -v zenity)" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set some defaults
|
# Set some defaults
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
lutris_needs_restart="false"
|
lutris_needs_restart="false"
|
||||||
|
|
||||||
|
# Check if a newer verison of the script is available
|
||||||
|
latest_version="$(get_latest_release "$repo")"
|
||||||
|
|
||||||
|
if [ "$latest_version" != "$current_version" ]; then
|
||||||
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
|
releases_url_formatted="<a href='$releases_url'>$releases_url</a>"
|
||||||
|
else
|
||||||
|
releases_url_formatted="$releases_url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
message info "The latest version of the LUG Helper is $latest_version\nYou are using $current_version\n\nYou can download new releases here:\n$releases_url_formatted"
|
||||||
|
fi
|
||||||
|
|
||||||
# If invoked with command line arguments, process them and exit
|
# If invoked with command line arguments, process them and exit
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
@ -1219,8 +1701,9 @@ Usage: lug-helper <options>
|
|||||||
-s, --delete-shaders Delete Star Citizen shaders directory
|
-s, --delete-shaders Delete Star Citizen shaders directory
|
||||||
-c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
|
-c, --delete-dxvk-cache Delete Star Citizen dxvk cache file
|
||||||
-t, --target=[live|ptu] Target LIVE or PTU (default live)
|
-t, --target=[live|ptu] Target LIVE or PTU (default live)
|
||||||
-g, --use-gui=[yes|no] Use Zenity GUI (default yes)
|
-g, --use-gui=[yes|no] Use Zenity GUI if available (default yes)
|
||||||
-r, --get-referral Get a random LUG member's Star Citizen referral code
|
-r, --get-referral Get a random LUG member's Star Citizen referral code
|
||||||
|
-d, --show-directories Show all Star Citizen and LUG Helper directories
|
||||||
-x, --reset-helper Delete saved lug-helper configs
|
-x, --reset-helper Delete saved lug-helper configs
|
||||||
"
|
"
|
||||||
exit 0
|
exit 0
|
||||||
@ -1243,9 +1726,9 @@ Usage: lug-helper <options>
|
|||||||
--target=* | -t=* )
|
--target=* | -t=* )
|
||||||
live_or_ptu="$(echo "$1" | cut -d'=' -f2)"
|
live_or_ptu="$(echo "$1" | cut -d'=' -f2)"
|
||||||
if [ "$live_or_ptu" = "live" ] || [ "$live_or_ptu" = "LIVE" ]; then
|
if [ "$live_or_ptu" = "live" ] || [ "$live_or_ptu" = "LIVE" ]; then
|
||||||
live_or_ptu="LIVE"
|
live_or_ptu="$live_dir"
|
||||||
elif [ "$live_or_ptu" = "ptu" ] || [ "$live_or_ptu" = "PTU" ]; then
|
elif [ "$live_or_ptu" = "ptu" ] || [ "$live_or_ptu" = "PTU" ]; then
|
||||||
live_or_ptu="PTU"
|
live_or_ptu="$ptu_dir"
|
||||||
else
|
else
|
||||||
printf "$0: Invalid option '$1'\n"
|
printf "$0: Invalid option '$1'\n"
|
||||||
exit 0
|
exit 0
|
||||||
@ -1269,6 +1752,9 @@ Usage: lug-helper <options>
|
|||||||
--get-referral | -r )
|
--get-referral | -r )
|
||||||
cargs+=("referral_randomizer")
|
cargs+=("referral_randomizer")
|
||||||
;;
|
;;
|
||||||
|
--show-directories | -d )
|
||||||
|
cargs+=("display_dirs")
|
||||||
|
;;
|
||||||
--reset-helper | -x )
|
--reset-helper | -x )
|
||||||
cargs+=("reset_helper")
|
cargs+=("reset_helper")
|
||||||
;;
|
;;
|
||||||
@ -1300,18 +1786,22 @@ while true; do
|
|||||||
# Configure the menu options
|
# Configure the menu options
|
||||||
preflight_msg="Preflight Check (System Optimization)"
|
preflight_msg="Preflight Check (System Optimization)"
|
||||||
runners_msg="Manage Lutris Runners"
|
runners_msg="Manage Lutris Runners"
|
||||||
maintenance_msg="User Folder Maintenance and Troubleshooting"
|
dxvk_msg="Manage DXVK Versions"
|
||||||
|
maintenance_msg="Maintenance and Troubleshooting"
|
||||||
randomizer_msg="Get a random Penguin's Star Citizen referral code"
|
randomizer_msg="Get a random Penguin's Star Citizen referral code"
|
||||||
quit_msg="Quit"
|
quit_msg="Quit"
|
||||||
|
|
||||||
# Set the options to be displayed in the menu
|
# Set the options to be displayed in the menu
|
||||||
menu_options=("$preflight_msg" "$runners_msg" "$maintenance_msg" "$randomizer_msg" "$quit_msg")
|
menu_options=("$preflight_msg" "$runners_msg" "$dxvk_msg" "$maintenance_msg" "$randomizer_msg" "$quit_msg")
|
||||||
# Set the corresponding functions to be called for each of the options
|
# Set the corresponding functions to be called for each of the options
|
||||||
menu_actions=("preflight_check" "runner_manage" "maintenance_menu" "referral_randomizer" "quit")
|
menu_actions=("preflight_check" "runner_manage" "dxvk_manage" "maintenance_menu" "referral_randomizer" "quit")
|
||||||
|
|
||||||
# Calculate the total height the menu should be
|
# Calculate the total height the menu should be
|
||||||
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
menu_height="$(($menu_option_height * ${#menu_options[@]} + $menu_text_height))"
|
||||||
|
|
||||||
|
# Set the label for the cancel button
|
||||||
|
cancel_label="Quit"
|
||||||
|
|
||||||
# Call the menu function. It will use the options as configured above
|
# Call the menu function. It will use the options as configured above
|
||||||
menu
|
menu
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user