diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-08-03 14:32:35 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-08-03 14:32:35 -0400 |
| commit | e0681b06efdee3dcacb6ddfca515d947b802faff (patch) | |
| tree | 52c1cad716b92c784d2946d063cc36b34255ea5e /py_modules/lsfg_vk/configuration.py | |
| parent | 8df4d48cd89d636940982e60bb51b688226e630c (diff) | |
| parent | b936baab13b026d4355844d94616a622753a7370 (diff) | |
| download | decky-lsfg-vk-e0681b06efdee3dcacb6ddfca515d947b802faff.tar.gz decky-lsfg-vk-e0681b06efdee3dcacb6ddfca515d947b802faff.zip | |
Merge main and normalize translation locale handling
Diffstat (limited to 'py_modules/lsfg_vk/configuration.py')
| -rw-r--r-- | py_modules/lsfg_vk/configuration.py | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/py_modules/lsfg_vk/configuration.py b/py_modules/lsfg_vk/configuration.py index 74a3694..fce3738 100644 --- a/py_modules/lsfg_vk/configuration.py +++ b/py_modules/lsfg_vk/configuration.py @@ -8,7 +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 .configuration_helpers_generated import log_configuration_update +from .constants import ARMADA_DEVICE_ENV, ARMADA_GAME_LAUNCH from .types import ConfigurationResponse, ProfilesResponse, ProfileResponse @@ -81,29 +81,6 @@ class ConfigurationService(BaseService): self.log.error(error_msg) return self._error_response(ConfigurationResponse, str(e), config=None) - def update_config(self, **kwargs) -> ConfigurationResponse: - """Update TOML configuration using generated schema - SIMPLIFIED WITH GENERATED CODE - - Args: - **kwargs: Configuration field values (see shared_config.py for available fields) - - Returns: - ConfigurationResponse with success status - """ - try: - config = ConfigurationManager.create_config_from_args(**kwargs) - - return self.update_config_from_dict(config) - - except (OSError, IOError) as e: - error_msg = f"Error updating lsfg config: {str(e)}" - self.log.error(error_msg) - return self._error_response(ConfigurationResponse, str(e), config=None) - except ValueError as e: - error_msg = f"Invalid configuration arguments: {str(e)}" - self.log.error(error_msg) - return self._error_response(ConfigurationResponse, str(e), config=None) - def update_lsfg_script(self, config: ConfigurationData) -> ConfigurationResponse: """Update the ~/lsfg launch script with current configuration @@ -147,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" @@ -178,12 +153,28 @@ 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'armada_game_launch="{game_launch}"', + 'for argument in "$@"; do', + ' if [ "$argument" = "$armada_game_launch" ]; then', + ' exec "$@"', + " fi", + "done", + f'if [ -f "{device_env}" ] && [ -x "$armada_game_launch" ]; then', + ' exec "$armada_game_launch" "$@"', + "fi", + 'exec "$@"', + ] def _get_profile_data(self) -> ProfileData: """Get current profile data from config file""" |
