This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ApexCacheDownloader
86 lines (77 loc) · 4.57 KB
/
ApexCacheDownloader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
SCRIPT_NAME=$(basename "$0")
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-$0}")" &>/dev/null && pwd 2>/dev/null)"
LOCATIONFILEDIR=~/.config/apexcachelauncher
{ CACHE_DIR=$(<"$LOCATIONFILEDIR"/location); } 2>/dev/null
if [ ! -f "$LOCATIONFILEDIR"/location ]; then
echo "Finding a directory for suggestion.. This may take a few moments."$'\n'
CACHE_FIND="$(find / -type d -path "*steamapps/shadercache/1172470/DXVK_state_cache" -print 2>/dev/null)"
while true; do
read -p "Do you wish to use the suggested directory as your Apex Legend cache directory? '$CACHE_FIND' Y/y - Suggested, N/n - Manual | " yn ## Try to provide accurate directory of cache file.
case $yn in
[Yy]*)
mkdir -p "$LOCATIONFILEDIR"
echo "$CACHE_FIND" >"$LOCATIONFILEDIR"/location
echo ""
echo "To change this, delete or edit the 'location' file located at '"$LOCATIONFILEDIR"/location'."$'\n'
echo "This script will now exit. Run again to start the download/merge process."
exit
;;
[Nn]*)
echo "This script will only work if the full path ends with 'DXVK_state_cache' as the final directory."$'\n'
echo "Enter your full path for the cache directory:"
read ALCPATH
mkdir -p "$LOCATIONFILEDIR"
echo "$ALCPATH" >"$LOCATIONFILEDIR"/location
echo ""
echo "Path set as: '$ALCPATH'"$'\n'
echo "To change this, delete or edit the 'location' file located at '"$LOCATIONFILEDIR"/location'."$'\n'
echo "This script will now exit. Run again to start the download/merge process."
sleep 2
exit
;;
*) echo "Please answer Y|y for yes or N|n for no. Press Ctrl+C to exit.." ;;
esac
done
{ CACHE_DIR=$(<"$LOCATIONFILEDIR"/location); } 2>/dev/null
else
if [[ "$CACHE_DIR" = */DXVK_state_cache ]]; then
wget https://github.com/bcook254/apex-legends-cache/raw/main/r5apex.dxvk-cache -O "$CACHE_DIR"/r5apex.new.dxvk-cache ## Download new cache file
if [ ! -f "$CACHE_DIR"/dxvk-cache-tool ]; then ## Check if the cache tool is installed
echo "Merger tool not found. Downloading..."
wget https://github.com/DarkTigrus/dxvk-cache-tool/releases/download/v1.1.2/dxvk-cache-tool -O "$CACHE_DIR"/dxvk-cache-tool ## Download dxvk-cache-tool
chmod +x "$CACHE_DIR"/dxvk-cache-tool ## Make dxvk-cache-tool executable
notify-send "Installed DXVK State Cache Tool" "Cache tool was not found, installed from GitHub."
else
echo "Merger tool found."
fi
if [ ! -f "$CACHE_DIR"/r5apex.dxvk-cache ]; then ## Check if a cache exists
echo "Cache file does not exist. Adding..."
mv "$CACHE_DIR"/r5apex.new.dxvk-cache "$CACHE_DIR"/r5apex.dxvk-cache ## Rename "Add" cache file.
notify-send "Installed Apex Legends DXVK State Cache" "DXVK Cache was not found, installed from GitHub."
else
echo "Cache file found. Merging..."
mv "$CACHE_DIR"/r5apex.dxvk-cache "$CACHE_DIR"/r5apex.old.dxvk-cache ## Rename Old Cache File
"$CACHE_DIR"/dxvk-cache-tool "$CACHE_DIR"/r5apex.new.dxvk-cache "$CACHE_DIR"/r5apex.old.dxvk-cache -o "$CACHE_DIR"/r5apex.dxvk-cache ## Merge cache files
rm "$CACHE_DIR"/r5apex.new.dxvk-cache "$CACHE_DIR"/r5apex.old.dxvk-cache ## Remove old cache files
notify-send "Merged Apex Legends DXVK State Cache" "Downloaded and Merged DXVK Cache."
fi
echo "Apex Legends cache has merged."
while true; do
read -p "Would you like to launch Apex Legends? (Yy/Nn)" yn ## Ask user if they want to launch Apex Legends
case $yn in
[Yy]*)
nohup steam steam://rungameid/1172470 &>/dev/null & ## Launch Apex Legends via Steam
exit
;;
[Nn]*)
exit
;;
*) echo "Please answer Y|y for yes or N|n for no." ;; ## Must have answer.
esac
done
else
echo "You did not supply a full path with a 'DXVK_state_cache' directory. Please delete/edit the 'location' file located at '"$LOCATIONFILEDIR"/location' and try again." ## Warn user to edit the location variable file and change to the proper location.
exit
fi
fi