#!/usr/bin/env python3 """The two argument-block templates of a preset D / E model (enc0.args, hkpn.args) without a capture. usage: rr_templates.py NVNGX_DLSSD_DLL D|E OUT_DIR rr_templates.py NVNGX_DLSSD_DLL D|E --check MODEL_DIR... (compare with templates compile_rr.py took from captures) engine/runtime_rr.inc fills every field of the two blocks that depends on the frame, the geometry or the bound inputs. Across captures of different sizes, inputs and frames (2026-10-14: capD, capDT, capD4K, capDX*, capE, capE3) what is left is the same few constants for both presets, plus two floats of encoder 0 (bytes 540 and 544) that differ between the presets. NGX sets those two in code: `sub ecx, 4; je D; cmp ecx, 1; jne ...; mov [rbx + X], E0; mov [rbx + X + 4], E1; jmp ...; D: mov [rbx + X], D0; mov [rbx + X + 4], D1` (ecx = the preset), which find_floats() looks up in the DLL. The templates are written on the user's machine and are never packaged. """ import re import struct import sys from pathlib import Path ENC0_BYTES, HKPN_BYTES = 1032, 480 # (offset, packed value) of the constants the runtime keeps ENC0_CONST = [(360, struct.pack('