From 4d6360812d56923b42ee9bd5a13d2f95a1d1c958 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 27 Nov 2025 22:24:13 -0500 Subject: add experimental arm .so and overwrite logic on setup --- py_modules/lsfg_vk/installation.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'py_modules/lsfg_vk/installation.py') diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index 4329d49..f041ea3 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -3,6 +3,7 @@ Installation service for lsfg-vk. """ import os +import platform import shutil import traceback import zipfile @@ -14,7 +15,7 @@ from typing import Dict, Any from .base_service import BaseService from .constants import ( LIB_FILENAME, JSON_FILENAME, ZIP_FILENAME, BIN_DIR, - SO_EXT, JSON_EXT + SO_EXT, JSON_EXT, ARM_LIB_FILENAME ) from .config_schema import ConfigurationManager from .types import InstallationResponse, UninstallationResponse, InstallationCheckResponse @@ -48,6 +49,16 @@ class InstallationService(BaseService): self._extract_and_install_files(zip_path) + # If on ARM, overwrite the .so with the ARM version + if self._is_arm_architecture(): + self.log.info("Detected ARM architecture, using ARM binary") + arm_so_path = plugin_dir / BIN_DIR / ARM_LIB_FILENAME + if arm_so_path.exists(): + shutil.copy2(arm_so_path, self.lib_file) + self.log.info(f"Overwrote with ARM binary: {self.lib_file}") + else: + self.log.warning(f"ARM binary not found at {arm_so_path}, using x86_64 version") + self._create_config_file() self._create_lsfg_launch_script() @@ -64,6 +75,15 @@ class InstallationService(BaseService): self.log.error(error_msg) return self._error_response(InstallationResponse, str(e), message="") + def _is_arm_architecture(self) -> bool: + """Check if running on ARM architecture + + Returns: + True if running on ARM (aarch64/arm64), False otherwise + """ + machine = platform.machine().lower() + return machine in ('aarch64', 'arm64', 'armv8l', 'armv8b') + def _extract_and_install_files(self, zip_path: Path) -> None: """Extract zip file and install files to appropriate locations -- cgit v1.2.3 From 126c0a98558fa31ee00c72663e700321e822823a Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 27 Nov 2025 22:43:00 -0500 Subject: simplify check for arch --- py_modules/lsfg_vk/installation.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'py_modules/lsfg_vk/installation.py') diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index f041ea3..5e9ef73 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -53,11 +53,8 @@ class InstallationService(BaseService): if self._is_arm_architecture(): self.log.info("Detected ARM architecture, using ARM binary") arm_so_path = plugin_dir / BIN_DIR / ARM_LIB_FILENAME - if arm_so_path.exists(): - shutil.copy2(arm_so_path, self.lib_file) - self.log.info(f"Overwrote with ARM binary: {self.lib_file}") - else: - self.log.warning(f"ARM binary not found at {arm_so_path}, using x86_64 version") + shutil.copy2(arm_so_path, self.lib_file) + self.log.info(f"Overwrote with ARM binary: {self.lib_file}") self._create_config_file() -- cgit v1.2.3 From fc8724b850b7c59151522da8391963cc071d49f8 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 27 Nov 2025 22:45:37 -0500 Subject: simplify arch detect --- py_modules/lsfg_vk/installation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'py_modules/lsfg_vk/installation.py') diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index 5e9ef73..4f01be1 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -76,10 +76,9 @@ class InstallationService(BaseService): """Check if running on ARM architecture Returns: - True if running on ARM (aarch64/arm64), False otherwise + True if running on ARM (aarch64), False otherwise """ - machine = platform.machine().lower() - return machine in ('aarch64', 'arm64', 'armv8l', 'armv8b') + return platform.machine().lower() == 'aarch64' def _extract_and_install_files(self, zip_path: Path) -> None: """Extract zip file and install files to appropriate locations -- cgit v1.2.3 From 722ac0cf338d659e2d0553431285fbfb0cd978b5 Mon Sep 17 00:00:00 2001 From: Janleyx <242423638+Janleyx@users.noreply.github.com> Date: Sat, 18 Jul 2026 10:08:42 -0400 Subject: add reproducible Armada ARM64 support --- py_modules/lsfg_vk/installation.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'py_modules/lsfg_vk/installation.py') diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index 4f01be1..29259f7 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -53,7 +53,7 @@ class InstallationService(BaseService): if self._is_arm_architecture(): self.log.info("Detected ARM architecture, using ARM binary") arm_so_path = plugin_dir / BIN_DIR / ARM_LIB_FILENAME - shutil.copy2(arm_so_path, self.lib_file) + self._copy_plugin_file(arm_so_path, self.lib_file) self.log.info(f"Overwrote with ARM binary: {self.lib_file}") self._create_config_file() @@ -78,7 +78,35 @@ class InstallationService(BaseService): Returns: True if running on ARM (aarch64), False otherwise """ - return platform.machine().lower() == 'aarch64' + if platform.machine().lower() in ('aarch64', 'arm64'): + return True + + # Decky runs through FEX on Armada, so Python reports x86_64 even + # though the host is AArch64. Armada exposes this native helper only + # on its ARM image, including inside Decky's FEX rootfs. + if Path('/usr/libexec/armada/device-env').is_file(): + self.log.info("Detected native AArch64 Armada host through device-env") + return True + + # Fall back to the native PID 1 ELF header. e_machine 183 is AArch64. + try: + with Path('/proc/1/exe').open('rb') as host_executable: + elf_header = host_executable.read(20) + if elf_header[:4] == b'\x7fELF' and elf_header[5] in (1, 2): + byte_order = 'little' if elf_header[5] == 1 else 'big' + if int.from_bytes(elf_header[18:20], byte_order) == 183: + self.log.info("Detected native AArch64 host through PID 1") + return True + except OSError as e: + self.log.debug(f"Could not inspect native host architecture: {e}") + + return False + + @staticmethod + def _copy_plugin_file(src_file: Path, dst_file: Path) -> None: + """Copy plugin content without preserving FEX-incompatible metadata.""" + shutil.copyfile(src_file, dst_file) + dst_file.chmod(0o644) def _extract_and_install_files(self, zip_path: Path) -> None: """Extract zip file and install files to appropriate locations @@ -117,7 +145,7 @@ class InstallationService(BaseService): 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._copy_plugin_file(src_file, dst_file) self.log.info(f"Copied {file} to {dst_file}") @@ -147,7 +175,7 @@ class InstallationService(BaseService): 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) + self._copy_plugin_file(src_file, dst_file) def _create_config_file(self) -> None: """Create or update the TOML config file in ~/.config/lsfg-vk with default configuration and detected DLL path -- cgit v1.2.3 From 84c79a3158d596af97dd89c1abffa2dad8ab899c Mon Sep 17 00:00:00 2001 From: Janleyx <242423638+Janleyx@users.noreply.github.com> Date: Sat, 18 Jul 2026 10:27:34 -0400 Subject: gate launch wrapper on Armada host --- py_modules/lsfg_vk/installation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'py_modules/lsfg_vk/installation.py') diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index 29259f7..49ed711 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -15,7 +15,7 @@ from typing import Dict, Any from .base_service import BaseService from .constants import ( LIB_FILENAME, JSON_FILENAME, ZIP_FILENAME, BIN_DIR, - SO_EXT, JSON_EXT, ARM_LIB_FILENAME + SO_EXT, JSON_EXT, ARM_LIB_FILENAME, ARMADA_DEVICE_ENV ) from .config_schema import ConfigurationManager from .types import InstallationResponse, UninstallationResponse, InstallationCheckResponse @@ -84,7 +84,7 @@ class InstallationService(BaseService): # Decky runs through FEX on Armada, so Python reports x86_64 even # though the host is AArch64. Armada exposes this native helper only # on its ARM image, including inside Decky's FEX rootfs. - if Path('/usr/libexec/armada/device-env').is_file(): + if ARMADA_DEVICE_ENV.is_file(): self.log.info("Detected native AArch64 Armada host through device-env") return True -- cgit v1.2.3