From 4967dbb4ea19182c982c8107574a85f306266e8f Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:42:38 -0400 Subject: Pr fixes (#126) * rm flatpak function, rm legacy script * feat: add warning modal on copy button --- defaults/assets/prepare-legacy.sh | 79 --------------------------------- main.py | 37 --------------- src/components/SmartClipboardButton.tsx | 28 +++++++++++- 3 files changed, 27 insertions(+), 117 deletions(-) delete mode 100755 defaults/assets/prepare-legacy.sh diff --git a/defaults/assets/prepare-legacy.sh b/defaults/assets/prepare-legacy.sh deleted file mode 100755 index c52bc8d..0000000 --- a/defaults/assets/prepare-legacy.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash -# copy of og prepare script for historical reference, things changed a lot since then, but it's still useful to have it here - -set -x # Enable debugging -exec > >(tee -i /tmp/prepare.log) 2>&1 # Log output and errors - -mod_path="$HOME/fgmod" -bin_path="$(dirname "$(realpath "$0")")/../bin" -assets_path="$(dirname "$(realpath "$0")")" - -nvidiaver="NVIDIA-Linux-x86_64-555.52.04.run" -enablerver="dlss-enabler-setup-3.02.000.0.exe" -fakenvapiver="fakenvapi.7z" -standalone=1 - -if [[ -d "$mod_path" ]] && [[ ! $mod_path == . ]]; then - rm -r "$mod_path" -fi - -mkdir -p "$mod_path" -cd "$mod_path" || exit 1 - -# Copy required files from bin directory -cp "$bin_path/$enablerver" . -cp "$bin_path/$nvidiaver" . -cp "$bin_path/d3dcompiler_47.dll" . -cp "$bin_path/innoextract" . -cp "$bin_path/$fakenvapiver" . - -# Copy fgmod.sh and fgmod-uninstaller.sh from defaults/assets -cp "$assets_path/fgmod.sh" "$mod_path/fgmod" || exit 1 -cp "$assets_path/fgmod-uninstaller.sh" "$mod_path" || exit 1 - -if [[ ! -f "$enablerver" || ! -f "$nvidiaver" || ! -f "d3dcompiler_47.dll" || ! -f "innoextract" || ! -f "$fakenvapiver" || ! -f "fgmod" || ! -f "fgmod-uninstaller.sh" ]]; then - echo "Missing one or more required files. Exiting." - exit 1 -fi - -# Extract files -chmod +x "$nvidiaver" -./"$nvidiaver" -x - -chmod +x innoextract -./innoextract "$enablerver" - -# Prepare mod files -mv app/* . -rm -r app -[[ -f "$(which 7z 2>/dev/null)" ]] && 7z -y x "$fakenvapiver" -cp -f NVIDIA-Linux-x86_64-555.52.04/nvngx.dll _nvngx.dll -cp -f NVIDIA-Linux-x86_64-555.52.04/LICENSE "licenses/LICENSE (NVIDIA driver)" -chmod +r _nvngx.dll - -# Cleanup -rm -rf innoextract NVIDIA-Linux-x86_64-555.52.04 dlss-enabler-setup-3.02.000.0.exe NVIDIA-Linux-x86_64-555.52.04.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 - -# Update paths in scripts -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 compatibility -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 diff --git a/main.py b/main.py index 4eb769d..21866e4 100644 --- a/main.py +++ b/main.py @@ -90,39 +90,6 @@ class Plugin: except Exception as e: decky.logger.error(f"Failed to modify OptiScaler.ini: {e}") return False - - def _setup_flatpak_compatibility(self, fgmod_path): - """Set up Flatpak compatibility if needed""" - try: - # Create a clean environment to avoid PyInstaller issues - clean_env = os.environ.copy() - clean_env["LD_LIBRARY_PATH"] = "" - - # Check if Flatpak Steam is installed - flatpak_check = subprocess.run( - ["flatpak", "list"], - capture_output=True, - text=True, - check=False, - env=clean_env - ) - - if flatpak_check.returncode == 0 and "com.valvesoftware.Steam" in flatpak_check.stdout: - decky.logger.info("Flatpak Steam detected, adding filesystem access") - - subprocess.run([ - "flatpak", "override", "--user", - f"--filesystem={fgmod_path}", - "com.valvesoftware.Steam" - ], check=False, env=clean_env) - - decky.logger.info("Added Flatpak filesystem access") - return True - - return False - except Exception as e: - decky.logger.warning(f"Flatpak setup had issues (this is OK): {e}") - return False async def extract_static_optiscaler(self) -> dict: """Extract OptiScaler from the plugin's bin directory.""" @@ -255,10 +222,6 @@ class Plugin: "message": f"OptiScaler extraction failed: {extract_result.get('message', 'Unknown error')}" } - # Handle Flatpak compatibility - fgmod_path = Path(decky.HOME) / "fgmod" - self._setup_flatpak_compatibility(fgmod_path) - return { "status": "success", "output": "Successfully installed OptiScaler with all necessary components! You can now replace DLSS with FSR Frame Gen!" diff --git a/src/components/SmartClipboardButton.tsx b/src/components/SmartClipboardButton.tsx index 095da15..d88a58a 100644 --- a/src/components/SmartClipboardButton.tsx +++ b/src/components/SmartClipboardButton.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from "react"; -import { PanelSectionRow, ButtonItem } from "@decky/ui"; +import { PanelSectionRow, ButtonItem, ConfirmModal, showModal } from "@decky/ui"; import { FaClipboard, FaCheck } from "react-icons/fa"; import { toaster } from "@decky/api"; @@ -29,6 +29,32 @@ export function SmartClipboardButton({ const copyToClipboard = async () => { if (isLoading || showSuccess) return; + const isPatchCommand = command.includes("fgmod %command%") && !command.includes("uninstaller"); + + if (isPatchCommand) { + showModal( + { + await performCopy(); + }} + /> + ); + return; + } + + // For non-patch commands, copy directly + await performCopy(); + }; + + const performCopy = async () => { + if (isLoading || showSuccess) return; + setIsLoading(true); try { const text = command; -- cgit v1.2.3