nx_game_page_emit.nx
buildroot/runtime/nx_game_page_emit.nx
about
nx_game_page_emit.nx -- the SOVEREIGN game-page emitter. Until now the browser page for a wasm
game was assembled by printf blocks in _ops/nx_emit_game.sh -- real emission logic living in
SHELL, against the doctrine (shell only LAUNCHES sovereign ELFs). This organ owns it: reads the
.wasm, base64-encodes it (composes nx_base64 -- one encoder, not a coreutils dependency), and
emits the complete self-contained page (marker, shim, input forwarding, persistence bytes-mover).
usage: nx_game_page_emit <wasm> <out.html> <title> <native-client-name> <controls-html>
RECOVERED 2026-08-02 from buildroot/_build/nx_craft_emit.s (the 14:07 build's data section)
after a failed in-place rewrite TRUNCATED this file to 0 bytes and the damage was copied to
both trees. Every emitted chunk below is the exact byte sequence that build shipped, so the
recovered emitter is byte-equivalent to the last one that passed both gates.
license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_base64.nx
imported by: nx_craft_emit.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 16 | const GPE_WASM_CAP: i64 = 4194304 |
| 17 | const GPE_OUT_CAP: i64 = 16777216 |
| 200 | const pdx9=cam0-px,pdz9=cam2-pz;const pdd9=Math.hypot(pdx9,pdz9); |
| 203 | const thr9=st.iw>.5?0.15:0.03;const iwt=st.spd<=thr9?1:0;\n// STOP AT A FOOT-PLANT, NOT MID-SWING (operator: \"she stops as if she is still walking when\n// she is interrupted\"): while the idle pose blends IN, the clip keeps easing toward the\n// nearest double-support phase (0 and dur/2 in a single gait cycle) -- so the source of the\n// blend is a planted stance, not a frozen swing. A real person finishes the step; so does she.\nif(iwt&&st.iw<.95){const hd9=N.dur/2;let tg9=Math.round(st.ct/hd9)*hd9;\nlet dc9=tg9-st.ct;st.ct=(st.ct+dc9*Math.min(1,dtf*6)+N.dur)%N.dur;}\nst.iw+=(iwt-st.iw)*Math.min(1,dtf*(iwt?5:2.5));if(st.iw<0.004)st.iw=0;\nconst r0=px-cam0,r1=py+0.9-cam1,r2=pz-cam2;\nconst d=Math.hypot(r0,r1,r2);\nif(d>44)continue;\nif(r0*fw0+r1*fw1+r2*fw2<-2.)continue;\nanimEval(N,st,st.ct,nv);\nif(st.iw>.5)window.__npcidle=(window.__npcidle|0)+1;\nconst gv=Number(ex.mobg(BigInt(m))),ki=Number(ex.mobk(BigInt(m))),dgw=ex.mobd?Number(ex.mobd(BigInt(m))):0;\nconst wrd=(ki===2)&&((dgw&1)===0);\nconst sk=.92+((gv>>9)&3)*.04;\nconst ob=.76+.16*((gv>>7)&3);\n// side-by-side calibration (sbs_face v1): our base skin rendered GRAY-BROWN against the\n// reference's warm light tan -- the whole-face tone was the largest alien cue after shape.\n// Warmer, lighter base; the shader's flush/terminator warmth now acts on the right canvas.\nconst skin=wrd?[.66,.60,.66]:[.99*sk,.84*sk,.74*sk];\nconst outf=wrd?[.15,.10,.18]:(ki===0?[.58*ob,.16*ob,.22*ob]:ki===1?[.14*ob,.42*ob,.46*ob]:[.34*ob,.14*ob,.38*ob]);\nconst hair=wrd?[.13,.10,.18]:H8[gv&7];\n// NO instance-level bob: the mocap clip already animates the torso -- adding one made her\n// whole body pogo (operator-caught). The gait bob lives ONLY in the engine's spring anchor,\n// so the chest lags a stable torso: breast physics, not body bounce.\nN.ip[nv*3]=px;N.ip[nv*3+1]=py;N.ip[nv*3+2]=pz;\nN.ih[nv*4]=Math.sin(st.A);N.ih[nv*4+1]=Math.cos(st.A);N.ih[nv*4+2]=.94+((gv>>5)&3)*.03;N.ih[nv*4+3]=1+2*nv;\nfor(let c=0;c<3;c++){N.cs[nv*3+c]=skin[c];N.co[nv*3+c]=outf[c];N.ch[nv*3+c]=hair[c];}\n// A4: organ spring offsets (Q8 model units, model unit = worldQ8/4 => /16384 = blocks) at\n// PHYSICAL scale -- the solver's gate-proven K/C set the amplitude, not display fudge\nif(ex.sbx){const A9=[1.0,1.0,.8];for(let kd=0;kd<3;kd++){const a9=A9[kd];\nN.sb[nv*9+kd*3]=Number(ex.sbx(BigInt(m),BigInt(kd)))/16384*a9;\nN.sb[nv*9+kd*3+1]=Number((ex.sbyb?ex.sbyb:ex.sby)(BigInt(m),BigInt(kd)))/16384*a9;\nN.sb[nv*9+kd*3+2]=Number(ex.sbz(BigInt(m),BigInt(kd)))/16384*a9;}\n// chest spring onto its DESIGNATED JOINTS: world offset -> model frame (inverse heading,\n// inverse scale, yup remap), then dual += .5*(t (x) real) -- the exact composition\n// animEval itself uses, applied to this instance's jf rows before upload\n// (the chest spring is NOT injected into joints any more: the probe proved this rig carries no\n// breast bones -- its nearest candidates sit at 620-641 permil, the upper abdomen -- so driving\n// them swung the whole TORSO. Soft tissue with no bone of its own moves at the VERTEX band in\n// the vertex shader, centred on the derived bust height.)\n}\nN.gn[nv]=(gv>>11)&3;\nN.of[nv]=ex.mobout?Number(ex.mobout(BigInt(m))):0;\n// her mood, straight off the ledger door, scaled to [-1,1] for the expression bands\nN.mdf[nv]=(typeof ANAT9!==\"undefined\"&&ANAT9)?0:(ex.mobmood?Math.max(-1,Math.min(1,Number(ex.mobmood(BigInt(m)))/20)):0);\n// eyeball instances for this girl: two spheres seated on her skull, gazing at the viewer\nif(N.eye&&nv<12){const E=N.eye;const S9=1.78/171530*N.ih[nv*4+2];\nfor(let s=0;s<2;s++){const q=nv*2+s;\nconst c=eyeWorld(N,nv,E.bp[s],N.ih[nv*4],N.ih[nv*4+1],N.ih[nv*4+2],px,py,pz);\nE.ec[q*3]=c[0];E.ec[q*3+1]=c[1];E.ec[q*3+2]=c[2];\nlet gx=cam0-c[0],gy=cam1-c[1],gz2=cam2-c[2];\nconst gl9=Math.hypot(gx,gy,gz2)||1;gx/=gl9;gy/=gl9;gz2/=gl9;\nE.eg[q*4]=gx;E.eg[q*4+1]=gy;E.eg[q*4+2]=gz2;E.eg[q*4+3]=E.R*S9;\nE.ecol[q*3]=hair[0]*.55;E.ecol[q*3+1]=hair[1]*.55;E.ecol[q*3+2]=hair[2]*.55;}}\nnv++;}\nwindow.__npcvis=nv;\nif(nv===0)return;\ng.activeTexture(g.TEXTURE1);g.bindTexture(g.TEXTURE_2D,N.jt);\ng.texSubImage2D(g.TEXTURE_2D,0,0,1,N.nj,2*nv,g.RGBA,g.FLOAT,N.jf.subarray(0,N.nj*8*nv));\ng.useProgram(N.pr);g.bindVertexArray(N.vao);\nconst l=N.l;\ng.uniform1i(l.uJT,1);\ng.uniform1f(l.uSc,1.78/171530);\ng.uniform3fv(l.uIP,N.ip);g.uniform4fv(l.uIH,N.ih);\ng.uniform3fv(l.uCS,N.cs);g.uniform3fv(l.uCO,N.co);g.uniform3fv(l.uCH,N.ch);\nif(ex.sbx)g.uniform3fv(l.uSB,N.sb);\ng.uniform1fv(l.uGN,N.gn);\ng.uniform1fv(l.uOF,N.of);\ng.uniform1fv(l.uMoodF,N.mdf);\ng.uniform1i(l.uEyeG,N.eye?1:0);\ng.uniform1i(l.uAnatM,(typeof ANAT9!==\"undefined\"&&ANAT9)?1:0);\n// ANATOMY, DERIVED FROM THE ASSET: normalize in the mesh's own extents and map published\n// anthropometric ratios (hip .52, nipple .72, eye .93 of stature) through THIS mesh's pelvis\n// and head anchors. Guessed constants put the bust at .636 -- the upper abdomen.\ng.uniform1f(l.uZMN,N.an.zmn);g.uniform1f(l.uH,N.an.H);\ng.uniform1f(l.uNIP,N.an.nip);g.uniform1f(l.uEYE,N.an.eye);\n// weather-in-the-hair inputs: ORGAN tick + ORGAN weather (never wall-clock, never guessed)\ng.uniform1f(l.uTm,Number(ex.tnow())/60);\ng.uniform1f(l.uWnd,(ex.rainf&&Number(ex.rainf()))?0.10:0.03);\ng.uniform3f(l.uCamM,cam0,cam1,cam2);\n" as *u8) |
functions
| 19 | func gpe_slen(s: *u8) -> i64 { var k: i64 = 0; while s[k] != (0 as u8) { k = k + 1 } return k } |
| 20 | func gpe_ap(out: *u8, pos: i64, s: *u8) -> i64 called by 1: gpe_build |
| 26 | func gpe_ap_n(out: *u8, pos: i64, s: *u8, n: i64) -> i64 called by 1: gpe_build |
| 42 | func gpe_verify(out: *u8, n: i64) -> i64 |
| 165 | func gpe_build(wasm: *u8, wn: i64, title: *u8, native: *u8, ctrl: *u8, vnum: i64, out: *u8) -> i64 |
| 223 | func main(argc: i64, argv: *i64) -> i64 |