summaryrefslogtreecommitdiff
path: root/py_modules/lsfg_vk/configuration.py
diff options
context:
space:
mode:
Diffstat (limited to 'py_modules/lsfg_vk/configuration.py')
-rw-r--r--py_modules/lsfg_vk/configuration.py82
1 files changed, 78 insertions, 4 deletions
diff --git a/py_modules/lsfg_vk/configuration.py b/py_modules/lsfg_vk/configuration.py
index 255092a..ae0194b 100644
--- a/py_modules/lsfg_vk/configuration.py
+++ b/py_modules/lsfg_vk/configuration.py
@@ -68,7 +68,9 @@ class ConfigurationService(BaseService):
def update_config(self, enable: bool, dll: str, multiplier: int, flow_scale: float,
performance_mode: bool, hdr_mode: bool,
experimental_present_mode: str = "",
- experimental_fps_limit: int = 0) -> ConfigurationResponse:
+ experimental_fps_limit: int = 0,
+ enable_wow64: bool = False,
+ disable_steamdeck_mode: bool = False) -> ConfigurationResponse:
"""Update TOML configuration
Args:
@@ -80,6 +82,8 @@ class ConfigurationService(BaseService):
hdr_mode: Whether to enable HDR mode
experimental_present_mode: Experimental Vulkan present mode override
experimental_fps_limit: Experimental FPS limit for DXVK games
+ enable_wow64: Whether to enable PROTON_USE_WOW64=1 for 32-bit games
+ disable_steamdeck_mode: Whether to disable Steam Deck mode
Returns:
ConfigurationResponse with success status
@@ -88,23 +92,29 @@ class ConfigurationService(BaseService):
# Create configuration from individual arguments
config = ConfigurationManager.create_config_from_args(
enable, dll, multiplier, flow_scale, performance_mode, hdr_mode,
- experimental_present_mode, experimental_fps_limit
+ experimental_present_mode, experimental_fps_limit, enable_wow64, disable_steamdeck_mode
)
# Generate TOML content using centralized manager
toml_content = ConfigurationManager.generate_toml_content(config)
- # Ensure config directory exists
+ # Ensure config directory exists
self.config_dir.mkdir(parents=True, exist_ok=True)
# Write the updated config directly to preserve inode for file watchers
self._write_file(self.config_file_path, toml_content, 0o644)
+ # Update the launch script with the new configuration
+ script_result = self.update_lsfg_script(config)
+ if not script_result["success"]:
+ self.log.warning(f"Failed to update launch script: {script_result['error']}")
+
self.log.info(f"Updated lsfg TOML configuration: enable={enable}, "
f"dll='{dll}', multiplier={multiplier}, flow_scale={flow_scale}, "
f"performance_mode={performance_mode}, hdr_mode={hdr_mode}, "
f"experimental_present_mode='{experimental_present_mode}', "
- f"experimental_fps_limit={experimental_fps_limit}")
+ f"experimental_fps_limit={experimental_fps_limit}, "
+ f"enable_wow64={enable_wow64}, disable_steamdeck_mode={disable_steamdeck_mode}")
return {
"success": True,
@@ -182,3 +192,67 @@ class ConfigurationService(BaseService):
"message": None,
"error": str(e)
}
+
+ def update_lsfg_script(self, config: ConfigurationData) -> ConfigurationResponse:
+ """Update the ~/lsfg launch script with current configuration
+
+ Args:
+ config: Configuration data to apply to the script
+
+ Returns:
+ ConfigurationResponse indicating success or failure
+ """
+ try:
+ script_content = self._generate_script_content(config)
+
+ # Write the script file
+ self._write_file(self.lsfg_script_path, script_content, 0o755)
+
+ self.log.info(f"Updated lsfg launch script at {self.lsfg_script_path}")
+
+ return {
+ "success": True,
+ "config": config,
+ "message": "Launch script updated successfully",
+ "error": None
+ }
+
+ except Exception as e:
+ error_msg = f"Error updating launch script: {str(e)}"
+ self.log.error(error_msg)
+ return {
+ "success": False,
+ "config": None,
+ "message": None,
+ "error": str(e)
+ }
+
+ def _generate_script_content(self, config: ConfigurationData) -> str:
+ """Generate the content for the ~/lsfg launch script
+
+ Args:
+ config: Configuration data to apply to the script
+
+ Returns:
+ The complete script content as a string
+ """
+ lines = [
+ "#!/bin/bash",
+ "# lsfg-vk launch script generated by decky-lossless-scaling-vk plugin",
+ "# This script sets up the environment for lsfg-vk to work with the plugin configuration"
+ ]
+
+ # Add optional export statements based on configuration
+ if config.get("enable_wow64", False):
+ lines.append("export PROTON_USE_WOW64=1")
+
+ if config.get("disable_steamdeck_mode", False):
+ lines.append("export SteamDeck=0")
+
+ # Always add the LSFG_PROCESS export
+ lines.append("export LSFG_PROCESS=decky-lsfg-vk")
+
+ # Add the execution line
+ lines.append('exec "$@"')
+
+ return "\n".join(lines) + "\n"