code wiki / (root) / nx_nxa_tier_gate.nx

nx_nxa_tier_gate.nx

buildroot/runtime/nx_nxa_tier_gate.nx

26776 B493 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic nxa
docsdependenciesstructsconstsfunctions

about

nx_nxa_tier_gate.nx -- THE GATE FOR THE INGEST TIER LADDER (nx_nxa_tier, /compare/modding MD5). SUBJECT: the nx_nxa_tier ELF, forked for real on the banked pre-TEXM house asset (13 sections, TEXC present, 14,164 verts) -- a real artifact that is READ, never written. Every tooth asserts an exit code or a byte read back out of the emitted tier through the format's own verifier (nxa_find checks the TOC and every section checksum before returning), so a tier that merely EXISTS cannot pass. THE DANGEROUS FAILURES THIS GATE EXISTS TO CATCH: a tier whose weights no longer sum to 4096 or name a joint past the skeleton (the pose player would read that as a broken rig), a tier that quietly dropped SKEL or TEXM (a rig-less or map-less cast member wearing a success receipt), a tier that grew or moved outside the source's own bounding box, and a budget that silently UPSAMPLED. Each has a tooth; three have neg-controls. FIXTURES AT RUNTIME in /tmp/nx_nxa_tier_region_gate_t143/, every output unlinked at SETUP and the unlink asserted, so the gate is idempotent. The truncated fixture and the ladder conf are assembled here, never read from source. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_nxa.nx nx_nxa_tier_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nxnx_nxa.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ tg_exists sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close gv_puts ↻ gv_check gv_puts ↻ sys_mkdir sys_unlinkat sys_mmap ↻ tg_load sys_mmap ↻ sys_read_file ↻ tg_bbox nxa_find

structs

none

consts

21const TG_SUBJECT_DEFAULT: *u8 = "_offc/nx_nxa_tier.elf"
27const TG_SUBJECT_STAGED: *u8 = "nx_nxa_tier.sov.elf.new"
28const TG_SUBJECT_STAGED_UP: *u8 = "../nx_nxa_tier.sov.elf.new"
29const TG_SUBJECT_BUILD: *u8 = "_build/nx_nxa_tier.sov.elf"
30const TG_SUBJECT_BUILD_DOWN: *u8 = "buildroot/_build/nx_nxa_tier.sov.elf"
31const TG_PLAYER: *u8 = "/volume1/homes/elderwesto/nishihost/nx_nxa_play.elf"
32const TG_ASSET: *u8 = "/volume1/homes/elderwesto/nishihost/knowledge/bank/ref9d.nxa.pretexm-20260823"
33const TG_DIR: *u8 = "/tmp/nx_nxa_tier_region_gate_t143"
34const TG_OUT1: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/t1.nxa"
35const TG_OUT2: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/t2.nxa"
36const TG_OUT3: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/over.nxa"
37const TG_OUT4: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/tiny.nxa"
38const TG_OUT5: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/fromtrunc.nxa"
39const TG_TRUNC: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/trunc.nxa"
40const TG_LADDER: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/ladder.conf"
41const TG_PFX: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/lad"
42const TG_LAD16: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/lad_t16k.nxa"
43const TG_LAD4: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/lad_t4k.nxa"
44const TG_LAD1: *u8 = "/tmp/nx_nxa_tier_region_gate_t143/lad_t1k.nxa"
45const TG_LADDER_ROWS: *u8 = "# runtime fixture\ntier|t16k|16384|above the source, must be skipped\ntier|t4k|4096|the rig floor\ntier|t1k|1024|the far tier\n"
47const TG_BUDGET: *u8 = "4000"
48const TG_BUDGET_N: i64 = 4000
49const TG_OVER: *u8 = "20000" // at or above the source vertex count: must REFUSE
50const TG_TINY: *u8 = "2" // under the 3-vertex floor: must REFUSE
51const TG_TRUNC_BYTES: i64 = 600 // TOC intact, payload gone -- the corrupt-input control
52const TG_LADDER_VERB: *u8 = "ladder"
53const TG_EXIT_OK: i64 = 0
54const TG_EXIT_REFUSE: i64 = 3
55const TG_EXEC_NOT_FOUND: i64 = 127
56const TG_CAPCAP: i64 = 262144
57const TG_ARGVN: i64 = 8
58const TG_MODEDIR: i64 = 493
59const TG_WORD: i64 = 8
60const TG_HDR: i64 = 32
61const TG_TOCE: i64 = 32
62const TG_SKIN_W: i64 = 8
63const TG_SKIN_J: i64 = 4
64const TG_Q12: i64 = 4096
65const TG_MIN_VERTS: i64 = 3
66const TG_ASCII_ZERO: i64 = 48
67const TG_ASCII_NINE: i64 = 57
68const TG_BBOX_W: i64 = 6

functions

70func tg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: tg_kvmain
71func tg_rd64(b: *u8, off: i64) -> i64 { let p: *i64 = ((b as i64) + off) as *i64; return p[0] }
called by 2: tg_toc_wlmain
72func tg_exists(path: *u8) -> i64
78func tg_load(path: *u8, lenout: *i64) -> *u8
85func tg_run3(subject: *u8, a1: *u8, a2: *u8, a3: *u8, out: *u8, olen: *i64) -> i64
94func tg_run4(subject: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, out: *u8, olen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
104func tg_run1(subject: *u8, a1: *u8, out: *u8, olen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
112func tg_kv(buf: *u8, n: i64, key: *u8) -> i64
called by 2: tg_hasmain calls 1: tg_slen
138func tg_has(buf: *u8, n: i64, key: *u8) -> i64 { if tg_kv(buf, n, key) >= 0 { return 1 } return 0 }
calls 1: tg_kv
140func tg_toc_wl(b: *u8, tag: i64) -> i64
called by 2: tg_toonmain calls 1: tg_rd64
150func tg_copyable(tag: i64) -> i64
called by 1: main calls 1: nxa_tag4
160func tg_bbox(b: *u8, flen: i64, out: *i64) -> i64
called by 1: main calls 2: nxa_findnxa_tag4
181func tg_write_bytes(path: *u8, b: *u8, n: i64) -> i64
191func tg_region_fixture(path:*u8, unique:i64)->i64
212func tg_regions(subject:*u8,ctr:*i64,cap:*u8,olen:*i64)->i64
236func tg_toon(source:*u8,tier:*u8,budget:i64,ctr:*i64)->i64
261func if_zero(v:i64)->i64{if v==0{return 1};return 0}
called by 1: tg_toon
262func tg_positive(a:*u8)->i64{var n:i64=0;var i:i64=0;while a[i]!=(0 as u8){let c:i64=a[i] as i64;if c<48||c>57{return 0};n=n*10+c-48;i=i+1};return n}
called by 1: main
264func main(argc: i64, argv: *i64) -> i64