diff options
| -rw-r--r-- | py_modules/lsfg_vk/configuration.py | 25 | ||||
| -rw-r--r-- | py_modules/lsfg_vk/plugin.py | 10 | ||||
| -rw-r--r-- | src/components/SmartClipboardButton.tsx | 9 | ||||
| -rw-r--r-- | src/components/UsageInstructions.tsx | 42 |
4 files changed, 24 insertions, 62 deletions
diff --git a/py_modules/lsfg_vk/configuration.py b/py_modules/lsfg_vk/configuration.py index e479f43..f7a171a 100644 --- a/py_modules/lsfg_vk/configuration.py +++ b/py_modules/lsfg_vk/configuration.py @@ -8,6 +8,7 @@ from typing import Dict, Any from .base_service import BaseService from .config_schema import ConfigurationManager, CONFIG_SCHEMA, ProfileData, DEFAULT_PROFILE_NAME from .config_schema_generated import ConfigurationData, get_script_generation_logic +from .constants import ARMADA_DEVICE_ENV, ARMADA_GAME_LAUNCH from .types import ConfigurationResponse, ProfilesResponse, ProfileResponse @@ -123,10 +124,8 @@ class ConfigurationService(BaseService): generate_script_lines = get_script_generation_logic() lines.extend(generate_script_lines(config)) - lines.extend([ - "export LSFG_PROCESS=decky-lsfg-vk", - 'exec "$@"' - ]) + lines.append("export LSFG_PROCESS=decky-lsfg-vk") + lines.extend(self._generate_game_launch_lines()) return "\n".join(lines) + "\n" @@ -154,12 +153,22 @@ class ConfigurationService(BaseService): generate_script_lines = get_script_generation_logic() lines.extend(generate_script_lines(merged_config)) - lines.extend([ - f"export LSFG_PROCESS={current_profile}", - 'exec "$@"' - ]) + lines.append(f"export LSFG_PROCESS={current_profile}") + lines.extend(self._generate_game_launch_lines()) return "\n".join(lines) + "\n" + + @staticmethod + def _generate_game_launch_lines() -> list[str]: + """Generate a portable exec block with Armada's host wrapper.""" + device_env = ARMADA_DEVICE_ENV.as_posix() + game_launch = ARMADA_GAME_LAUNCH.as_posix() + return [ + f'if [ -f "{device_env}" ] && [ -x "{game_launch}" ]; then', + f' exec "{game_launch}" "$@"', + "fi", + 'exec "$@"', + ] def _get_profile_data(self) -> ProfileData: """Get current profile data from config file""" diff --git a/py_modules/lsfg_vk/plugin.py b/py_modules/lsfg_vk/plugin.py index 74c1677..cb59b4f 100644 --- a/py_modules/lsfg_vk/plugin.py +++ b/py_modules/lsfg_vk/plugin.py @@ -18,7 +18,6 @@ from .dll_detection import DllDetectionService from .configuration import ConfigurationService from .config_schema import ConfigurationManager from .flatpak_service import FlatpakService -from .constants import ARMADA_DEVICE_ENV, ARMADA_GAME_LAUNCH class Plugin: @@ -256,15 +255,6 @@ class Plugin: Returns: Dict containing the launch option string and instructions """ - # Decky runs through FEX on Armada, so the guest OS identity is not a - # reliable host check. Require both Armada's native marker and wrapper. - if ARMADA_DEVICE_ENV.is_file() and ARMADA_GAME_LAUNCH.is_file(): - return { - "launch_option": f"~/lsfg {ARMADA_GAME_LAUNCH} %command%", - "instructions": "Use this combined command in Steam Properties, preserving Armada's game-launch wrapper", - "explanation": "LSFG sets its environment first, then Armada applies the game's FEX profile and launches Proton" - } - return { "launch_option": "~/lsfg %command%", "instructions": "Add this to your game's launch options in Steam Properties", diff --git a/src/components/SmartClipboardButton.tsx b/src/components/SmartClipboardButton.tsx index 7217e83..c90515a 100644 --- a/src/components/SmartClipboardButton.tsx +++ b/src/components/SmartClipboardButton.tsx @@ -20,11 +20,12 @@ export function SmartClipboardButton() { }, [showSuccess]); const getLaunchOptionText = async (): Promise<string> => { - const result = await getLaunchOption(); - if (!result.launch_option) { - throw new Error("Launch option is unavailable"); + try { + const result = await getLaunchOption(); + return result.launch_option || "~/lsfg %command%"; + } catch (error) { + return "~/lsfg %command%"; } - return result.launch_option; }; const copyToClipboard = async () => { diff --git a/src/components/UsageInstructions.tsx b/src/components/UsageInstructions.tsx index 02d0eb3..5f032b8 100644 --- a/src/components/UsageInstructions.tsx +++ b/src/components/UsageInstructions.tsx @@ -1,31 +1,6 @@ -import { useEffect, useState } from "react"; import { PanelSectionRow } from "@decky/ui"; -import { getLaunchOption } from "../api/lsfgApi"; export function UsageInstructions() { - const [launchOption, setLaunchOption] = useState("~/lsfg %command%"); - const [launchExplanation, setLaunchExplanation] = useState( - "The LSFG wrapper configures frame generation before launching the game." - ); - - useEffect(() => { - let active = true; - - getLaunchOption() - .then((result) => { - if (!active) return; - if (result.launch_option) setLaunchOption(result.launch_option); - if (result.explanation) setLaunchExplanation(result.explanation); - }) - .catch(() => { - // Keep the standard launch option visible if the backend is unavailable. - }); - - return () => { - active = false; - }; - }, []); - return ( <> <PanelSectionRow> @@ -72,20 +47,7 @@ export function UsageInstructions() { textAlign: "center" }} > - <strong>{launchOption}</strong> - </div> - </PanelSectionRow> - - <PanelSectionRow> - <div - style={{ - fontSize: "11px", - lineHeight: "1.3", - opacity: "0.7", - marginTop: "4px" - }} - > - {launchExplanation} + <strong>~/lsfg %command%</strong> </div> </PanelSectionRow> @@ -98,7 +60,7 @@ export function UsageInstructions() { marginTop: "8px" }} > - The configuration is stored in ~/.config/lsfg-vk/conf.toml and hot-reloads while games are running. +The configuration is stored in ~/.config/lsfg-vk/conf.toml and hot-reloads while games are running. </div> </PanelSectionRow> </> |
