nx_kkfacts_lib.nx
buildroot/runtime/nx_kkfacts_lib.nx
about
nx_kkfacts_lib.nx -- KOIKATSU CARD FACT EXTRACTION CORE (the Honey Select / Koikatsu card
study's first organ; benchmark card KK_396262 measured 2026-08-04).
A Koikatsu card is a PNG portrait with the CHARACTER DEFINITION appended after IEND: the
KoiKatuChara marker, then MessagePack block structures (Custom = face/body/hair, Coordinate =
outfits, Parameter, Status, KKEx = modded extended data). This core reads STRUCTURE ONLY:
portrait bounds + dims, payload size, marker, block-name census. Slider values and names stay
unread in v1 -- the deep (msgpack) rung comes with the k>=8 card study, and per-card creative
content never enters the published plane (one card = one creator; the k-wall exists for this).
★THE CARD FORMAT CARRIES NO MOTION: coordinates are OUTFITS, not animations -- motion lives in
the game engine, not the artifact. A fact this lane's compare page states outright.
Slots: [0] is_card [1] portrait_bytes [2] portrait_w [3] portrait_h [4] payload_bytes
[5] custom [6] coordinate [7] parameter [8] status [9] kkex (-1 = not measured)
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 7 importers
imports: nx_syscalls.nxnx_img_dims.nx
imported by: nx_bspfacts_lib.nxnx_ingest_audit.nxnx_kkfacts.nxnx_kkfacts_gate.nxnx_kkslider_stats.nxnx_mhtarget_lib.nxnx_nif_lib.nx
structs
| none |
consts
| 18 | const KK_MAGIC_4096: i64 = 4096 |
| 20 | const KK_N_SLOTS: i64 = 10 |
| 111 | const KK_MP_FIXARRAY_BASE: i64 = 0x90 // msgpack fixarray tag; low nibble carries the count |
| 112 | const KK_MP_TAG_HI_MASK: i64 = 0xf0 |
| 113 | const KK_MP_TAG_LO_MASK: i64 = 0x0f |
| 114 | const KK_MP_ARRAY16: i64 = 0xdc // BE16 count follows |
| 115 | const KK_MP_F32: i64 = 0xca // 4 BE bytes follow |
| 116 | const KK_MP_F32_SPAN: i64 = 5 // tag + 4 payload bytes |
| 117 | const KK_F32_EXP_BIAS: i64 = 127 |
| 118 | const KK_F32_EXP_MASK: i64 = 255 |
| 119 | const KK_F32_MANT_BITS: i64 = 23 |
| 120 | const KK_F32_MANT_MASK: i64 = 8388607 |
| 121 | const KK_F32_MANT_ONE: i64 = 8388608 |
| 122 | const KK_PERMIL: i64 = 1000 |
| 123 | const KK_SHIFT_SAFE_HI: i64 = 30 // beyond this a left-shift of mant*1000 overflows i64 headroom |
| 124 | const KK_SHIFT_SAFE_LO: i64 = 62 // beyond this a right-shift underflows to 0 anyway |
functions
| 22 | func kk_b(buf: *u8, o: i64) -> i64 { return buf[o] as i64 & 0xff } |
| 23 | func kk_find(buf: *u8, start: i64, end: i64, needle: *u8) -> i64 |
| 35 | func kk_count(buf: *u8, start: i64, end: i64, needle: *u8) -> i64 |
| 52 | func kk_probe_marker(buf: *u8, n: i64, file_size: i64, facts: *i64, marker: *u8) -> i64 |
| 85 | func kk_probe(buf: *u8, n: i64, file_size: i64, facts: *i64) -> i64 |
| 96 | func kk_probe_aishoujo(buf: *u8, n: i64, file_size: i64, facts: *i64) -> i64 |
| 126 | func kk_f32_permil(w: i64) -> i64 |
| 143 | func kk_decode_sliders(buf: *u8, start: i64, end: i64, key: *u8, out: *i64, outcap: i64, meta: *i64) -> i64 |