diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-11 20:49:37 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-11 20:49:37 -0400 |
| commit | 61a0766224a2395f12dff41e09a2f8e78fe71dbe (patch) | |
| tree | 2b13aca6e83df58c16beb9b84e8cbf58d620e8c2 /src/index.tsx | |
| parent | b608ff53bbe8bc673b9729912844d2a150213c5b (diff) | |
| download | decky-lsfg-vk-61a0766224a2395f12dff41e09a2f8e78fe71dbe.tar.gz decky-lsfg-vk-61a0766224a2395f12dff41e09a2f8e78fe71dbe.zip | |
ensure toggles reflect script state
Diffstat (limited to 'src/index.tsx')
| -rwxr-xr-x | src/index.tsx | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/index.tsx b/src/index.tsx index 0c706d8..aeb9e2b 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -22,7 +22,7 @@ const installLsfgVk = callable<[], { success: boolean; error?: string; message?: const uninstallLsfgVk = callable<[], { success: boolean; error?: string; message?: string; removed_files?: string[] }>("uninstall_lsfg_vk"); // Function to check if lsfg-vk is installed -const checkLsfgVkInstalled = callable<[], { installed: boolean; lib_exists: boolean; json_exists: boolean; lib_path: string; json_path: string; error?: string }>("check_lsfg_vk_installed"); +const checkLsfgVkInstalled = callable<[], { installed: boolean; lib_exists: boolean; json_exists: boolean; script_exists: boolean; lib_path: string; json_path: string; script_path: string; error?: string }>("check_lsfg_vk_installed"); // Function to check if Lossless Scaling DLL is available const checkLosslessScalingDll = callable<[], { detected: boolean; path?: string; source?: string; message?: string; error?: string }>("check_lossless_scaling_dll"); @@ -87,6 +87,10 @@ function Content() { setFlowScale(result.config.flow_scale); setHdr(result.config.hdr); setImmediateMode(result.config.immediate_mode); + console.log("Loaded lsfg config:", result.config); + } else { + // If script doesn't exist or can't be read, keep default values + console.log("lsfg config not available, using defaults:", result.error); } } catch (error) { console.error("Error loading lsfg config:", error); @@ -95,8 +99,34 @@ function Content() { checkInstallation(); checkDllDetection(); + + // Always try to load config, regardless of installation status + // This handles cases where the script exists but plugin shows as not installed loadLsfgConfig(); - }, []); const handleInstall = async () => { + }, []); + + // Add a second useEffect to reload config when isInstalled changes + // This ensures UI reflects script state when plugin detects installation + useEffect(() => { + if (isInstalled) { + const reloadConfig = async () => { + try { + const result = await getLsfgConfig(); + if (result.success && result.config) { + setEnableLsfg(result.config.enable_lsfg); + setMultiplier(result.config.multiplier); + setFlowScale(result.config.flow_scale); + setHdr(result.config.hdr); + setImmediateMode(result.config.immediate_mode); + console.log("Reloaded lsfg config after installation detected:", result.config); + } + } catch (error) { + console.error("Error reloading lsfg config:", error); + } + }; + reloadConfig(); + } + }, [isInstalled]); const handleInstall = async () => { setIsInstalling(true); setInstallationStatus("Installing lsfg-vk..."); |
