code wiki / (root) / nx_xps_gate.nx

nx_xps_gate.nx

buildroot/runtime/nx_xps_gate.nx

18525 B254 linesdepth 3pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_xps_gate.nx -- THE XPS READER GATE (/compare/modding MD2, 2026-09-06). One small rigged model (two bones, one mesh, four vertices, two triangles, one texture) is written at runtime under /tmp/nx_xps_gate/ in THREE spellings the reference readers define: the ascii dialect, the binary dialect at version 3.15 (variable weight counts, no tangents) and the binary dialect at version 1.12 (fixed four weights, a tangent per uv layer). All three must read to BYTE-IDENTICAL NXANIM01 -- the cross-dialect identity is the tooth a reader written from memory cannot pass, because the version-gated tangent and weight-count fields shift every byte after them. The container is read back through nx_nxa.nx's own nxa_find (an independent reader that verifies the TOC and payload checksums), the served pose player is the second witness (zero_weight_verts=0), a truncated binary is refused by name, an unnormalised weight line is fixed and counted, and the declared scale is proven to move the numbers. usage: nx_xps_gate (no args) license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_gatekit_lib.nx nx_nxa.nx nx_xps_lib.nx nx_nxa_write_lib.nx nx_xps_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.nxnx_nxa.nxnx_xps_lib.nxnx_nxa_write_lib.nx

imported by: nobody (leaf or entry point)

structs

none

consts

19const XG_DIR: *u8 = "/tmp/nx_xps_gate"
20const XG_A: *u8 = "/tmp/nx_xps_gate/model.mesh.ascii"
21const XG_B3: *u8 = "/tmp/nx_xps_gate/model_v315.xps"
22const XG_B1: *u8 = "/tmp/nx_xps_gate/model_v112.xps"
23const XG_BCUT: *u8 = "/tmp/nx_xps_gate/model_cut.xps"
24const XG_AW: *u8 = "/tmp/nx_xps_gate/model_badweights.mesh.ascii"
25const XG_OUT_A: *u8 = "/tmp/nx_xps_gate/from_ascii.nxa"
26const XG_OUT_B3: *u8 = "/tmp/nx_xps_gate/from_v315.nxa"
27const XG_OUT_B1: *u8 = "/tmp/nx_xps_gate/from_v112.nxa"
28const XG_OUT_S: *u8 = "/tmp/nx_xps_gate/scaled.nxa"
29const XG_OUT_W: *u8 = "/tmp/nx_xps_gate/badweights.nxa"
30const XG_PLAY: *u8 = "./nx_nxa_play.elf"
31const XG_ELF_LIVE: *u8 = "./nx_xps.elf"
32const XG_ELF_STAGE: *u8 = "./nx_xps.sov.elf.new"
33const XG_ELF_BUILD: *u8 = "buildroot/_build/nx_xps.sov.elf"
34const XG_DIR_MODE: i64 = 493
35const XG_FILE_MODE: i64 = 420
36const XG_CAP: i64 = 65536
37const XG_UNITS: i64 = 100000
38const XG_UNITS_SMALL: i64 = 1000
39const XG_CUT_BYTES: i64 = 10
41const XG_F_0: i64 = 0
42const XG_F_1: i64 = 1065353216
43const XG_F_HALF: i64 = 1056964608
44const XG_F_NEGHALF: i64 = 3204448256
45const XG_F_3Q: i64 = 1061158912
46const XG_F_1Q: i64 = 1048576000

functions

48func xg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
49func xg_cat(d: *u8, o: i64, s: *u8) -> i64 { let n: i64 = xg_len(s); var i: i64 = 0; while i < n { d[o + i] = s[i]; i = i + 1 } return o + n }
50func xg_u8(d: *u8, o: i64, v: i64) -> i64 { d[o] = (v & 255) as u8; return o + 1 }
51func xg_u16(d: *u8, o: i64, v: i64) -> i64 { var x: i64 = v; if x < 0 { x = x + 65536 } d[o] = (x & 255) as u8; d[o + 1] = ((x / 256) & 255) as u8; return o + 2 }
52func xg_u32(d: *u8, o: i64, v: i64) -> i64 { d[o] = (v & 255) as u8; d[o + 1] = ((v / 256) & 255) as u8; d[o + 2] = ((v / 65536) & 255) as u8; d[o + 3] = ((v / 16777216) & 255) as u8; return o + 4 }
53func xg_str(d: *u8, o: i64, s: *u8) -> i64 { let n: i64 = xg_len(s); var q: i64 = xg_u8(d, o, n); return xg_cat(d, q, s) }
54func xg_write_file(path: *u8, b: *u8, n: i64) -> i64
62func xg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
63func xg_same_file(a: *u8, b: *u8) -> i64
76func xg_ascii(path: *u8, bad: i64) -> i64
88func xg_bin(path: *u8, v3: i64, cut: i64) -> i64
128func xg_word_at(path: *u8, tag: *u8, idx: i64, box: *i64) -> i64
138func main(argc: i64, argv: *i64) -> i64