summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-12-19 22:39:05 -0500
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-12-19 22:39:05 -0500
commit62b5571cc11097b75a146f696c59fe1e6c85e6f0 (patch)
treec48d94b864eca298f24c126fd68296e54b453bce
parent70027bd3d662807e19c587d13c8061e48760a4b5 (diff)
downloadDecky-Framegen-simplify-install.tar.gz
Decky-Framegen-simplify-install.zip
initial rework of fgmod to make install more cannonical to upstream optisimplify-install
-rwxr-xr-xdefaults/assets/fgmod.sh125
-rwxr-xr-xdefaults/assets/fgmod.sh.backup211
-rw-r--r--main.py175
3 files changed, 319 insertions, 192 deletions
diff --git a/defaults/assets/fgmod.sh b/defaults/assets/fgmod.sh
index d48856d..ba8846a 100755
--- a/defaults/assets/fgmod.sh
+++ b/defaults/assets/fgmod.sh
@@ -16,8 +16,8 @@ error_exit() {
# === CONFIG ===
fgmod_path="$HOME/fgmod"
-dll_name="${DLL:-dxgi.dll}"
-preserve_ini="${PRESERVE_INI:-true}"
+opti_path="$fgmod_path/opti"
+int8_path="$fgmod_path/int8"
# === Resolve Game Path ===
if [[ "$#" -lt 1 ]]; then
@@ -93,83 +93,64 @@ fi
[[ ! -w "$exe_folder_path" ]] && error_exit "๐Ÿ›‘ No write permission to the game folder!"
logger -t fgmod "๐ŸŸข Target directory: $exe_folder_path"
-logger -t fgmod "๐Ÿงฉ Using DLL name: $dll_name"
-logger -t fgmod "๐Ÿ“„ Preserve INI: $preserve_ini"
-# === Cleanup Old Injectors ===
-rm -f "$exe_folder_path"/{dxgi.dll,winmm.dll,nvngx.dll,_nvngx.dll,nvngx-wrapper.dll,dlss-enabler.dll,OptiScaler.dll}
-
-# === Optional: Backup Original DLLs ===
-original_dlls=("d3dcompiler_47.dll" "amd_fidelityfx_dx12.dll" "amd_fidelityfx_framegeneration_dx12.dll" "amd_fidelityfx_upscaler_dx12.dll" "amd_fidelityfx_vk.dll")
-for dll in "${original_dlls[@]}"; do
- [[ -f "$exe_folder_path/$dll" && ! -f "$exe_folder_path/$dll.b" ]] && mv -f "$exe_folder_path/$dll" "$exe_folder_path/$dll.b"
-done
+# === Copy all OptiScaler files from ~/fgmod/opti to game directory ===
+echo "๐Ÿ“ฆ Copying OptiScaler files from $opti_path to $exe_folder_path"
+if [[ ! -d "$opti_path" ]]; then
+ error_exit "โŒ OptiScaler directory not found at $opti_path. Please run Setup OptiScaler first."
+fi
-# === Remove nvapi64.dll and its backup (conflicts from previous fakenvapi versions) ===
-rm -f "$exe_folder_path/nvapi64.dll" "$exe_folder_path/nvapi64.dll.b"
-echo "๐Ÿงน Cleaned up nvapi64.dll and backup (legacy fakenvapi conflicts)"
+# Copy all files from opti directory to game directory
+cp -rf "$opti_path"/* "$exe_folder_path/" || error_exit "โŒ Failed to copy OptiScaler files"
+echo "โœ… Copied all OptiScaler files to game directory"
-# === Core Install ===
-if [[ -f "$fgmod_path/renames/$dll_name" ]]; then
- echo "โœ… Using pre-renamed $dll_name"
- cp "$fgmod_path/renames/$dll_name" "$exe_folder_path/$dll_name" || error_exit "โŒ Failed to copy $dll_name"
-else
- echo "โš ๏ธ Pre-renamed $dll_name not found, falling back to OptiScaler.dll"
- cp "$fgmod_path/OptiScaler.dll" "$exe_folder_path/$dll_name" || error_exit "โŒ Failed to copy OptiScaler.dll as $dll_name"
+# === Copy int8 upscaler DLL if it exists ===
+if [[ -f "$int8_path/amd_fidelityfx_upscaler_dx12.dll" ]]; then
+ echo "๐Ÿ“ฆ Copying int8 upscaler DLL to $exe_folder_path"
+ cp -f "$int8_path/amd_fidelityfx_upscaler_dx12.dll" "$exe_folder_path/" || true
+ echo "โœ… Copied int8 upscaler DLL"
fi
-# === OptiScaler.ini Handling ===
-if [[ "$preserve_ini" == "true" && -f "$exe_folder_path/OptiScaler.ini" ]]; then
- echo "๐Ÿ“„ Preserving existing OptiScaler.ini (user settings retained)"
- logger -t fgmod "๐Ÿ“„ Existing OptiScaler.ini preserved in $exe_folder_path"
-else
- echo "๐Ÿ“„ Installing OptiScaler.ini from plugin defaults"
- cp "$fgmod_path/OptiScaler.ini" "$exe_folder_path/OptiScaler.ini" || error_exit "โŒ Failed to copy OptiScaler.ini"
- logger -t fgmod "๐Ÿ“„ OptiScaler.ini installed to $exe_folder_path"
-fi
+# === Apply OptiScaler setup (what setup_linux.sh does) ===
+# We do this directly instead of running setup_linux.sh to avoid interaction issues
+echo "๐Ÿ”ง Setting up OptiScaler files"
-# === ASI Plugins Directory ===
-if [[ -d "$fgmod_path/plugins" ]]; then
- echo "๐Ÿ”Œ Installing ASI plugins directory"
- cp -r "$fgmod_path/plugins" "$exe_folder_path/" || true
- logger -t fgmod "๐Ÿ”Œ ASI plugins directory installed to $exe_folder_path"
+# Rename OptiScaler.dll to dxgi.dll (equivalent to selecting option 1)
+if [[ -f "$exe_folder_path/OptiScaler.dll" ]]; then
+ if [[ -f "$exe_folder_path/dxgi.dll" ]]; then
+ echo "โš ๏ธ Removing existing dxgi.dll"
+ rm -f "$exe_folder_path/dxgi.dll"
+ fi
+ mv "$exe_folder_path/OptiScaler.dll" "$exe_folder_path/dxgi.dll"
+ echo "โœ… Renamed OptiScaler.dll to dxgi.dll"
else
- echo "โš ๏ธ No plugins directory found in fgmod"
+ echo "โš ๏ธ OptiScaler.dll not found, may already be renamed"
fi
-# === Supporting Libraries ===
-cp -f "$fgmod_path/libxess.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/libxess_dx11.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/libxess_fg.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/libxell.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/amd_fidelityfx_dx12.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/amd_fidelityfx_framegeneration_dx12.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/amd_fidelityfx_upscaler_dx12.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/amd_fidelityfx_vk.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/nvngx.dll" "$exe_folder_path/" || true
-
-# === Nukem FG Mod Files (now in fgmod directory) ===
-cp -f "$fgmod_path/dlssg_to_fsr3_amd_is_better.dll" "$exe_folder_path/" || true
-# Note: dlssg_to_fsr3.ini is not included in v0.9.0-pre4 archive
-
-# === FakeNVAPI Files ===
-# Remove legacy nvapi64.dll to avoid conflicts
-# rm -f "$exe_folder_path/nvapi64.dll"
-# echo "๐Ÿงน Removed legacy nvapi64.dll"
+# Disable spoofing for non-Nvidia (equivalent to answering 'n' then 'y')
+# The script asks: "Are you using Nvidia?" - we answer 'n'
+# Then asks: "Will you try to use DLSS inputs?" - we answer 'y' (enable spoofing)
+# Spoofing stays enabled (Dxgi=auto), so we don't need to change OptiScaler.ini
-# Copy fakenvapi.dll with original name (v1.3.8.1)
-cp -f "$fgmod_path/fakenvapi.dll" "$exe_folder_path/" || true
-cp -f "$fgmod_path/fakenvapi.ini" "$exe_folder_path/" || true
-echo "๐Ÿ“ฆ Installed fakenvapi.dll and fakenvapi.ini"
+# Clean up setup script and windows batch file
+rm -f "$exe_folder_path/setup_linux.sh" "$exe_folder_path/setup_windows.bat"
+rm -f "$exe_folder_path/!! EXTRACT ALL FILES TO GAME FOLDER !!"
-# === Additional Support Files ===
-# cp -f "$fgmod_path/d3dcompiler_47.dll" "$exe_folder_path/" || true
+# Create uninstaller script (simplified version)
+cat > "$exe_folder_path/remove_optiscaler.sh" << 'UNINSTALL_EOF'
+#!/usr/bin/env bash
+echo "Removing OptiScaler files..."
+rm -f OptiScaler.log OptiScaler.ini dxgi.dll fakenvapi.dll fakenvapi.ini fakenvapi.log
+rm -f dlssg_to_fsr3_amd_is_better.dll dlssg_to_fsr3.log
+rm -rf D3D12_Optiscaler DlssOverrides Licenses
+echo "OptiScaler removed!"
+rm -f "$0"
+UNINSTALL_EOF
+chmod +x "$exe_folder_path/remove_optiscaler.sh"
-# Note: d3dcompiler_47.dll is not included in v0.9.0-pre4 archive
+echo "โœ… OptiScaler setup completed"
echo "โœ… Installation completed successfully!"
-echo "๐Ÿ“„ For Steam, add this to the launch options: \"$fgmod_path/fgmod\" %COMMAND%"
-echo "๐Ÿ“„ For Heroic, add this as a new wrapper: \"$fgmod_path/fgmod\""
logger -t fgmod "๐ŸŸข Installation completed successfully for $exe_folder_path"
# === Execute original command ===
@@ -184,9 +165,9 @@ if [[ $# -gt 1 ]]; then
logger -t fgmod "Final executable path: $exe_folder_path"
logger -t fgmod "=================="
- # Execute the original command
+ # Execute the original command with proper environment variables
export SteamDeck=0
- export WINEDLLOVERRIDES="$WINEDLLOVERRIDES,dxgi=n,b"
+ export WINEDLLOVERRIDES="dxgi=n,b${WINEDLLOVERRIDES:+,$WINEDLLOVERRIDES}"
exec "$@"
else
echo "Done!"
@@ -198,14 +179,4 @@ else
done
echo "Final executable path: $exe_folder_path"
echo "----------------------------------------"
-
- # Also log standalone mode to journal
- logger -t fgmod "=================="
- logger -t fgmod "Debug Info (Standalone Mode):"
- logger -t fgmod "Number of arguments: $#"
- for i in $(seq 1 $#); do
- logger -t fgmod "Arg $i: ${!i}"
- done
- logger -t fgmod "Final executable path: $exe_folder_path"
- logger -t fgmod "=================="
fi
diff --git a/defaults/assets/fgmod.sh.backup b/defaults/assets/fgmod.sh.backup
new file mode 100755
index 0000000..d48856d
--- /dev/null
+++ b/defaults/assets/fgmod.sh.backup
@@ -0,0 +1,211 @@
+#!/usr/bin/env bash
+
+set -x
+exec > >(tee -i /tmp/fgmod-install.log) 2>&1
+
+error_exit() {
+ echo "โŒ $1"
+ if [[ -n $STEAM_ZENITY ]]; then
+ $STEAM_ZENITY --error --text "$1"
+ else
+ zenity --error --text "$1" || echo "Zenity failed to display error"
+ fi
+ logger -t fgmod "โŒ ERROR: $1"
+ exit 1
+}
+
+# === CONFIG ===
+fgmod_path="$HOME/fgmod"
+dll_name="${DLL:-dxgi.dll}"
+preserve_ini="${PRESERVE_INI:-true}"
+
+# === Resolve Game Path ===
+if [[ "$#" -lt 1 ]]; then
+ error_exit "Usage: $0 program [program_arguments...]"
+fi
+
+exe_folder_path=""
+if [[ $# -eq 1 ]]; then
+ [[ "$1" == *.exe ]] && exe_folder_path=$(dirname "$1") || exe_folder_path="$1"
+else
+ for arg in "$@"; do
+ if [[ "$arg" == *.exe ]]; then
+ [[ "$arg" == *"Cyberpunk 2077"* ]] && arg=${arg//REDprelauncher.exe/bin/x64/Cyberpunk2077.exe}
+ [[ "$arg" == *"Witcher 3"* ]] && arg=${arg//REDprelauncher.exe/bin/x64_dx12/witcher3.exe}
+ [[ "$arg" == *"Baldurs Gate 3"* ]] && arg=${arg//Launcher\/LariLauncher.exe/bin/bg3_dx11.exe}
+ [[ "$arg" == *"HITMAN 3"* ]] && arg=${arg//Launcher.exe/Retail/HITMAN3.exe}
+ [[ "$arg" == *"HITMAN World of Assassination"* ]] && arg=${arg//Launcher.exe/Retail/HITMAN3.exe}
+ [[ "$arg" == *"SYNCED"* ]] && arg=${arg//Launcher\/sop_launcher.exe/SYNCED.exe}
+ [[ "$arg" == *"2KLauncher"* ]] && arg=${arg//2KLauncher\/LauncherPatcher.exe/DoesntMatter.exe}
+ [[ "$arg" == *"Warhammer 40,000 DARKTIDE"* ]] && arg=${arg//launcher\/Launcher.exe/binaries/Darktide.exe}
+ [[ "$arg" == *"Warhammer Vermintide 2"* ]] && arg=${arg//launcher\/Launcher.exe/binaries_dx12/vermintide2_dx12.exe}
+ [[ "$arg" == *"Satisfactory"* ]] && arg=${arg//FactoryGameSteam.exe/Engine/Binaries/Win64/FactoryGameSteam-Win64-Shipping.exe}
+ [[ "$arg" == *"FINAL FANTASY XIV Online"* ]] && arg=${arg//boot\/ffxivboot.exe/game/ffxiv_dx11.exe}
+ exe_folder_path=$(dirname "$arg")
+ break
+ fi
+ done
+fi
+
+for arg in "$@"; do
+ if [[ "$arg" == lutris:rungameid/* ]]; then
+ lutris_id="${arg#lutris:rungameid/}"
+
+ # Get slug from Lutris JSON
+ slug=$(lutris --list-games --json 2>/dev/null | jq -r ".[] | select(.id == $lutris_id) | .slug")
+
+ if [[ -z "$slug" || "$slug" == "null" ]]; then
+ echo "Could not find slug for Lutris ID $lutris_id"
+ break
+ fi
+
+ # Find matching YAML file using slug
+ config_file=$(find ~/.config/lutris/games/ -iname "${slug}-*.yml" | head -1)
+
+ if [[ -z "$config_file" ]]; then
+ echo "No config file found for slug '$slug'"
+ break
+ fi
+
+ # Extract executable path from YAML
+ exe_path=$(grep -E '^\s*exe:' "$config_file" | sed 's/.*exe:[[:space:]]*//')
+
+ if [[ -n "$exe_path" ]]; then
+ exe_folder_path=$(dirname "$exe_path")
+ echo "Resolved executable path: $exe_path"
+ echo "Executable folder: $exe_folder_path"
+ else
+ echo "Executable path not found in $config_file"
+ fi
+
+ break
+ fi
+done
+
+[[ -z "$exe_folder_path" && -n "$STEAM_COMPAT_INSTALL_PATH" ]] && exe_folder_path="$STEAM_COMPAT_INSTALL_PATH"
+
+if [[ -d "$exe_folder_path/Engine" ]]; then
+ ue_exe=$(find "$exe_folder_path" -maxdepth 4 -mindepth 4 -path "*Binaries/Win64/*.exe" -not -path "*/Engine/*" | head -1)
+ exe_folder_path=$(dirname "$ue_exe")
+fi
+
+[[ ! -d "$exe_folder_path" ]] && error_exit "โŒ Could not resolve game directory!"
+[[ ! -w "$exe_folder_path" ]] && error_exit "๐Ÿ›‘ No write permission to the game folder!"
+
+logger -t fgmod "๐ŸŸข Target directory: $exe_folder_path"
+logger -t fgmod "๐Ÿงฉ Using DLL name: $dll_name"
+logger -t fgmod "๐Ÿ“„ Preserve INI: $preserve_ini"
+
+# === Cleanup Old Injectors ===
+rm -f "$exe_folder_path"/{dxgi.dll,winmm.dll,nvngx.dll,_nvngx.dll,nvngx-wrapper.dll,dlss-enabler.dll,OptiScaler.dll}
+
+# === Optional: Backup Original DLLs ===
+original_dlls=("d3dcompiler_47.dll" "amd_fidelityfx_dx12.dll" "amd_fidelityfx_framegeneration_dx12.dll" "amd_fidelityfx_upscaler_dx12.dll" "amd_fidelityfx_vk.dll")
+for dll in "${original_dlls[@]}"; do
+ [[ -f "$exe_folder_path/$dll" && ! -f "$exe_folder_path/$dll.b" ]] && mv -f "$exe_folder_path/$dll" "$exe_folder_path/$dll.b"
+done
+
+# === Remove nvapi64.dll and its backup (conflicts from previous fakenvapi versions) ===
+rm -f "$exe_folder_path/nvapi64.dll" "$exe_folder_path/nvapi64.dll.b"
+echo "๐Ÿงน Cleaned up nvapi64.dll and backup (legacy fakenvapi conflicts)"
+
+# === Core Install ===
+if [[ -f "$fgmod_path/renames/$dll_name" ]]; then
+ echo "โœ… Using pre-renamed $dll_name"
+ cp "$fgmod_path/renames/$dll_name" "$exe_folder_path/$dll_name" || error_exit "โŒ Failed to copy $dll_name"
+else
+ echo "โš ๏ธ Pre-renamed $dll_name not found, falling back to OptiScaler.dll"
+ cp "$fgmod_path/OptiScaler.dll" "$exe_folder_path/$dll_name" || error_exit "โŒ Failed to copy OptiScaler.dll as $dll_name"
+fi
+
+# === OptiScaler.ini Handling ===
+if [[ "$preserve_ini" == "true" && -f "$exe_folder_path/OptiScaler.ini" ]]; then
+ echo "๐Ÿ“„ Preserving existing OptiScaler.ini (user settings retained)"
+ logger -t fgmod "๐Ÿ“„ Existing OptiScaler.ini preserved in $exe_folder_path"
+else
+ echo "๐Ÿ“„ Installing OptiScaler.ini from plugin defaults"
+ cp "$fgmod_path/OptiScaler.ini" "$exe_folder_path/OptiScaler.ini" || error_exit "โŒ Failed to copy OptiScaler.ini"
+ logger -t fgmod "๐Ÿ“„ OptiScaler.ini installed to $exe_folder_path"
+fi
+
+# === ASI Plugins Directory ===
+if [[ -d "$fgmod_path/plugins" ]]; then
+ echo "๐Ÿ”Œ Installing ASI plugins directory"
+ cp -r "$fgmod_path/plugins" "$exe_folder_path/" || true
+ logger -t fgmod "๐Ÿ”Œ ASI plugins directory installed to $exe_folder_path"
+else
+ echo "โš ๏ธ No plugins directory found in fgmod"
+fi
+
+# === Supporting Libraries ===
+cp -f "$fgmod_path/libxess.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/libxess_dx11.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/libxess_fg.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/libxell.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/amd_fidelityfx_dx12.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/amd_fidelityfx_framegeneration_dx12.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/amd_fidelityfx_upscaler_dx12.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/amd_fidelityfx_vk.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/nvngx.dll" "$exe_folder_path/" || true
+
+# === Nukem FG Mod Files (now in fgmod directory) ===
+cp -f "$fgmod_path/dlssg_to_fsr3_amd_is_better.dll" "$exe_folder_path/" || true
+# Note: dlssg_to_fsr3.ini is not included in v0.9.0-pre4 archive
+
+# === FakeNVAPI Files ===
+# Remove legacy nvapi64.dll to avoid conflicts
+# rm -f "$exe_folder_path/nvapi64.dll"
+# echo "๐Ÿงน Removed legacy nvapi64.dll"
+
+# Copy fakenvapi.dll with original name (v1.3.8.1)
+cp -f "$fgmod_path/fakenvapi.dll" "$exe_folder_path/" || true
+cp -f "$fgmod_path/fakenvapi.ini" "$exe_folder_path/" || true
+echo "๐Ÿ“ฆ Installed fakenvapi.dll and fakenvapi.ini"
+
+# === Additional Support Files ===
+# cp -f "$fgmod_path/d3dcompiler_47.dll" "$exe_folder_path/" || true
+
+# Note: d3dcompiler_47.dll is not included in v0.9.0-pre4 archive
+
+echo "โœ… Installation completed successfully!"
+echo "๐Ÿ“„ For Steam, add this to the launch options: \"$fgmod_path/fgmod\" %COMMAND%"
+echo "๐Ÿ“„ For Heroic, add this as a new wrapper: \"$fgmod_path/fgmod\""
+logger -t fgmod "๐ŸŸข Installation completed successfully for $exe_folder_path"
+
+# === Execute original command ===
+if [[ $# -gt 1 ]]; then
+ # Log to both file and system journal
+ logger -t fgmod "=================="
+ logger -t fgmod "Debug Info (Launch Mode):"
+ logger -t fgmod "Number of arguments: $#"
+ for i in $(seq 1 $#); do
+ logger -t fgmod "Arg $i: ${!i}"
+ done
+ logger -t fgmod "Final executable path: $exe_folder_path"
+ logger -t fgmod "=================="
+
+ # Execute the original command
+ export SteamDeck=0
+ export WINEDLLOVERRIDES="$WINEDLLOVERRIDES,dxgi=n,b"
+ exec "$@"
+else
+ echo "Done!"
+ echo "----------------------------------------"
+ echo "Debug Info (Standalone Mode):"
+ echo "Number of arguments: $#"
+ for i in $(seq 1 $#); do
+ echo "Arg $i: ${!i}"
+ done
+ echo "Final executable path: $exe_folder_path"
+ echo "----------------------------------------"
+
+ # Also log standalone mode to journal
+ logger -t fgmod "=================="
+ logger -t fgmod "Debug Info (Standalone Mode):"
+ logger -t fgmod "Number of arguments: $#"
+ for i in $(seq 1 $#); do
+ logger -t fgmod "Arg $i: ${!i}"
+ done
+ logger -t fgmod "Final executable path: $exe_folder_path"
+ logger -t fgmod "=================="
+fi
diff --git a/main.py b/main.py
index 5b6b8e8..01ffe81 100644
--- a/main.py
+++ b/main.py
@@ -152,16 +152,19 @@ class Plugin:
return False
async def extract_static_optiscaler(self) -> dict:
- """Extract OptiScaler from the plugin's bin directory and copy additional files."""
+ """Extract OptiScaler to ~/fgmod/opti and int8 DLL to ~/fgmod/int8."""
try:
- decky.logger.info("Starting extract_static_optiscaler method")
+ decky.logger.info("Starting simplified extract_static_optiscaler method")
# Set up paths
bin_path = Path(decky.DECKY_PLUGIN_DIR) / "bin"
- extract_path = Path(decky.HOME) / "fgmod"
+ fgmod_base = Path(decky.HOME) / "fgmod"
+ opti_path = fgmod_base / "opti"
+ int8_path = fgmod_base / "int8"
decky.logger.info(f"Bin path: {bin_path}")
- decky.logger.info(f"Extract path: {extract_path}")
+ decky.logger.info(f"OptiScaler extraction path: {opti_path}")
+ decky.logger.info(f"Int8 DLL path: {int8_path}")
# Check if bin directory exists
if not bin_path.exists():
@@ -188,22 +191,24 @@ class Plugin:
decky.logger.info(f"Using archive: {optiscaler_archive}")
- # Clean up existing directory
- if extract_path.exists():
- decky.logger.info(f"Removing existing directory: {extract_path}")
- shutil.rmtree(extract_path)
+ # Clean up existing directories
+ if fgmod_base.exists():
+ decky.logger.info(f"Removing existing directory: {fgmod_base}")
+ shutil.rmtree(fgmod_base)
- extract_path.mkdir(exist_ok=True)
- decky.logger.info(f"Created extract directory: {extract_path}")
+ # Create directory structure
+ opti_path.mkdir(parents=True, exist_ok=True)
+ int8_path.mkdir(parents=True, exist_ok=True)
+ decky.logger.info(f"Created directory structure")
- decky.logger.info(f"Extracting {optiscaler_archive.name} to {extract_path}")
+ decky.logger.info(f"Extracting {optiscaler_archive.name} to {opti_path}")
- # Extract the 7z file
+ # Extract the 7z file to ~/fgmod/opti
extract_cmd = [
"7z",
"x",
"-y",
- "-o" + str(extract_path),
+ "-o" + str(opti_path),
str(optiscaler_archive)
]
@@ -234,79 +239,27 @@ class Plugin:
"message": f"Failed to extract OptiScaler archive: {extract_result.stderr}"
}
- # Copy additional individual files from bin directory
- # Note: v0.9.0-pre3+ includes dlssg_to_fsr3_amd_is_better.dll, fakenvapi.dll, and fakenvapi.ini in the 7z
- # Only copy files that aren't already in the archive (separate remote binaries)
- additional_files = [
- "nvngx.dll", # nvidia dll from streamline sdk, not bundled in opti
- "OptiPatcher_v0.30.asi" # ASI plugin for OptiScaler spoofing
- ]
+ # Copy int8 upscaler DLL to ~/fgmod/int8
+ decky.logger.info("Copying int8 upscaler DLL")
+ int8_src = bin_path / "amd_fidelityfx_upscaler_dx12.dll"
+ int8_dst = int8_path / "amd_fidelityfx_upscaler_dx12.dll"
- decky.logger.info("Starting additional files copy")
- for file_name in additional_files:
- src_file = bin_path / file_name
- dest_file = extract_path / file_name
-
- decky.logger.info(f"Checking for additional file: {file_name} at {src_file}")
- if src_file.exists():
- shutil.copy2(src_file, dest_file)
- decky.logger.info(f"Copied additional file: {file_name}")
- else:
- decky.logger.warning(f"Additional file not found: {file_name}")
- return {
- "status": "error",
- "message": f"Required file {file_name} not found in plugin bin directory"
- }
-
- decky.logger.info("Creating renamed copies of OptiScaler.dll")
- # Create renamed copies of OptiScaler.dll
- source_file = extract_path / "OptiScaler.dll"
- renames_dir = extract_path / "renames"
- self._create_renamed_copies(source_file, renames_dir)
+ if int8_src.exists():
+ shutil.copy2(int8_src, int8_dst)
+ decky.logger.info(f"Copied int8 DLL from {int8_src} to {int8_dst}")
+ else:
+ decky.logger.warning(f"Int8 DLL not found at {int8_src}")
+ return {
+ "status": "error",
+ "message": f"Required int8 DLL not found in plugin bin directory"
+ }
decky.logger.info("Copying launcher scripts")
- # Copy launcher scripts from assets
+ # Copy launcher scripts from assets to fgmod base
assets_dir = Path(decky.DECKY_PLUGIN_DIR) / "assets"
- self._copy_launcher_scripts(assets_dir, extract_path)
-
- decky.logger.info("Setting up ASI plugins directory")
- # Create plugins directory and copy OptiPatcher ASI file
- try:
- plugins_dir = extract_path / "plugins"
- plugins_dir.mkdir(exist_ok=True)
- decky.logger.info(f"Created plugins directory: {plugins_dir}")
-
- # Copy OptiPatcher ASI file to plugins directory
- asi_src = bin_path / "OptiPatcher_v0.30.asi"
- asi_dst = plugins_dir / "OptiPatcher.asi" # Rename to generic name
-
- if asi_src.exists():
- shutil.copy2(asi_src, asi_dst)
- decky.logger.info(f"Copied OptiPatcher ASI to plugins directory: {asi_dst}")
- else:
- decky.logger.warning("OptiPatcher ASI file not found in bin directory")
- except Exception as e:
- decky.logger.error(f"Failed to setup ASI plugins directory: {e}")
-
- decky.logger.info("Starting upscaler DLL overwrite check")
- # Optionally overwrite amd_fidelityfx_upscaler_dx12.dll with a newer static binary
- # Toggle via env DECKY_SKIP_UPSCALER_OVERWRITE=true to skip.
- try:
- skip_overwrite = os.environ.get("DECKY_SKIP_UPSCALER_OVERWRITE", "false").lower() in ("1", "true", "yes")
- if UPSCALER_OVERWRITE_ENABLED and not skip_overwrite:
- upscaler_src = bin_path / "amd_fidelityfx_upscaler_dx12.dll"
- upscaler_dst = extract_path / "amd_fidelityfx_upscaler_dx12.dll"
- if upscaler_src.exists():
- shutil.copy2(upscaler_src, upscaler_dst)
- decky.logger.info("Overwrote amd_fidelityfx_upscaler_dx12.dll with static remote binary")
- else:
- decky.logger.warning("amd_fidelityfx_upscaler_dx12.dll not found in bin; skipping overwrite")
- else:
- decky.logger.info("Skipping upscaler DLL overwrite due to DECKY_SKIP_UPSCALER_OVERWRITE")
- except Exception as e:
- decky.logger.error(f"Failed upscaler overwrite step: {e}")
+ self._copy_launcher_scripts(assets_dir, fgmod_base)
- # Extract version from filename (e.g., OptiScaler_0.7.9.7z -> v0.7.9)
+ # Extract version from filename (e.g., Optiscaler_0.9.0-pre6.20251205.7z -> v0.9.0-pre6.20251205)
version_match = optiscaler_archive.name.replace('.7z', '')
if 'OptiScaler_' in version_match:
version = 'v' + version_match.split('OptiScaler_')[1]
@@ -315,8 +268,8 @@ class Plugin:
else:
version = version_match
- # Create version file
- version_file = extract_path / "version.txt"
+ # Create version file in fgmod base
+ version_file = fgmod_base / "version.txt"
try:
with open(version_file, 'w') as f:
f.write(version)
@@ -324,15 +277,10 @@ class Plugin:
except Exception as e:
decky.logger.error(f"Failed to create version file: {e}")
- # Modify OptiScaler.ini to set FGType=nukems and Fsr4Update=true
- decky.logger.info("Modifying OptiScaler.ini")
- ini_file = extract_path / "OptiScaler.ini"
- self._modify_optiscaler_ini(ini_file)
-
- decky.logger.info(f"Successfully completed extraction to ~/fgmod with version {version}")
+ decky.logger.info(f"Successfully completed extraction to ~/fgmod/opti with version {version}")
return {
"status": "success",
- "message": f"Successfully extracted OptiScaler {version} to ~/fgmod",
+ "message": f"Successfully extracted OptiScaler {version} to ~/fgmod/opti and int8 DLL to ~/fgmod/int8",
"version": version
}
@@ -396,34 +344,31 @@ class Plugin:
async def check_fgmod_path(self) -> dict:
path = Path(decky.HOME) / "fgmod"
- required_files = [
- "OptiScaler.dll",
- "OptiScaler.ini",
- "dlssg_to_fsr3_amd_is_better.dll",
- "fakenvapi.dll", # v0.9.0-pre3+ includes fakenvapi.dll in archive
- "fakenvapi.ini",
- "nvngx.dll",
- "amd_fidelityfx_dx12.dll",
- "amd_fidelityfx_framegeneration_dx12.dll",
- "amd_fidelityfx_upscaler_dx12.dll",
- "amd_fidelityfx_vk.dll",
- "libxess.dll",
- "libxess_dx11.dll",
- "libxess_fg.dll", # New in v0.9.0-pre4
- "libxell.dll", # New in v0.9.0-pre4
- "fgmod",
- "fgmod-uninstaller.sh"
- ]
-
+
if path.exists():
- # Check required files
+ # Check for opti subdirectory with OptiScaler files
+ opti_path = path / "opti"
+ if not opti_path.exists():
+ return {"exists": False}
+
+ # Check for essential files in opti directory
+ required_files = [
+ "OptiScaler.dll",
+ "OptiScaler.ini",
+ "setup_linux.sh"
+ ]
+
for file_name in required_files:
- if not path.joinpath(file_name).exists():
+ if not opti_path.joinpath(file_name).exists():
return {"exists": False}
-
- # Check plugins directory and OptiPatcher ASI
- plugins_dir = path / "plugins"
- if not plugins_dir.exists() or not (plugins_dir / "OptiPatcher.asi").exists():
+
+ # Check for int8 directory with upscaler DLL
+ int8_path = path / "int8"
+ if not int8_path.exists() or not (int8_path / "amd_fidelityfx_upscaler_dx12.dll").exists():
+ return {"exists": False}
+
+ # Check for fgmod launcher script
+ if not (path / "fgmod").exists():
return {"exists": False}
return {"exists": True}