mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-13 22:00:34 +00:00
commit
086ffd15f0
170
lug-helper.sh
170
lug-helper.sh
@ -144,7 +144,11 @@ eptu_dir="EPTU"
|
||||
appdata_path="drive_c/users/$USER/AppData/Local/Star Citizen"
|
||||
|
||||
# The shaders subdirectory name
|
||||
shaders_subdir="shaders"
|
||||
shaders_subdirs=(
|
||||
"shaders"
|
||||
"Shaders"
|
||||
"VulkanShaderCache"
|
||||
)
|
||||
|
||||
# Remaining directory paths are set at the end of the getdirs() function
|
||||
|
||||
@ -679,11 +683,18 @@ getdirs() {
|
||||
# $game_version is set in the version_menu() function
|
||||
############################################################################
|
||||
# The game's user directory
|
||||
user_dir="$game_path/$game_version/USER/Client/0"
|
||||
if [ -d "$game_path/$game_version/USER/Client" ]; then
|
||||
# Backwards compatibility for older installs
|
||||
user_dir="$game_path/$game_version/USER/Client/0"
|
||||
else
|
||||
user_dir="$game_path/$game_version/user/client/0"
|
||||
fi
|
||||
# The location within the USER directory to which the game exports keybinds
|
||||
keybinds_dir="$user_dir/Controls/Mappings"
|
||||
# Shaders directory
|
||||
shaders_dir="$wine_prefix/$appdata_path"
|
||||
# Custom characters directory
|
||||
custom_characters_dir="$user_dir/CustomCharacters"
|
||||
# dxvk cache file
|
||||
dxvk_cache="$game_path/$game_version/StarCitizen.dxvk-cache"
|
||||
# Where to store backed up keybinds
|
||||
@ -2023,7 +2034,7 @@ version_menu(){
|
||||
# Save exported keybinds, wipe the USER directory, and restore keybinds
|
||||
rm_userdir() {
|
||||
# Prompt user to back up the current keybinds in the game
|
||||
message info "Before proceeding, please be sure you have exported\nyour Star Citizen keybinds from within the game.\n\nTo do this, launch the game and go to:\nOptions->Keybindings->Control Profiles->Save Control Settings\n\nGo on; I'll wait."
|
||||
message info "Before proceeding, please be sure you have exported your Star Citizen keybinds and characters from within the game.\n\nTo export keybinds, launch the game and go to:\nOptions->Keybindings->Control Profiles->Save Control Settings\n\nTo export your character, go to the character creator from the main menu and save it with a name.\n\nGo on; I'll wait."
|
||||
|
||||
# Get/Set directory paths
|
||||
getdirs
|
||||
@ -2035,41 +2046,64 @@ rm_userdir() {
|
||||
|
||||
# Sanity check
|
||||
if [ ! -d "$user_dir" ]; then
|
||||
message warning "USER directory not found. There is nothing to delete!\n\n$user_dir"
|
||||
message warning "user directory not found. There is nothing to delete!\n\n$user_dir"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check for exported keybind files
|
||||
if [ ! -d "$keybinds_dir" ] || [ -z "$(ls -A "$keybinds_dir")" ]; then
|
||||
if message question "Warning: No exported keybindings found.\nContinuing will erase your existing keybinds!\n\nDo you want to continue anyway?"; then
|
||||
exported=0
|
||||
keybinds_exported=0
|
||||
else
|
||||
# User said no
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
exported=1
|
||||
keybinds_exported=1
|
||||
fi
|
||||
|
||||
# Check for saved custom character files
|
||||
if [ ! -d "$custom_characters_dir" ] || [ -z "$(ls -A "$custom_characters_dir")" ]; then
|
||||
if message question "Warning: No saved characters found.\nContinuing will erase your existing character!\n\nDo you want to continue anyway?"; then
|
||||
characters_exported=0
|
||||
else
|
||||
# User said no
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
characters_exported=1
|
||||
fi
|
||||
|
||||
if message question "The following directory will be deleted:\n\n$user_dir\n\nDo you want to proceed?"; then
|
||||
# Back up keybinds
|
||||
if [ "$exported" -eq 1 ]; then
|
||||
if [ "$keybinds_exported" -eq 1 ]; then
|
||||
debug_print continue "Backing up keybinds to $backup_path/keybinds..."
|
||||
mkdir -p "$backup_path/keybinds" && cp -r "$keybinds_dir/." "$backup_path/keybinds/"
|
||||
fi
|
||||
|
||||
# Wipe the user directory
|
||||
debug_print continue "Wiping $user_dir..."
|
||||
rm -r "$user_dir"
|
||||
|
||||
# Restore custom keybinds
|
||||
if [ "$exported" -eq 1 ]; then
|
||||
debug_print continue "Restoring keybinds..."
|
||||
mkdir -p "$keybinds_dir" && cp -r "$backup_path/keybinds/." "$keybinds_dir/"
|
||||
message info "To re-import your keybinds, select it in-game from the list:\nOptions->Keybindings->Control Profiles"
|
||||
#Back up characters
|
||||
if [ "$characters_exported" -eq 1 ]; then
|
||||
debug_print continue "Backing up characters to $backup_path/CustomCharacters..."
|
||||
mkdir -p "$backup_path/CustomCharacters" && cp -r "$custom_characters_dir/." "$backup_path/CustomCharacters/"
|
||||
fi
|
||||
|
||||
message info "Your Star Citizen USER directory has been cleaned up!"
|
||||
# Wipe the user directory
|
||||
debug_print continue "Wiping $user_dir..."
|
||||
rm -r --interactive=never "$user_dir"
|
||||
|
||||
# Restore custom keybinds
|
||||
if [ "$keybinds_exported" -eq 1 ]; then
|
||||
debug_print continue "Restoring keybinds..."
|
||||
mkdir -p "$keybinds_dir" && cp -r "$backup_path/keybinds/." "$keybinds_dir/"
|
||||
fi
|
||||
|
||||
# Restore custom characters
|
||||
if [ "$characters_exported" -eq 1 ]; then
|
||||
debug_print continue "Restoring custom characters..."
|
||||
mkdir -p "$custom_characters_dir" && cp -r "$backup_path/CustomCharacters/." "$custom_characters_dir/"
|
||||
fi
|
||||
|
||||
message info "Your Star Citizen USER directory has been cleaned up!\n\nExported keybinds can be re-imported in-game from:\nOptions->Keybindings->Control Profiles\n\nSaved characters can be selected in the character creator."
|
||||
fi
|
||||
}
|
||||
|
||||
@ -2084,13 +2118,18 @@ rm_shaders() {
|
||||
|
||||
# Loop through all possible shader directories
|
||||
for appdata_dir in "$shaders_dir"/*; do
|
||||
if [ -d "$appdata_dir/$shaders_subdir" ]; then
|
||||
# If a shaders directory is found, delete it
|
||||
if message question "The following directory will be deleted:\n\n$appdata_dir/$shaders_subdir\n\nDo you want to proceed?"; then
|
||||
debug_print continue "Deleting $appdata_dir/$shaders_subdir..."
|
||||
rm -r "${appdata_dir:?}/$shaders_subdir"
|
||||
# Loop through the shaders subdir array
|
||||
for shaders_subdir in "${shaders_subdirs[@]}"; do
|
||||
if [ -d "$appdata_dir/$shaders_subdir" ]; then
|
||||
# If a shaders directory is found, delete it
|
||||
if message question "The following directory will be deleted:\n\n$appdata_dir/$shaders_subdir\n\nDo you want to proceed?"; then
|
||||
debug_print continue "Deleting $appdata_dir/$shaders_subdir..."
|
||||
rm -r --interactive=never "${appdata_dir:?}/$shaders_subdir"
|
||||
fi
|
||||
else
|
||||
debug_print continue "skipping $appdata_dir/$shaders_subdir"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
message info "Shader operations completed"
|
||||
@ -2207,18 +2246,17 @@ maintenance_menu() {
|
||||
|
||||
# Configure the menu options
|
||||
version_msg="Switch the Helper between LIVE/PTU/EPTU (Currently: $game_version)"
|
||||
userdir_msg="Delete my Star Citizen USER folder and preserve my keybinds"
|
||||
userdir_msg="Delete my user folder and preserve keybinds/characters"
|
||||
shaders_msg="Delete my shaders (Do this after each game update)"
|
||||
vidcache_msg="Delete my DXVK cache"
|
||||
eac_msg="Deploy Global Easy Anti-Cheat Workaround"
|
||||
dirs_msg="Display Helper and Star Citizen directories"
|
||||
reset_msg="Reset Helper configs"
|
||||
quit_msg="Return to the main menu"
|
||||
|
||||
# Set the options to be displayed in the menu
|
||||
menu_options=("$version_msg" "$userdir_msg" "$shaders_msg" "$vidcache_msg" "$eac_msg" "$dirs_msg" "$reset_msg" "$quit_msg")
|
||||
menu_options=("$version_msg" "$userdir_msg" "$shaders_msg" "$vidcache_msg" "$dirs_msg" "$reset_msg" "$quit_msg")
|
||||
# Set the corresponding functions to be called for each of the options
|
||||
menu_actions=("version_menu" "rm_userdir" "rm_shaders" "rm_dxvkcache" "eac_workaround" "display_dirs" "reset_helper" "menu_loop_done")
|
||||
menu_actions=("version_menu" "rm_userdir" "rm_shaders" "rm_dxvkcache" "display_dirs" "reset_helper" "menu_loop_done")
|
||||
|
||||
# Calculate the total height the menu should be
|
||||
# menu_option_height = pixels per menu option
|
||||
@ -2290,80 +2328,6 @@ install_game() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Deploy Easy Anti-Cheat Workaround
|
||||
eac_workaround() {
|
||||
# Get/set directory paths
|
||||
getdirs
|
||||
if [ "$?" -eq 1 ]; then
|
||||
# User cancelled and wants to return to the main menu
|
||||
# or there was an error
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Set the EAC directory path and hosts modification
|
||||
eac_dir="$wine_prefix/drive_c/users/$USER/AppData/Roaming/EasyAntiCheat"
|
||||
eac_hosts="127.0.0.1 modules-cdn.eac-prod.on.epicgames.com"
|
||||
|
||||
# Configure message variables
|
||||
eac_title="Easy Anti-Cheat Workaround"
|
||||
eac_hosts_formatted="$eac_hosts"
|
||||
eac_dir_formatted="$eac_dir"
|
||||
if [ "$use_zenity" -eq 1 ]; then
|
||||
eac_title="<b>$eac_title</b>"
|
||||
eac_hosts_formatted="<i>$eac_hosts_formatted</i>"
|
||||
eac_dir_formatted="<i>$eac_dir_formatted</i>"
|
||||
fi
|
||||
|
||||
apply_eac_hosts="false"
|
||||
delete_eac_dir="false"
|
||||
if grep -q "^$eac_hosts" /etc/hosts; then
|
||||
# Hosts workaround is in place
|
||||
# Check if we still need to delete the eac directory
|
||||
if [ -d "$eac_dir" ]; then
|
||||
delete_eac_dir="true"
|
||||
eac_message="$eac_title\n\nYour /etc/hosts is already modified with the Easy Anti-Cheat workaround.\n\nThe following directory must still be deleted:\n$eac_dir_formatted"
|
||||
fi
|
||||
else
|
||||
# Hosts workaround is needed
|
||||
apply_eac_hosts="true"
|
||||
eac_message="$eac_title\n\nThe following entry will be added to /etc/hosts:\n$eac_hosts_formatted"
|
||||
# Check if we also need to delete the eac directory
|
||||
if [ -d "$eac_dir" ]; then
|
||||
delete_eac_dir="true"
|
||||
eac_message="$eac_message\n\nThe following directory will be deleted:\n$eac_dir_formatted"
|
||||
fi
|
||||
fi
|
||||
# Finish up the message
|
||||
eac_message="$eac_message\n\n\nTo revert these changes, delete the marked EAC workaround line\nin /etc/hosts and relaunch the game\n\nDo you want to proceed?"
|
||||
|
||||
# Check if the EAC workaround has already been fully applied
|
||||
if [ "$apply_eac_hosts" = "false" ] && [ "$delete_eac_dir" = "false" ]; then
|
||||
message info "The Easy Anti-Cheat workaround has already been applied.\nYou're all set!"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if message question "$eac_message"; then
|
||||
# Apply the hosts workaround if needed
|
||||
if [ "$apply_eac_hosts" = "true" ]; then
|
||||
debug_print continue "Editing hosts file..."
|
||||
# Try to modify /etc/hosts as root
|
||||
try_exec "printf '\n$eac_hosts #Star Citizen EAC workaround\n' >> /etc/hosts"
|
||||
if [ "$?" -eq 1 ]; then
|
||||
message error "Authentication failed or there was an error modifying /etc/hosts.\nSee terminal for more information.\n\nReturning to main menu."
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Delete the EAC directory if it exists
|
||||
if [ -d "$eac_dir" ]; then
|
||||
debug_print continue "Deleting $eac_dir..."
|
||||
rm -r "$eac_dir"
|
||||
fi
|
||||
|
||||
message info "Easy Anti-Cheat workaround has been deployed!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Format some URLs for Zenity
|
||||
format_urls() {
|
||||
if [ "$use_zenity" -eq 1 ]; then
|
||||
@ -2476,7 +2440,6 @@ if [ "$#" -gt 0 ]; then
|
||||
Usage: lug-helper <options>
|
||||
-p, --preflight-check Run system optimization checks
|
||||
-i, --install Install Star Citizen
|
||||
-e, --eac Deploy Easy Anti-Cheat Workaround
|
||||
-m, --manage-runners Install or remove Lutris runners
|
||||
-k, --manage-dxvk Install or remove DXVK versions
|
||||
-u, --delete-user-folder Delete Star Citizen USER dir, preserve keybinds
|
||||
@ -2498,9 +2461,6 @@ Usage: lug-helper <options>
|
||||
--install | -i )
|
||||
cargs+=("install_game")
|
||||
;;
|
||||
--eac | -e )
|
||||
cargs+=("eac_workaround")
|
||||
;;
|
||||
--manage-runners | -m )
|
||||
cargs+=("runner_manage")
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user