diff options
| author | Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> | 2025-09-26 11:32:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-26 11:32:29 -0400 |
| commit | 1369909692f0c3eb617f3125027b681cef373ecd (patch) | |
| tree | e68ae83971c41a7a68bcbf4afce1b4b9d68aeccd | |
| parent | 8da57c7827db2b1725b91afe2b5b15caf322579a (diff) | |
| parent | 6810b97dbfcd3d8875fe8e0d0725b146184120bb (diff) | |
| download | Decky-Framegen-1369909692f0c3eb617f3125027b681cef373ecd.tar.gz Decky-Framegen-1369909692f0c3eb617f3125027b681cef373ecd.zip | |
Merge pull request #143 from xXJSONDeruloXx/opti-9-fsr4
Opti 9 fsr4
| -rwxr-xr-x | defaults/assets/fgmod-uninstaller.sh | 18 | ||||
| -rwxr-xr-x | defaults/assets/fgmod.sh | 34 | ||||
| -rw-r--r-- | justfile | 3 | ||||
| -rw-r--r-- | main.py | 115 | ||||
| -rw-r--r-- | package.json | 25 |
5 files changed, 164 insertions, 31 deletions
diff --git a/defaults/assets/fgmod-uninstaller.sh b/defaults/assets/fgmod-uninstaller.sh index 7590120..38abcf4 100755 --- a/defaults/assets/fgmod-uninstaller.sh +++ b/defaults/assets/fgmod-uninstaller.sh @@ -37,6 +37,7 @@ else [[ "$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 @@ -114,9 +115,22 @@ rm -f "nvapi64.dll" "fakenvapi.ini" "fakenvapi.log" # === Remove Supporting Libraries === echo "🧹 Removing supporting libraries..." -rm -f "libxess.dll" "libxess_dx11.dll" "nvngx.dll" "nvngx.ini" +rm -f "libxess.dll" "libxess_dx11.dll" "libxess_fg.dll" "libxell.dll" "nvngx.dll" "nvngx.ini" rm -f "amd_fidelityfx_dx12.dll" "amd_fidelityfx_framegeneration_dx12.dll" "amd_fidelityfx_upscaler_dx12.dll" "amd_fidelityfx_vk.dll" +# === Remove FG Mod Files === +echo "🧹 Removing frame generation mod files..." +rm -f "dlssg_to_fsr3_amd_is_better.dll" "dlssg_to_fsr3.ini" + +# === Remove NVAPI Files (Current and Legacy) === +echo "🧹 Removing NVAPI files..." +rm -f "fakenvapi.dll" "fakenvapi.ini" # Current v0.9.0-pre4 approach +rm -f "nvapi64.dll" "nvapi64.dll.b" # Legacy cleanup for older versions and backups + +# === Remove ASI Plugins === +echo "🧹 Removing ASI plugins directory..." +rm -rf "plugins" + # === Remove Legacy Files === echo "🧹 Removing legacy files..." rm -f "dlss-enabler.dll" "dlss-enabler-upscaler.dll" "dlss-enabler.log" @@ -125,7 +139,7 @@ rm -f "dlssg_to_fsr3_amd_is_better-3.0.dll" # === Restore Original DLLs === echo "🔄 Restoring 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" "nvapi64.dll" "libxess.dll" "libxess_dx11.dll") +original_dlls=("d3dcompiler_47.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" "libxell.dll") for dll in "${original_dlls[@]}"; do if [[ -f "${dll}.b" ]]; then mv "${dll}.b" "$dll" diff --git a/defaults/assets/fgmod.sh b/defaults/assets/fgmod.sh index ef216cd..d48856d 100755 --- a/defaults/assets/fgmod.sh +++ b/defaults/assets/fgmod.sh @@ -40,6 +40,7 @@ else [[ "$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 @@ -99,11 +100,15 @@ logger -t fgmod "📄 Preserve INI: $preserve_ini" 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" "nvapi64.dll") +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" @@ -123,9 +128,20 @@ else 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 @@ -134,12 +150,22 @@ 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 -cp -f "$fgmod_path/dlssg_to_fsr3.ini" "$exe_folder_path/" || true -cp -f "$fgmod_path/nvapi64.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 +# 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%" @@ -8,4 +8,5 @@ test: scp "out/Decky Framegen.zip" deck@192.168.0.6:~/Desktop clean: - rm -rf node_modules dist
\ No newline at end of file + rm -rf node_modules dist + sudo rm -rf /tmp/decky
\ No newline at end of file @@ -6,6 +6,10 @@ import shutil import re from pathlib import Path +# Toggle to enable overwriting the upscaler DLL from the static remote binary. +# Set to False or comment out this constant to skip the overwrite by default. +UPSCALER_OVERWRITE_ENABLED = True + class Plugin: async def _main(self): decky.logger.info("Framegen plugin loaded") @@ -67,7 +71,7 @@ class Plugin: return False def _modify_optiscaler_ini(self, ini_file): - """Modify OptiScaler.ini to set FGType=nukems and Fsr4Update=true""" + """Modify OptiScaler.ini to set FGType=nukems, Fsr4Update=true, and ASI plugin settings""" try: if ini_file.exists(): with open(ini_file, 'r') as f: @@ -79,10 +83,16 @@ class Plugin: # Replace Fsr4Update=auto with Fsr4Update=true updated_content = re.sub(r'Fsr4Update\s*=\s*auto', 'Fsr4Update=true', updated_content) + # Replace LoadAsiPlugins=auto with LoadAsiPlugins=true + updated_content = re.sub(r'LoadAsiPlugins\s*=\s*auto', 'LoadAsiPlugins=true', updated_content) + + # Replace Path=auto with Path=plugins + updated_content = re.sub(r'Path\s*=\s*auto', 'Path=plugins', updated_content) + with open(ini_file, 'w') as f: f.write(updated_content) - decky.logger.info("Modified OptiScaler.ini to set FGType=nukems") + decky.logger.info("Modified OptiScaler.ini to set FGType=nukems, Fsr4Update=true, LoadAsiPlugins=true, Path=plugins") return True else: decky.logger.warning(f"OptiScaler.ini not found at {ini_file}") @@ -94,25 +104,47 @@ class Plugin: async def extract_static_optiscaler(self) -> dict: """Extract OptiScaler from the plugin's bin directory and copy additional files.""" try: + decky.logger.info("Starting extract_static_optiscaler method") + # Set up paths bin_path = Path(decky.DECKY_PLUGIN_DIR) / "bin" extract_path = Path(decky.HOME) / "fgmod" + decky.logger.info(f"Bin path: {bin_path}") + decky.logger.info(f"Extract path: {extract_path}") + + # Check if bin directory exists + if not bin_path.exists(): + decky.logger.error(f"Bin directory does not exist: {bin_path}") + return {"status": "error", "message": f"Bin directory not found: {bin_path}"} + + # List files in bin directory for debugging + bin_files = list(bin_path.glob("*")) + decky.logger.info(f"Files in bin directory: {[f.name for f in bin_files]}") + # Find the OptiScaler archive in the bin directory optiscaler_archive = None for file in bin_path.glob("*.7z"): - if "OptiScaler" in file.name and not "BUNDLE" in file.name: + decky.logger.info(f"Checking 7z file: {file.name}") + # Check for both "OptiScaler" and "Optiscaler" (case variations) and exclude BUNDLE files + if ("OptiScaler" in file.name or "Optiscaler" in file.name) and "BUNDLE" not in file.name: optiscaler_archive = file + decky.logger.info(f"Found OptiScaler archive: {file.name}") break if not optiscaler_archive: + decky.logger.error("OptiScaler archive not found in plugin bin directory") return {"status": "error", "message": "OptiScaler archive not found in plugin bin directory"} + 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) extract_path.mkdir(exist_ok=True) + decky.logger.info(f"Created extract directory: {extract_path}") decky.logger.info(f"Extracting {optiscaler_archive.name} to {extract_path}") @@ -125,10 +157,13 @@ class Plugin: str(optiscaler_archive) ] + decky.logger.info(f"Running extraction command: {' '.join(extract_cmd)}") + # Create a clean environment to avoid PyInstaller issues clean_env = os.environ.copy() clean_env["LD_LIBRARY_PATH"] = "" + decky.logger.info("Starting subprocess.run for extraction") extract_result = subprocess.run( extract_cmd, capture_output=True, @@ -137,6 +172,11 @@ class Plugin: env=clean_env ) + decky.logger.info(f"Extraction completed with return code: {extract_result.returncode}") + decky.logger.info(f"Extraction stdout: {extract_result.stdout}") + if extract_result.stderr: + decky.logger.info(f"Extraction stderr: {extract_result.stderr}") + if extract_result.returncode != 0: decky.logger.error(f"Extraction failed: {extract_result.stderr}") return { @@ -145,17 +185,19 @@ class Plugin: } # 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 = [ - "dlssg_to_fsr3_amd_is_better.dll", - "fakenvapi.ini", - "nvapi64.dll", - "nvngx.dll" + "nvngx.dll", # nvidia dll from streamline sdk, not bundled in opti + "OptiPatcher_v0.30.asi" # ASI plugin for OptiScaler spoofing ] + 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}") @@ -166,19 +208,60 @@ class Plugin: "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) + decky.logger.info("Copying launcher scripts") # Copy launcher scripts from assets 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}") # Extract version from filename (e.g., OptiScaler_0.7.9.7z -> v0.7.9) version_match = optiscaler_archive.name.replace('.7z', '') if 'OptiScaler_' in version_match: version = 'v' + version_match.split('OptiScaler_')[1] + elif 'Optiscaler_' in version_match: + version = 'v' + version_match.split('Optiscaler_')[1] else: version = version_match @@ -192,9 +275,11 @@ class Plugin: 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}") return { "status": "success", "message": f"Successfully extracted OptiScaler {version} to ~/fgmod", @@ -202,7 +287,10 @@ class Plugin: } except Exception as e: - decky.logger.error(f"Extract failed: {str(e)}") + decky.logger.error(f"Extract failed with exception: {str(e)}") + decky.logger.error(f"Exception type: {type(e).__name__}") + import traceback + decky.logger.error(f"Traceback: {traceback.format_exc()}") return {"status": "error", "message": f"Extract failed: {str(e)}"} async def run_uninstall_fgmod(self) -> dict: @@ -262,8 +350,8 @@ class Plugin: "OptiScaler.dll", "OptiScaler.ini", "dlssg_to_fsr3_amd_is_better.dll", + "fakenvapi.dll", # v0.9.0-pre3+ includes fakenvapi.dll in archive "fakenvapi.ini", - "nvapi64.dll", "nvngx.dll", "amd_fidelityfx_dx12.dll", "amd_fidelityfx_framegeneration_dx12.dll", @@ -271,14 +359,23 @@ class Plugin: "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 for file_name in required_files: if not 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(): + return {"exists": False} + return {"exists": True} else: return {"exists": False} diff --git a/package.json b/package.json index a9e492d..c7ccfec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "decky-framegen", - "version": "0.11.17", + "version": "0.12.6", "description": "This plugin installs and manages OptiScaler, a tool that enhances upscaling and enables frame generation in a range of DirectX 12 games.", "type": "module", "scripts": { @@ -53,24 +53,19 @@ "remote_binary": [ { - "sha256hash": "109d1030c889a70ad30813fdb60c23d08becaab90c6b7d2ae4f7c71338dd7779", - "url": "https://github.com/xXJSONDeruloXx/OptiScaler-Bleeding-Edge/releases/download/OptiScaler_v0.7.9_fsr4_int8/OptiScaler_0.7.9.7z", - "name": "OptiScaler_0.7.9.7z" + "sha256hash": "839e6ab37b1b968a7c1d1ac2ef8d56ed0c783d8fe1322215aa2ceee5fe0c8db3", + "url": "https://github.com/xXJSONDeruloXx/OptiScaler-Bleeding-Edge/releases/download/OptiScaler_v0.9.0_pre_3/Optiscaler_0.9.0-pre3.20250911.7z", + "name": "Optiscaler_0.9.0-pre3.20250911.7z" }, { - "sha256hash": "806020c0444f7841a3a9f661295c16fc482e981e0666d0b9624bf6ccd19c4b5e", - "url": "https://github.com/xXJSONDeruloXx/OptiScaler-Bleeding-Edge/releases/download/dlss-enabler-dlssg-september-20/dlssg_to_fsr3_amd_is_better.dll", - "name": "dlssg_to_fsr3_amd_is_better.dll" + "sha256hash": "9123f83739e7bb39fcb135cafc339606dec78a74c650338ad275ee45c2d59d02", + "url": "https://github.com/xXJSONDeruloXx/OptiScaler-Bleeding-Edge/releases/download/amd-fsr-r-int8/amd_fidelityfx_upscaler_dx12.dll", + "name": "amd_fidelityfx_upscaler_dx12.dll" }, { - "sha256hash": "a4bfa3ec7b4badd93ae5e1ad74a582238082d871f54f38f68e7d9fb6384ce772", - "url": "https://github.com/xXJSONDeruloXx/OptiScaler-Bleeding-Edge/releases/download/OptiScaler_v0.7.8-pre0_20250816_unsigned_dll-13b2b5d0/fakenvapi.ini", - "name": "fakenvapi.ini" - }, - { - "sha256hash": "f4c9e3d35510f2c8b14a41e47721487d3f6663b85441e1be574c45d906b95f06", - "url": "https://github.com/xXJSONDeruloXx/OptiScaler-Bleeding-Edge/releases/download/OptiScaler_v0.7.8-pre0_20250816_unsigned_dll-13b2b5d0/nvapi64.dll", - "name": "nvapi64.dll" + "sha256hash": "c4afb71d179894ac68874d48295e101fedb0dd8e10bcec29163760465706267c", + "url": "https://github.com/optiscaler/OptiPatcher/releases/download/v0.30/OptiPatcher_v0.30.asi", + "name": "OptiPatcher_v0.30.asi" }, { "sha256hash": "1d75e7c1f37f966517f625aa3cc9602ff89d42ad2a7fcbdfa5fc91dab4674149", |
