From bb35f18ccf17437ee484f92319da314164b4499b Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Fri, 3 Apr 2026 09:38:53 -0400 Subject: chore: update OptiScaler to v0.9.0-final - package.json: point remote_binary at official optiscaler/OptiScaler v0.9 release (Optiscaler_0.9.0-final.20260401._AF.7z) with updated sha256 hash; drop staging-repo pre11 URL - main.py (_modify_optiscaler_ini): FGType was split into FGInput + FGOutput in the final release INI; replace the old FGType=nukems substitution with FGInput=nukems and FGOutput=nukems so defaults are actually applied - main.py (_manual_patch_directory_impl): copy D3D12_Optiscaler/ directory to the game folder (OptiScaler.ini explicitly requires it next to the exe for FSR4/FidelityFX DX12 path) - main.py (_manual_unpatch_directory_impl): remove D3D12_Optiscaler/ directory when cleaning a game folder - fgmod.sh: cp -r D3D12_Optiscaler/ to game folder during launch-time install, matching the per-game patch behaviour above - Scrub stale pre3/pre4/pre11 references from comments throughout --- main.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index ddee8ba..3d63849 100644 --- a/main.py +++ b/main.py @@ -156,8 +156,11 @@ class Plugin: with open(ini_file, 'r') as f: content = f.read() - # Replace FGType=auto with FGType=nukems - updated_content = re.sub(r'FGType\s*=\s*auto', 'FGType=nukems', content) + # Replace FGInput=auto with FGInput=nukems (final v0.9+ split FGType into FGInput/FGOutput) + updated_content = re.sub(r'FGInput\s*=\s*auto', 'FGInput=nukems', content) + + # Replace FGOutput=auto with FGOutput=nukems + updated_content = re.sub(r'FGOutput\s*=\s*auto', 'FGOutput=nukems', updated_content) # Replace Fsr4Update=auto with Fsr4Update=true updated_content = re.sub(r'Fsr4Update\s*=\s*auto', 'Fsr4Update=true', updated_content) @@ -174,7 +177,7 @@ class Plugin: with open(ini_file, 'w') as f: f.write(updated_content) - decky.logger.info("Modified OptiScaler.ini to set FGType=nukems, Fsr4Update=true, LoadAsiPlugins=true, Path=plugins, UseHQFont=false") + decky.logger.info("Modified OptiScaler.ini to set FGInput=nukems, FGOutput=nukems, Fsr4Update=true, LoadAsiPlugins=true, Path=plugins, UseHQFont=false") return True else: decky.logger.warning(f"OptiScaler.ini not found at {ini_file}") @@ -267,7 +270,7 @@ 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 + # Note: v0.9.0-final 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 @@ -433,7 +436,7 @@ 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.dll", # v0.9.0-final includes fakenvapi.dll in archive "fakenvapi.ini", "nvngx.dll", "amd_fidelityfx_dx12.dll", @@ -442,8 +445,8 @@ 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 + "libxess_fg.dll", # added in v0.9.0 + "libxell.dll", # added in v0.9.0 "fgmod", "fgmod-uninstaller.sh", "update-optiscaler-config.py" @@ -549,6 +552,14 @@ class Plugin: else: decky.logger.warning("Plugins directory missing in fgmod bundle") + d3d12_src = fgmod_path / "D3D12_Optiscaler" + d3d12_dest = directory / "D3D12_Optiscaler" + if d3d12_src.exists(): + shutil.copytree(d3d12_src, d3d12_dest, dirs_exist_ok=True) + decky.logger.info(f"Copied D3D12_Optiscaler directory to {d3d12_dest}") + else: + decky.logger.warning("D3D12_Optiscaler directory missing in fgmod bundle") + copied_support = [] missing_support = [] for filename in SUPPORT_FILES: @@ -611,6 +622,11 @@ class Plugin: shutil.rmtree(plugins_dir, ignore_errors=True) decky.logger.info(f"Removed plugins directory at {plugins_dir}") + d3d12_dir = directory / "D3D12_Optiscaler" + if d3d12_dir.exists(): + shutil.rmtree(d3d12_dir, ignore_errors=True) + decky.logger.info(f"Removed D3D12_Optiscaler directory from {d3d12_dir}") + restored_backups = [] for dll in ORIGINAL_DLL_BACKUPS: backup = directory / f"{dll}.b" -- cgit v1.2.3 From d1ce48eba2a38909f33df965ab672249156dc47d Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Fri, 3 Apr 2026 09:43:16 -0400 Subject: =?UTF-8?q?fix:=20migrate=20per-game=20FGType=20=E2=86=92=20FGInpu?= =?UTF-8?q?t/FGOutput=20on=20patch=20and=20launch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Already-patched games have OptiScaler.ini entries using the old FGType key (e.g. FGType=nukems). The v0.9-final DLL no longer recognises FGType and silently falls back to nofg, breaking frame gen without any error. Add _migrate_optiscaler_ini() in main.py which: - detects FGType= in a per-game INI - if FGInput is absent: replaces the single FGType line with both FGInput= and FGOutput= - if FGInput is already present (INI already migrated): just drops the stale FGType line - is a no-op when FGType is not present (fresh installs, already migrated) Call the migration from _manual_patch_directory_impl immediately before _disable_hq_font_auto so any re-patch via the GUI heals the INI. Mirror the same logic in fgmod.sh so that games using the launch wrapper are migrated automatically on the very next launch, with no manual re-patch required. --- main.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'main.py') diff --git a/main.py b/main.py index 3d63849..4092ab0 100644 --- a/main.py +++ b/main.py @@ -128,6 +128,50 @@ class Plugin: decky.logger.error(f"Failed to copy launcher scripts: {e}") return False + def _migrate_optiscaler_ini(self, ini_file): + """Migrate pre-v0.9-final OptiScaler.ini: replace FGType with FGInput + FGOutput. + + v0.9-final split the single FGType key into separate FGInput and FGOutput keys. + Games already patched with an older build will have FGType= in their + per-game INI but no FGInput/FGOutput entries, causing the new DLL to silently + fall back to nofg. This migration runs at patch-time and at every fgmod.sh + launch so users never have to manually touch their INI. + """ + try: + if not ini_file.exists(): + return False + + with open(ini_file, 'r') as f: + content = f.read() + + fg_type_match = re.search(r'^FGType\s*=\s*(\S+)', content, re.MULTILINE) + if not fg_type_match: + return True # Nothing to migrate + + fg_value = fg_type_match.group(1) + + if re.search(r'^FGInput\s*=', content, re.MULTILINE): + # FGInput already present (INI already in v0.9-final format); + # just remove the now-unknown FGType line. + content = re.sub(r'^FGType\s*=\s*\S+\n?', '', content, flags=re.MULTILINE) + decky.logger.info(f"Removed stale FGType from {ini_file} (FGInput already present)") + else: + # Replace the single FGType=X line with FGInput=X then FGOutput=X + content = re.sub( + r'^FGType\s*=\s*\S+', + f'FGInput={fg_value}\nFGOutput={fg_value}', + content, + flags=re.MULTILINE + ) + decky.logger.info(f"Migrated FGType={fg_value} → FGInput={fg_value}, FGOutput={fg_value} in {ini_file}") + + with open(ini_file, 'w') as f: + f.write(content) + return True + except Exception as e: + decky.logger.error(f"Failed to migrate OptiScaler.ini: {e}") + return False + def _disable_hq_font_auto(self, ini_file): """Disable the new HQ font auto mode to avoid missing font assertions on Wine/Proton.""" try: @@ -542,6 +586,7 @@ class Plugin: decky.logger.warning("No OptiScaler.ini found to copy") if target_ini.exists(): + self._migrate_optiscaler_ini(target_ini) self._disable_hq_font_auto(target_ini) plugins_src = fgmod_path / "plugins" -- cgit v1.2.3 From a6955e828b1dee7b14f8021a8a470dd51d77e33e Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Fri, 3 Apr 2026 09:52:39 -0400 Subject: feat: proxy DLL name picker Expose the proxy DLL rename as a user-selectable option across all injection paths. Previously hardcoded to dxgi.dll with no way to change it short of manually prepending DLL= to the Steam launch option. src/utils/constants.ts - Add PROXY_DLL_OPTIONS (7 entries matching _create_renamed_copies) each with a label and one-line hint - Add DEFAULT_PROXY_DLL constant (dxgi.dll) and ProxyDllValue type src/api/index.ts - runManualPatch now takes [directory, dll_name] so the chosen name reaches the backend src/components/OptiScalerControls.tsx - Own dllName state (default: dxgi.dll) - Render a DropdownItem (visible when installed) showing the 7 options with the selected option's hint as the description - Pass dllName down to both ClipboardCommands and ManualPatchControls src/components/ClipboardCommands.tsx - Accept dllName prop - Patch command is plain ~/fgmod/fgmod %command% for the default; prefixed DLL= ~/fgmod/fgmod %command% for any other choice src/components/CustomPathOverride.tsx - Accept dllName prop - Pass it to runManualPatch - Manual launch cmd clipboard button builds WINEDLLOVERRIDES="=n,b" dynamically; emits bare SteamDeck=0 %command% for OptiScaler.asi (ASI loader path needs no Wine DLL override) main.py - Add VALID_DLL_NAMES set (whitelist matching the renames dir) - manual_patch_directory validates dll_name against the whitelist and returns an error for unknown values - _manual_patch_directory_impl accepts dll_name param; removes the hardcoded "dxgi.dll" line defaults/assets/fgmod.sh - Fix longstanding bug: WINEDLLOVERRIDES was hardcoded to dxgi=n,b regardless of the DLL= env var selection. Now derives the stem from $dll_name and skips the override entirely for .asi files. --- main.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 4092ab0..ea80561 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,16 @@ from pathlib import Path # Set to False or comment out this constant to skip the overwrite by default. UPSCALER_OVERWRITE_ENABLED = True +VALID_DLL_NAMES = { + "dxgi.dll", + "winmm.dll", + "dbghelp.dll", + "version.dll", + "wininet.dll", + "winhttp.dll", + "OptiScaler.asi", +} + INJECTOR_FILENAMES = [ "dxgi.dll", "winmm.dll", @@ -523,7 +533,7 @@ class Plugin: decky.logger.info(f"Resolved directory {directory} to absolute path {target}") return target - def _manual_patch_directory_impl(self, directory: Path) -> dict: + def _manual_patch_directory_impl(self, directory: Path, dll_name: str = "dxgi.dll") -> dict: fgmod_path = Path(decky.HOME) / "fgmod" if not fgmod_path.exists(): return { @@ -538,7 +548,6 @@ class Plugin: "message": "OptiScaler.dll not found in ~/fgmod. Reinstall OptiScaler.", } - dll_name = "dxgi.dll" preserve_ini = True try: @@ -772,14 +781,16 @@ class Plugin: async def log_error(self, error: str) -> None: decky.logger.error(f"FRONTEND: {error}") - async def manual_patch_directory(self, directory: str) -> dict: + async def manual_patch_directory(self, directory: str, dll_name: str = "dxgi.dll") -> dict: + if dll_name not in VALID_DLL_NAMES: + return {"status": "error", "message": f"Invalid proxy DLL name: {dll_name}"} try: target_dir = self._resolve_target_directory(directory) except (FileNotFoundError, NotADirectoryError, PermissionError) as exc: decky.logger.error(f"Manual patch validation failed: {exc}") return {"status": "error", "message": str(exc)} - return self._manual_patch_directory_impl(target_dir) + return self._manual_patch_directory_impl(target_dir, dll_name) async def manual_unpatch_directory(self, directory: str) -> dict: try: -- cgit v1.2.3