summaryrefslogtreecommitdiff
path: root/py_modules
diff options
context:
space:
mode:
authorKurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>2025-07-30 12:55:00 -0700
committerGitHub <noreply@github.com>2025-07-30 12:55:00 -0700
commitda9c3c8ec04933e921cce0929734a096b7e544fc (patch)
tree808580ac03d3a2815055b4ed219562e7affd16df /py_modules
parentb04fa027f7291710359bb6c4a8c1d0ebb85d53e5 (diff)
parente8dc90a60ff4d9da00397dd8dbdff72bae0e9359 (diff)
downloaddecky-lsfg-vk-da9c3c8ec04933e921cce0929734a096b7e544fc.tar.gz
decky-lsfg-vk-da9c3c8ec04933e921cce0929734a096b7e544fc.zip
Merge pull request #102 from xXJSONDeruloXx/lsfg-vk-9.0-upstream
initial test to build on noui package based on upstream build of lsfg…
Diffstat (limited to 'py_modules')
-rw-r--r--py_modules/lsfg_vk/constants.py2
-rw-r--r--py_modules/lsfg_vk/installation.py37
2 files changed, 37 insertions, 2 deletions
diff --git a/py_modules/lsfg_vk/constants.py b/py_modules/lsfg_vk/constants.py
index 252c7a5..69989c1 100644
--- a/py_modules/lsfg_vk/constants.py
+++ b/py_modules/lsfg_vk/constants.py
@@ -15,7 +15,7 @@ SCRIPT_NAME = "lsfg"
CONFIG_FILENAME = "conf.toml"
LIB_FILENAME = "liblsfg-vk.so"
JSON_FILENAME = "VkLayer_LS_frame_generation.json"
-ZIP_FILENAME = "lsfg-vk_archlinux.zip"
+ZIP_FILENAME = "lsfg-vk_noui.zip"
# File extensions
SO_EXT = ".so"
diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py
index 996a03f..b0e05ad 100644
--- a/py_modules/lsfg_vk/installation.py
+++ b/py_modules/lsfg_vk/installation.py
@@ -6,6 +6,7 @@ import os
import shutil
import zipfile
import tempfile
+import json
from pathlib import Path
from typing import Dict, Any
@@ -102,9 +103,43 @@ class InstallationService(BaseService):
dst_dir = dest_map.get(file_path.suffix)
if dst_dir:
dst_file = dst_dir / file
- shutil.copy2(src_file, dst_file)
+
+ # Special handling for JSON files - need to modify library_path
+ if file_path.suffix == JSON_EXT and file == JSON_FILENAME:
+ self._copy_and_fix_json_file(src_file, dst_file)
+ else:
+ shutil.copy2(src_file, dst_file)
+
self.log.info(f"Copied {file} to {dst_file}")
+ def _copy_and_fix_json_file(self, src_file: Path, dst_file: Path) -> None:
+ """Copy JSON file and fix the library_path to use relative path
+
+ Args:
+ src_file: Source JSON file path
+ dst_file: Destination JSON file path
+ """
+ try:
+ # Read the JSON file
+ with open(src_file, 'r') as f:
+ json_data = json.load(f)
+
+ # Fix the library_path from "liblsfg-vk.so" to "../../../lib/liblsfg-vk.so"
+ if 'layer' in json_data and 'library_path' in json_data['layer']:
+ current_path = json_data['layer']['library_path']
+ if current_path == "liblsfg-vk.so":
+ json_data['layer']['library_path'] = "../../../lib/liblsfg-vk.so"
+ self.log.info(f"Fixed library_path from '{current_path}' to '../../../lib/liblsfg-vk.so'")
+
+ # Write the modified JSON file
+ with open(dst_file, 'w') as f:
+ json.dump(json_data, f, indent=2)
+
+ except (json.JSONDecodeError, KeyError, OSError) as e:
+ self.log.error(f"Error fixing JSON file {src_file}: {e}")
+ # Fallback to simple copy if JSON modification fails
+ shutil.copy2(src_file, dst_file)
+
def _create_config_file(self) -> None:
"""Create the TOML config file in ~/.config/lsfg-vk with default configuration and detected DLL path"""
# Import here to avoid circular imports