nx_xps_gate.nx
buildroot/runtime/nx_xps_gate.nx
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
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
| 19 | const XG_DIR: *u8 = "/tmp/nx_xps_gate" |
| 20 | const XG_A: *u8 = "/tmp/nx_xps_gate/model.mesh.ascii" |
| 21 | const XG_B3: *u8 = "/tmp/nx_xps_gate/model_v315.xps" |
| 22 | const XG_B1: *u8 = "/tmp/nx_xps_gate/model_v112.xps" |
| 23 | const XG_BCUT: *u8 = "/tmp/nx_xps_gate/model_cut.xps" |
| 24 | const XG_AW: *u8 = "/tmp/nx_xps_gate/model_badweights.mesh.ascii" |
| 25 | const XG_OUT_A: *u8 = "/tmp/nx_xps_gate/from_ascii.nxa" |
| 26 | const XG_OUT_B3: *u8 = "/tmp/nx_xps_gate/from_v315.nxa" |
| 27 | const XG_OUT_B1: *u8 = "/tmp/nx_xps_gate/from_v112.nxa" |
| 28 | const XG_OUT_S: *u8 = "/tmp/nx_xps_gate/scaled.nxa" |
| 29 | const XG_OUT_W: *u8 = "/tmp/nx_xps_gate/badweights.nxa" |
| 30 | const XG_PLAY: *u8 = "./nx_nxa_play.elf" |
| 31 | const XG_ELF_LIVE: *u8 = "./nx_xps.elf" |
| 32 | const XG_ELF_STAGE: *u8 = "./nx_xps.sov.elf.new" |
| 33 | const XG_ELF_BUILD: *u8 = "buildroot/_build/nx_xps.sov.elf" |
| 34 | const XG_DIR_MODE: i64 = 493 |
| 35 | const XG_FILE_MODE: i64 = 420 |
| 36 | const XG_CAP: i64 = 65536 |
| 37 | const XG_UNITS: i64 = 100000 |
| 38 | const XG_UNITS_SMALL: i64 = 1000 |
| 39 | const XG_CUT_BYTES: i64 = 10 |
| 41 | const XG_F_0: i64 = 0 |
| 42 | const XG_F_1: i64 = 1065353216 |
| 43 | const XG_F_HALF: i64 = 1056964608 |
| 44 | const XG_F_NEGHALF: i64 = 3204448256 |
| 45 | const XG_F_3Q: i64 = 1061158912 |
| 46 | const XG_F_1Q: i64 = 1048576000 |
functions
| 48 | func xg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 49 | func 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 } |
| 50 | func xg_u8(d: *u8, o: i64, v: i64) -> i64 { d[o] = (v & 255) as u8; return o + 1 } |
| 51 | func 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 } |
| 52 | func 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 } |
| 53 | func 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) } |
| 54 | func xg_write_file(path: *u8, b: *u8, n: i64) -> i64 |
| 62 | func xg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 63 | func xg_same_file(a: *u8, b: *u8) -> i64 |
| 76 | func xg_ascii(path: *u8, bad: i64) -> i64 |
| 88 | func xg_bin(path: *u8, v3: i64, cut: i64) -> i64 |
| 128 | func xg_word_at(path: *u8, tag: *u8, idx: i64, box: *i64) -> i64 |
| 138 | func main(argc: i64, argv: *i64) -> i64 |