code wiki / (root) / nx_varfacts_candidate_t139.nx

nx_varfacts_candidate_t139.nx

buildroot/runtime/nx_varfacts_candidate_t139.nx

30183 B729 linesdepth 6pulls 8 transitivereach 4 importersview sourcekind librarytopic varfacts
docsdependenciesstructsconstsfunctions

about

nx_varfacts_lib.nx -- VaM .var PACKAGE FACT EXTRACTION CORE (conversion tier, VaM lane). A .var is a ZIP archive. THE WALL THIS LANE LIVES BEHIND (standing policy 1785794796 + measure-dont-ship): VaM is a CAPABILITY TARGET -- asset BYTES (meshes/textures/morph deltas) never enter our products or our published plane. What this core reads is the CENTRAL DIRECTORY (file NAMES + sizes = the package's own manifest) and meta.json (the package's own declared license) -- the package describing itself, never its content. Extracted MEASUREMENTS flow to refcorpus behind the k>=8 admission wall like every other reference corpus. COMPOSES INCUMBENTS: EOCD/central-directory walk = the nx_zip_read shape (that organ is a hardwired PyTorch-.bin test, not a library -- the walk is factored HERE as callables); ZIP method-8 members inflate via nx_deflate_inflate, the SAME raw-DEFLATE core under nx_gzip_wrap and nx_zlib_wrap (capacity-bounded; NOT the retired duplicate nx_inflate, debt 1785854636). ★TAIL-WINDOW CONTRACT: the EOCD + central directory live at the END of a ZIP, so a 519MB .var measures from its last few MB. The caller hands the TAIL bytes + the true file size; if the central directory starts before the window, the probe REFUSES (ok=0) -- a partial census is a plausible undercount, which is worse than absence. Fact slots (flat i64, VF_N_SLOTS): [0] ok [1] entries [2] morphs(.vmi) [3] scenes(Saves/scene/*.json) [4] textures(jpg/png/tif) [5] clothing(/Clothing/) [6] hair(/Hair/) [7] plugins(.cs/.cslist/.dll) [8] appearance(.vap) [9] meta_found [10] meta_lho [11] meta_method [12] meta_csize [13] meta_usize ★2026-09-11 EXTENSION (VaM census lane, ADDITIVE -- every legacy slot above keeps its meaning): (1) THE WALK IS FACTORED INTO CALLABLES so vf_probe, the census CLI (nx_varcensus) and the gate share ONE walk: vf_cd_locate reads the EOCD and names the outcome (OK / NO-EOCD / ZIP64 / WINDOW / SHORT) instead of one ok=0 for five different reasons, and WINDOW hands the caller the exact window it must read (file_size - cd_abs, derived from the archive itself, so no tail size has to be guessed); vf_cd_entry reads ONE record. (2) vf_member_data: STORED bytes in place, DEFLATE through the incumbent nx_deflate_inflate sized from the member's DECLARED usize and required to decode to exactly usize -- no capacity constant to tune. CRC is NOT verified here (imprecision chosen: a corrupt meta.json fails its JSON parse and is counted as unparsed, it is never trusted). (3) vf_json_*: a DEPTH-AWARE reader for meta.json. A key is matched only as a DIRECT member of the object it is asked of, so a nested dependency's own licenseType can never answer for the package (vf_license below takes the FIRST occurrence in the byte stream; the census prints both readings so their agreement is measured, not assumed). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 3 importers

nx_syscalls.nx nx_deflate.nx nx_crc32.nx nx_varfacts_candidate_t139.nx nx_varcensus_candidate_t139.nx nx_varfacts_member_gate_t139.nx nx_varfacts_regression_gate_t139.n

imports: nx_syscalls.nxnx_deflate.nxnx_crc32.nx

imported by: nx_varcensus_candidate_t139.nxnx_varfacts_member_gate_t139.nxnx_varfacts_regression_gate_t139.nx

structs

none

consts

40const VF_MAGIC_1024: i64 = 1024
41const VF_MAGIC_4194304: i64 = 4194304
43const VF_N_SLOTS: i64 = 14
46const VF_SIG_EOCD: i64 = 0x06054b50
47const VF_SIG_CD: i64 = 0x02014b50
48const VF_SIG_LOCAL: i64 = 0x04034b50
49const VF_EOCD_LEN: i64 = 22
50const VF_CD_LEN: i64 = 46
51const VF_LOCAL_LEN: i64 = 30
52const VF_COMMENT_MAX: i64 = 65535
53const VF_U16_ALL: i64 = 0xffff
54const VF_U32_ALL: i64 = 0xffffffff
55const VF_EOCD_ENTRIES: i64 = 10
56const VF_EOCD_CDSIZE: i64 = 12
57const VF_EOCD_CDOFF: i64 = 16
58const VF_CD_FLAGS: i64 = 8
59const VF_CD_METHOD: i64 = 10
60const VF_CD_CRC: i64 = 16
61const VF_CD_CSIZE: i64 = 20
62const VF_CD_USIZE: i64 = 24
63const VF_CD_FNL: i64 = 28
64const VF_CD_EXL: i64 = 30
65const VF_CD_CML: i64 = 32
66const VF_CD_LHO: i64 = 42
67const VF_LOCAL_FNL: i64 = 26
68const VF_LOCAL_EXL: i64 = 28
69const VF_METHOD_STORE: i64 = 0
70const VF_METHOD_DEFLATE: i64 = 8
73const VF_L_EOCD: i64 = 0
74const VF_L_ENTRIES: i64 = 1
75const VF_L_CDSIZE: i64 = 2
76const VF_L_CDABS: i64 = 3
77const VF_L_CD: i64 = 4
78const VF_L_STATE: i64 = 5
79const VF_L_N: i64 = 8
80const VF_LOC_OK: i64 = 0
81const VF_LOC_NOEOCD: i64 = 1
82const VF_LOC_ZIP64: i64 = 2
83const VF_LOC_WINDOW: i64 = 3
84const VF_LOC_SHORT: i64 = 4
87const VF_E_METHOD: i64 = 0
88const VF_E_CSIZE: i64 = 1
89const VF_E_USIZE: i64 = 2
90const VF_E_NAMELEN: i64 = 3
91const VF_E_LHO: i64 = 4
92const VF_E_NAMEOFF: i64 = 5
93const VF_E_NEXT: i64 = 6
94const VF_E_FLAGS: i64 = 7
95const VF_E_Z64: i64 = 8
96const VF_E_CRC: i64 = 9
97const VF_E_N: i64 = 10
101const VF_CD_DISK: i64 = 34
102const VF_X_ZIP64: i64 = 0x0001
103const VF_X_HDR: i64 = 4
104const VF_U64_LEN: i64 = 8
105const VF_Z64_NONE: i64 = 0
106const VF_Z64_RESOLVED: i64 = 1
107const VF_Z64_UNRESOLVED: i64 = 0 - 1
110const VF_MD_STORED: i64 = 0
111const VF_MD_INFLATED: i64 = 1
112const VF_MD_FAILED: i64 = 2
113const VF_MD_UNSUPPORTED: i64 = 3
114const VF_MD_SIZE_MISMATCH: i64 = 4
115const VF_MD_CRC_MISMATCH: i64 = 5
118const VF_J_QUOTE: i64 = 34
119const VF_J_BSL: i64 = 92
120const VF_J_COLON: i64 = 58
121const VF_J_COMMA: i64 = 44
122const VF_J_LBRACE: i64 = 123
123const VF_J_RBRACE: i64 = 125
124const VF_J_LBRACK: i64 = 91
125const VF_J_RBRACK: i64 = 93
126const VF_J_SPACE: i64 = 32
127const VF_J_TAB: i64 = 9
128const VF_J_LF: i64 = 10
129const VF_J_CR: i64 = 13
131const VF_JK_BAD: i64 = 0
132const VF_JK_STRING: i64 = 1
133const VF_JK_OBJECT: i64 = 2
134const VF_JK_ARRAY: i64 = 3
135const VF_JK_SCALAR: i64 = 4
137const VF_JM_KS: i64 = 0
138const VF_JM_KE: i64 = 1
139const VF_JM_VS: i64 = 2
140const VF_JM_VE: i64 = 3
141const VF_JM_N: i64 = 4
143const VF_UTF8_CONT: i64 = 128
144const VF_UTF8_LEAD2: i64 = 192
145const VF_UTF8_LEAD3: i64 = 224
146const VF_UTF8_LEAD4: i64 = 240
147const VF_UTF8_SEXTET: i64 = 64
148const VF_UTF8_MAX1: i64 = 128
149const VF_UTF8_MAX2: i64 = 2048
150const VF_UTF8_MAX3: i64 = 65536
151const VF_SURR_HI: i64 = 0xd800
152const VF_SURR_LO: i64 = 0xdc00
153const VF_SURR_END: i64 = 0xe000
154const VF_SURR_BASE: i64 = 0x10000
155const VF_SURR_SPAN: i64 = 1024
156const VF_HEX_DIGITS: i64 = 4
157const VF_HEX_BASE: i64 = 16

functions

159func vf_u16(b: *u8, o: i64) -> i64 { return (b[o] as i64 & 0xff) | ((b[o+1] as i64 & 0xff) << 8) }
160func vf_u32(b: *u8, o: i64) -> i64 { return (b[o] as i64 & 0xff) | ((b[o+1] as i64 & 0xff) << 8) | ((b[o+2] as i64 & 0xff) << 16) | ((b[o+3] as i64 & 0xff) << 24) }
163func vf_ends(name: *u8, nl: i64, suf: *u8) -> i64
called by 1: vf_probe
171func vf_has(name: *u8, nl: i64, sub: *u8) -> i64
called by 1: vf_probe
186func vf_eocd_window(file_size: i64) -> i64
called by 1: vc_window
196func vf_cd_locate(tail: *u8, tailn: i64, file_size: i64, box: *i64) -> i64
called by 3: vc_windowvf_probemain calls 2: vf_u32vf_u16
233func vf_cd_entry(tail: *u8, tailn: i64, off: i64, rec: *i64) -> i64
254func vf_u64(b: *u8, o: i64) -> i64 { return vf_u32(b, o) | (vf_u32(b, o + 4) << 32) }
called by 1: vf_zip64_extra calls 1: vf_u32
260func vf_zip64_extra(tail: *u8, tailn: i64, xs: i64, xl: i64, rec: *i64) -> i64
called by 1: vf_cd_entry calls 2: vf_u16vf_u64
292func vf_probe(tail: *u8, tailn: i64, file_size: i64, facts: *i64) -> i64
350func vf_member_data(body: *u8, csize: i64, method: i64, usize: i64, out: *i64) -> *u8
374func vf_json_ws(c: i64) -> i64
381func vf_json_skip(src: *u8, n: i64, p: i64) -> i64
391func vf_json_open(c: i64) -> i64 { if c == VF_J_LBRACE { return 1 } if c == VF_J_LBRACK { return 1 } return 0 }
called by 1: vf_json_value_end
392func vf_json_close(c: i64) -> i64 { if c == VF_J_RBRACE { return 1 } if c == VF_J_RBRACK { return 1 } return 0 }
395func vf_json_str_end(src: *u8, n: i64, p: i64) -> i64
408func vf_json_kind(src: *u8, n: i64, p: i64) -> i64
423func vf_json_value_end(src: *u8, n: i64, p: i64) -> i64
461func vf_json_member(src: *u8, end: i64, p: i64, box: *i64) -> i64
484func vf_span_is(src: *u8, s: i64, e: i64, lit: *u8) -> i64
495func vf_json_find(src: *u8, n: i64, obj: i64, key: *u8, box: *i64) -> i64
514func vf_json_count_members(src: *u8, n: i64, obj: i64) -> i64
534func vf_json_count_elems(src: *u8, n: i64, arr: i64) -> i64
555func vf_hexval(c: i64) -> i64
called by 1: vf_hex4
561func vf_hex4(src: *u8, at: i64) -> i64
called by 1: vf_json_decode calls 1: vf_hexval
572func vf_utf8(out: *u8, o: i64, cp: i64) -> i64
called by 1: vf_json_decode
596func vf_json_decode(src: *u8, s: i64, e: i64, out: *u8) -> i64
647func vf_json_get_str(src: *u8, n: i64, obj: i64, key: *u8, len: *i64) -> *u8
665func vf_license(body: *u8, csize: i64, method: i64, usize: i64, out: *u8) -> i64
721func vf_member_checked(body: *u8, csize: i64, method: i64, usize: i64, expected: i64, out: *i64) -> *u8