From 363fe07ad4cd514d907647ee0eda2310f6efa3c0 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Tue, 17 Nov 2026 17:03:49 +0000 Subject: frame-steamos: fix a couple of bugs It's possible to hang after a reset waiting for the first frame if that frame never arrives. This adds calls to the existing decoder watchdog handler to ensure this is recoverable. Sub-optimal but better than nothing. Shouldn't happen normally anyway, and the patch is still worth it as it fixes genuine repeat resets in much more common cases. Additionally, the headset can send an ack even when there is nothing to ack, and it acks frame ID 0 in that case, this breaks the steamvr patch which keeps the ACK cutoff at all times (it can cause things to get stuck in 3.3FPS mode). --- src/steamvr_patches/__init__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/steamvr_patches/__init__.py') diff --git a/src/steamvr_patches/__init__.py b/src/steamvr_patches/__init__.py index 8ad589a..0daea79 100644 --- a/src/steamvr_patches/__init__.py +++ b/src/steamvr_patches/__init__.py @@ -40,6 +40,7 @@ class PatchSet(BaseModel): target: str targets: list[FilePatch] + template: Path | None = None @field_validator("targets") @classmethod @@ -52,6 +53,8 @@ class PatchSet(BaseModel): @classmethod def parse(cls, config: dict, directory: Path) -> Self: result = cls.model_validate(config) + if result.template is not None: + result.template = directory / result.template for target in result.targets: if target.compiled is not None: target.compiled.sources = [ @@ -87,8 +90,9 @@ def compile_patch(config: FilePatch, source: BinaryIO, output: Path) -> dict: } -def render(patches: dict[str, dict]) -> str: - template = files("steamvr_patches").joinpath("template.py").read_text() +def render(patches: dict[str, dict], template: str | None = None) -> str: + if template is None: + template = files("steamvr_patches").joinpath("template.py").read_text() placeholder = "PATCH_DATA = {}" if template.count(placeholder) != 1: raise ValueError("missing or duplicate runtime patch-table placeholder") @@ -121,11 +125,17 @@ def generate(patch_data: Path, input_root: Path) -> str: patches = {} with tempfile.TemporaryDirectory(prefix="generate-patcher-") as temporary: for index, config in enumerate(definition.targets): - with (input_root / config.path).open("rb") as source: + relative = ( + config.path.relative_to("/") + if config.path.is_absolute() + else config.path + ) + with (input_root / relative).open("rb") as source: patches[config.path.as_posix()] = compile_patch( config, source, Path(temporary) / str(index) ) - return render(patches) + template = definition.template.read_text() if definition.template else None + return render(patches, template) def main() -> None: -- cgit v1.3.1