nx_varfacts_candidate_t139.nx
buildroot/runtime/nx_varfacts_candidate_t139.nx
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
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
| 40 | const VF_MAGIC_1024: i64 = 1024 |
| 41 | const VF_MAGIC_4194304: i64 = 4194304 |
| 43 | const VF_N_SLOTS: i64 = 14 |
| 46 | const VF_SIG_EOCD: i64 = 0x06054b50 |
| 47 | const VF_SIG_CD: i64 = 0x02014b50 |
| 48 | const VF_SIG_LOCAL: i64 = 0x04034b50 |
| 49 | const VF_EOCD_LEN: i64 = 22 |
| 50 | const VF_CD_LEN: i64 = 46 |
| 51 | const VF_LOCAL_LEN: i64 = 30 |
| 52 | const VF_COMMENT_MAX: i64 = 65535 |
| 53 | const VF_U16_ALL: i64 = 0xffff |
| 54 | const VF_U32_ALL: i64 = 0xffffffff |
| 55 | const VF_EOCD_ENTRIES: i64 = 10 |
| 56 | const VF_EOCD_CDSIZE: i64 = 12 |
| 57 | const VF_EOCD_CDOFF: i64 = 16 |
| 58 | const VF_CD_FLAGS: i64 = 8 |
| 59 | const VF_CD_METHOD: i64 = 10 |
| 60 | const VF_CD_CRC: i64 = 16 |
| 61 | const VF_CD_CSIZE: i64 = 20 |
| 62 | const VF_CD_USIZE: i64 = 24 |
| 63 | const VF_CD_FNL: i64 = 28 |
| 64 | const VF_CD_EXL: i64 = 30 |
| 65 | const VF_CD_CML: i64 = 32 |
| 66 | const VF_CD_LHO: i64 = 42 |
| 67 | const VF_LOCAL_FNL: i64 = 26 |
| 68 | const VF_LOCAL_EXL: i64 = 28 |
| 69 | const VF_METHOD_STORE: i64 = 0 |
| 70 | const VF_METHOD_DEFLATE: i64 = 8 |
| 73 | const VF_L_EOCD: i64 = 0 |
| 74 | const VF_L_ENTRIES: i64 = 1 |
| 75 | const VF_L_CDSIZE: i64 = 2 |
| 76 | const VF_L_CDABS: i64 = 3 |
| 77 | const VF_L_CD: i64 = 4 |
| 78 | const VF_L_STATE: i64 = 5 |
| 79 | const VF_L_N: i64 = 8 |
| 80 | const VF_LOC_OK: i64 = 0 |
| 81 | const VF_LOC_NOEOCD: i64 = 1 |
| 82 | const VF_LOC_ZIP64: i64 = 2 |
| 83 | const VF_LOC_WINDOW: i64 = 3 |
| 84 | const VF_LOC_SHORT: i64 = 4 |
| 87 | const VF_E_METHOD: i64 = 0 |
| 88 | const VF_E_CSIZE: i64 = 1 |
| 89 | const VF_E_USIZE: i64 = 2 |
| 90 | const VF_E_NAMELEN: i64 = 3 |
| 91 | const VF_E_LHO: i64 = 4 |
| 92 | const VF_E_NAMEOFF: i64 = 5 |
| 93 | const VF_E_NEXT: i64 = 6 |
| 94 | const VF_E_FLAGS: i64 = 7 |
| 95 | const VF_E_Z64: i64 = 8 |
| 96 | const VF_E_CRC: i64 = 9 |
| 97 | const VF_E_N: i64 = 10 |
| 101 | const VF_CD_DISK: i64 = 34 |
| 102 | const VF_X_ZIP64: i64 = 0x0001 |
| 103 | const VF_X_HDR: i64 = 4 |
| 104 | const VF_U64_LEN: i64 = 8 |
| 105 | const VF_Z64_NONE: i64 = 0 |
| 106 | const VF_Z64_RESOLVED: i64 = 1 |
| 107 | const VF_Z64_UNRESOLVED: i64 = 0 - 1 |
| 110 | const VF_MD_STORED: i64 = 0 |
| 111 | const VF_MD_INFLATED: i64 = 1 |
| 112 | const VF_MD_FAILED: i64 = 2 |
| 113 | const VF_MD_UNSUPPORTED: i64 = 3 |
| 114 | const VF_MD_SIZE_MISMATCH: i64 = 4 |
| 115 | const VF_MD_CRC_MISMATCH: i64 = 5 |
| 118 | const VF_J_QUOTE: i64 = 34 |
| 119 | const VF_J_BSL: i64 = 92 |
| 120 | const VF_J_COLON: i64 = 58 |
| 121 | const VF_J_COMMA: i64 = 44 |
| 122 | const VF_J_LBRACE: i64 = 123 |
| 123 | const VF_J_RBRACE: i64 = 125 |
| 124 | const VF_J_LBRACK: i64 = 91 |
| 125 | const VF_J_RBRACK: i64 = 93 |
| 126 | const VF_J_SPACE: i64 = 32 |
| 127 | const VF_J_TAB: i64 = 9 |
| 128 | const VF_J_LF: i64 = 10 |
| 129 | const VF_J_CR: i64 = 13 |
| 131 | const VF_JK_BAD: i64 = 0 |
| 132 | const VF_JK_STRING: i64 = 1 |
| 133 | const VF_JK_OBJECT: i64 = 2 |
| 134 | const VF_JK_ARRAY: i64 = 3 |
| 135 | const VF_JK_SCALAR: i64 = 4 |
| 137 | const VF_JM_KS: i64 = 0 |
| 138 | const VF_JM_KE: i64 = 1 |
| 139 | const VF_JM_VS: i64 = 2 |
| 140 | const VF_JM_VE: i64 = 3 |
| 141 | const VF_JM_N: i64 = 4 |
| 143 | const VF_UTF8_CONT: i64 = 128 |
| 144 | const VF_UTF8_LEAD2: i64 = 192 |
| 145 | const VF_UTF8_LEAD3: i64 = 224 |
| 146 | const VF_UTF8_LEAD4: i64 = 240 |
| 147 | const VF_UTF8_SEXTET: i64 = 64 |
| 148 | const VF_UTF8_MAX1: i64 = 128 |
| 149 | const VF_UTF8_MAX2: i64 = 2048 |
| 150 | const VF_UTF8_MAX3: i64 = 65536 |
| 151 | const VF_SURR_HI: i64 = 0xd800 |
| 152 | const VF_SURR_LO: i64 = 0xdc00 |
| 153 | const VF_SURR_END: i64 = 0xe000 |
| 154 | const VF_SURR_BASE: i64 = 0x10000 |
| 155 | const VF_SURR_SPAN: i64 = 1024 |
| 156 | const VF_HEX_DIGITS: i64 = 4 |
| 157 | const VF_HEX_BASE: i64 = 16 |
functions
| 159 | func vf_u16(b: *u8, o: i64) -> i64 { return (b[o] as i64 & 0xff) | ((b[o+1] as i64 & 0xff) << 8) } |
| 160 | func 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) } |
| 163 | func vf_ends(name: *u8, nl: i64, suf: *u8) -> i64 called by 1: vf_probe |
| 171 | func vf_has(name: *u8, nl: i64, sub: *u8) -> i64 called by 1: vf_probe |
| 186 | func vf_eocd_window(file_size: i64) -> i64 called by 1: vc_window |
| 196 | func vf_cd_locate(tail: *u8, tailn: i64, file_size: i64, box: *i64) -> i64 |
| 233 | func vf_cd_entry(tail: *u8, tailn: i64, off: i64, rec: *i64) -> i64 |
| 254 | func vf_u64(b: *u8, o: i64) -> i64 { return vf_u32(b, o) | (vf_u32(b, o + 4) << 32) } |
| 260 | func vf_zip64_extra(tail: *u8, tailn: i64, xs: i64, xl: i64, rec: *i64) -> i64 |
| 292 | func vf_probe(tail: *u8, tailn: i64, file_size: i64, facts: *i64) -> i64 |
| 350 | func vf_member_data(body: *u8, csize: i64, method: i64, usize: i64, out: *i64) -> *u8 |
| 374 | func vf_json_ws(c: i64) -> i64 |
| 381 | func vf_json_skip(src: *u8, n: i64, p: i64) -> i64 called by 7: vc_metavc_censusvc_member_measurevf_json_membervf_json_findvf_json_count_members+1 calls 1: vf_json_ws |
| 391 | func 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 |
| 392 | func vf_json_close(c: i64) -> i64 { if c == VF_J_RBRACE { return 1 } if c == VF_J_RBRACK { return 1 } return 0 } |
| 395 | func vf_json_str_end(src: *u8, n: i64, p: i64) -> i64 |
| 408 | func vf_json_kind(src: *u8, n: i64, p: i64) -> i64 called by 9: vc_metavc_get_strvc_censusvc_member_measurevf_json_value_endvf_json_find+3 calls 1: vf_json_close |
| 423 | func vf_json_value_end(src: *u8, n: i64, p: i64) -> i64 |
| 461 | func vf_json_member(src: *u8, end: i64, p: i64, box: *i64) -> i64 |
| 484 | func vf_span_is(src: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 495 | func vf_json_find(src: *u8, n: i64, obj: i64, key: *u8, box: *i64) -> i64 |
| 514 | func vf_json_count_members(src: *u8, n: i64, obj: i64) -> i64 |
| 534 | func vf_json_count_elems(src: *u8, n: i64, arr: i64) -> i64 |
| 555 | func vf_hexval(c: i64) -> i64 called by 1: vf_hex4 |
| 561 | func vf_hex4(src: *u8, at: i64) -> i64 |
| 572 | func vf_utf8(out: *u8, o: i64, cp: i64) -> i64 called by 1: vf_json_decode |
| 596 | func vf_json_decode(src: *u8, s: i64, e: i64, out: *u8) -> i64 |
| 647 | func vf_json_get_str(src: *u8, n: i64, obj: i64, key: *u8, len: *i64) -> *u8 |
| 665 | func vf_license(body: *u8, csize: i64, method: i64, usize: i64, out: *u8) -> i64 |
| 721 | func vf_member_checked(body: *u8, csize: i64, method: i64, usize: i64, expected: i64, out: *i64) -> *u8 |