summaryrefslogtreecommitdiff
path: root/defaults/assets/prepare.sh
diff options
context:
space:
mode:
authorGrimbakor <davidstur@gmail.com>2025-01-30 17:11:32 +0000
committerGitHub <noreply@github.com>2025-01-30 12:11:32 -0500
commit00d16976e6ff5257066c24fe819d479f324db215 (patch)
treec5587c9c9e52f90fef22d050543162111bbacb14 /defaults/assets/prepare.sh
parent13de57fb692ac9f15646ece6d25a33fe936beb4f (diff)
downloadDecky-Framegen-00d16976e6ff5257066c24fe819d479f324db215.tar.gz
Decky-Framegen-00d16976e6ff5257066c24fe819d479f324db215.zip
* Move assets/ to defaults/assets so .vscode/build.sh and decky-cli packages correctly (#28)v0.5.0-Bundled
* Changed all paths to use environment variables from decky as base paths * Remove alwaysRender from front-end so setInterval does not run in the background during a game session
Diffstat (limited to 'defaults/assets/prepare.sh')
-rwxr-xr-xdefaults/assets/prepare.sh110
1 files changed, 110 insertions, 0 deletions
diff --git a/defaults/assets/prepare.sh b/defaults/assets/prepare.sh
new file mode 100755
index 0000000..a48ffcb
--- /dev/null
+++ b/defaults/assets/prepare.sh
@@ -0,0 +1,110 @@
+#!/usr/bin/env bash
+
+set -x # Enable debugging
+exec > >(tee -i /tmp/prepare.log) 2>&1 # Log output and errors
+
+# Function to test if curl works with a given LD_LIBRARY_PATH
+test_curl() {
+ local lib_path=$1
+ export LD_LIBRARY_PATH=$lib_path:$LD_LIBRARY_PATH
+ echo "Testing curl with LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+ curl --version >/dev/null 2>&1
+ return $?
+}
+
+# Try library paths and choose the one that works
+if test_curl "/usr/lib"; then
+ echo "Using OpenSSL library path: /usr/lib"
+ export LD_LIBRARY_PATH="/usr/lib:$LD_LIBRARY_PATH"
+elif test_curl "/usr/lib64"; then
+ echo "Using OpenSSL library path: /usr/lib64"
+ export LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH"
+elif test_curl "/lib"; then
+ echo "Using OpenSSL library path: /lib"
+ export LD_LIBRARY_PATH="/usr/lib:$LD_LIBRARY_PATH"
+elif test_curl "/lib64"; then
+ echo "Using OpenSSL library path: /lib64"
+ export LD_LIBRARY_PATH="/usr/lib64:$LD_LIBRARY_PATH"
+elif test_curl "/usr/local/lib"; then
+ echo "Using OpenSSL library path: /usr/local/lib"
+ export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+elif test_curl "/usr/local/ssl/lib"; then
+ echo "Using OpenSSL library path: /usr/local/ssl/lib"
+ export LD_LIBRARY_PATH="/usr/local/ssl/lib:$LD_LIBRARY_PATH"
+else
+ echo "Failed to configure OpenSSL for curl. Exiting."
+ exit 1
+fi
+
+mod_path="$HOME/fgmod"
+nvidiaver=555.52.04
+enablerver=3.02.000.0
+fakenvapiver=v1.2.0
+standalone=1
+
+if [[ -d "$mod_path" ]] && [[ ! $mod_path == . ]]; then
+ rm -r "$mod_path"
+fi
+
+# In case script gets ran from a different directory
+cd "$(dirname "$0")"
+
+mkdir -p "$mod_path"
+if [[ ! $standalone -eq 0 ]]; then
+ [[ -f fgmod.sh ]] && cp fgmod.sh "$mod_path/fgmod" || exit 1
+ [[ -f fgmod-uninstaller.sh ]] && cp fgmod-uninstaller.sh "$mod_path" || exit 1
+fi
+cd "$mod_path" || exit 1
+
+curl -OLf https://github.com/artur-graniszewski/DLSS-Enabler/releases/download/$enablerver/dlss-enabler-setup-$enablerver.exe || exit 1
+curl -OLf https://download.nvidia.com/XFree86/Linux-x86_64/$nvidiaver/NVIDIA-Linux-x86_64-$nvidiaver.run || exit 1
+curl -OLf https://raw.githubusercontent.com/mozilla/fxc2/master/dll/d3dcompiler_47.dll || exit 1
+curl -OLf https://github.com/FakeMichau/innoextract/releases/download/6.3.0/innoextract || exit 1
+curl -OLf https://github.com/FakeMichau/fakenvapi/releases/download/$fakenvapiver/fakenvapi.7z || exit 1
+[[ $standalone -eq 0 ]] && curl -o fgmod -Lf https://raw.githubusercontent.com/FakeMichau/fgmod/main/fgmod.sh
+[[ $standalone -eq 0 ]] && curl -OL https://raw.githubusercontent.com/FakeMichau/fgmod/main/fgmod-uninstaller.sh
+
+[[ ! -f dlss-enabler-setup-$enablerver.exe ]] ||
+[[ ! -f NVIDIA-Linux-x86_64-$nvidiaver.run ]] ||
+[[ ! -f d3dcompiler_47.dll ]] ||
+[[ ! -f innoextract ]] ||
+[[ ! -f fakenvapi.7z ]] ||
+[[ ! -f fgmod ]] ||
+[[ ! -f fgmod-uninstaller.sh ]] && exit 1
+
+# Extract files
+chmod +x NVIDIA-Linux-x86_64-$nvidiaver.run
+./NVIDIA-Linux-x86_64-$nvidiaver.run -x
+
+chmod +x innoextract
+./innoextract dlss-enabler-setup-$enablerver.exe
+
+# Prepare mod files
+mv app/* .
+rm -r app
+[[ -f "$(which 7z 2>/dev/null)" ]] && 7z -y x fakenvapi.7z
+cp -f NVIDIA-Linux-x86_64-$nvidiaver/nvngx.dll _nvngx.dll
+cp -f NVIDIA-Linux-x86_64-$nvidiaver/LICENSE "licenses/LICENSE (NVIDIA driver)"
+chmod +r _nvngx.dll
+rm -rf innoextract NVIDIA-Linux-x86_64-$nvidiaver dlss-enabler-setup-$enablerver.exe NVIDIA-Linux-x86_64-$nvidiaver.run fakenvapi.7z
+rm -rf plugins nvapi64-proxy.dll dlss-enabler-fsr.dll dlss-enabler-xess.dll dbghelp.dll version.dll winmm.dll nvngx.dll dlss-finder.exe dlss-enabler.log dlssg_to_fsr3.log fakenvapi.log "LICENSE (DLSSG to FSR3 mod).txt" "Readme (DLSS enabler).txt" "READ ME (DLSSG to FSR3 mod).txt" "XESS LICENSE.pdf"
+[[ -f "$(which nvidia-smi 2>/dev/null)" ]] && rm -rf nvapi64.dll fakenvapi.ini
+
+sed -i 's|mod_path="/usr/share/fgmod"|mod_path="'"$mod_path"'"|g' fgmod
+chmod +x fgmod
+
+sed -i 's|mod_path="/usr/share/fgmod"|mod_path="'"$mod_path"'"|g' fgmod-uninstaller.sh
+chmod +x fgmod-uninstaller.sh
+
+echo ""
+
+# Flatpak doesn't have access to home by default
+if flatpak list | grep "com.valvesoftware.Steam" 1>/dev/null; then
+ echo Flatpak version of Steam detected, adding access to fgmod\'s folder
+ echo Please restart Steam!
+ flatpak override --user --filesystem="$mod_path" com.valvesoftware.Steam
+fi
+
+echo For Steam, add this to the launch options: "$mod_path/fgmod" %COMMAND%
+echo For Heroic, add this as a new wrapper: "$mod_path/fgmod"
+echo All done! \ No newline at end of file