code wiki / (root) / nx_game_page_workbench_candidate_t342.nx

nx_game_page_workbench_candidate_t342.nx

buildroot/runtime/nx_game_page_workbench_candidate_t342.nx

262144 B2160 linesdepth 11pulls 96 transitivereach 12 importersview sourcekind benchtopic game
docsdependenciesstructsconstsfunctions

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 27 imports · 6 importers

nx_syscalls.nx nx_character_prepared_runtime.nx nx_cast_shader_src.nx nx_imported_body_page_t262.nx nx_prepared_motion.nx nx_base64.nx nx_game_page_artifact_lib.nx nx_game_shader_backend_selected_t5 nx_game_asset_prepare_emit.nx nx_game_rig_inspection_emit_t230.n nx_game_page_workbench_candida nx_craft_body_semantic_alpha_emit_ nx_craft_body_winding_alpha_emit_t nx_craft_inspection_alpha_emit_t34 nx_craft_person_alpha_emit_t343.nx nx_craft_rigview_workbench_emit_t3 nx_craft_scene_light_alpha_emit_t3

diagram shows first 10 each side; +17 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_character_prepared_runtime.nxnx_cast_shader_src.nxnx_imported_body_page_t262.nxnx_prepared_motion.nxnx_base64.nxnx_game_page_artifact_lib.nxnx_game_shader_backend_selected_t55.nxnx_game_asset_prepare_emit.nxnx_game_rig_inspection_emit_t230.nxnx_game_texture_mip_emit_t241.nxnx_game_surface_prepare.nxnx_game_normal_encoding_emit.nxnx_json.nxnx_utf8.nxnx_gpu_choice_workspace_t48.nxnx_site_chrome_search_t53.nxnx_wasmfit.nxnx_hairdyn_lib.nxnx_audio_osc.nxnx_atmosphere.nxnx_glprobe_lib.nxnx_tool_run.nxnx_genp_allow_lib.nxnx_release_view_emit.nxnx_release_recent_lib.nxnx_tier_ladder_lib.nx

imported by: nx_craft_body_semantic_alpha_emit_t345.nxnx_craft_body_winding_alpha_emit_t365.nxnx_craft_inspection_alpha_emit_t342.nxnx_craft_person_alpha_emit_t343.nxnx_craft_rigview_workbench_emit_t342.nxnx_craft_scene_light_alpha_emit_t364.nx

structs

890struct GpeSceneWriter { output:i64, capacity:i64, position:i64, failed:i64 }

consts

64const GPE_MT_WSRC: *u8 = "const NXMT_WSRC=\"let ex=null;onmessage=async(e)=>{const d=e.data;try{if(d.t==='init'){const i=await WebAssembly.instantiate(d.mod,{env:{memory:d.mem}});ex=i.exports;postMessage({t:'ready'});}else if(d.t==='band'){ex.render_band(BigInt(d.y0),BigInt(d.y1),BigInt(d.wid));postMessage({t:'band'});}}catch(err){postMessage({t:'err',m:String(err)});}};\";\n"
66const GPE_WASM_CAP: i64 = 4194304
149const GPE_MAGIC_20260728: i64 = 20260728
195const GPE_EMIT_WEBGL: i64 = 1
202const GPE_ALPHA_BEND_SOFT_Q12: i64 = 40960 // the gate-proven XG_ALPHA_BEND_SOFT_Q12 compliance
203const GPE_UNITS_PER_178CM: i64 = 171530 // the page's own 1.78m-to-world-unit pairing
204const GPE_G_DEN_60HZ: i64 = 640800 // that pairing carried to a per-tick accel at 60Hz
205const GPE_OUT_CAP: i64 = 16777216
234const RK_WGSL_CAP: i64 = 65536
235const RK_WGSL_TMO_MS: i64 = 8000
236const RK_WGSL_ELF: *u8 = "./nx_wgsl.elf"
237const RK_WGSL_ELF_ABS: *u8 = "/volume1/homes/elderwesto/nishihost/nx_wgsl.elf" // the emitter's CWD is not always the serving root
238const RK_WGSL_BEGIN: *u8 = "--- WGSL ---\n"
239const RK_WGSL_END: *u8 = "\nwgsl_bytes="
240const RK_KERNEL_N: i64 = 65536 // u32 lanes per probe (1024 workgroups at the backend's width of 64)
294const RK_LAYOUT_BEGIN: *u8 = "struct U{"
295const RK_LAYOUT_END: *u8 = "var<uniform> u:U;\n"
296const RK_LAYOUT_SIZE_KEY: *u8 = "layoutraw_rc="
297const RK_LAYOUT_NAMES: i64 = 18
298const RK_FLOAT_BYTES: i64 = 4
377const RK_WORLD_FS_BEGIN: *u8 = "--- world_wgsl WGSL ---\n"
378const RK_WORLD_FS_END: *u8 = "\nworld_wgsl_rc="
379const RK_WORLD_VS_BEGIN: *u8 = "--- worldvs_wgsl WGSL ---\n"
380const RK_WORLD_VS_END: *u8 = "\nworldvs_wgsl_rc="
442const RK_CAST_VS_BEGIN: *u8 = "--- cast_wgsl WGSL ---\n"
443const RK_CAST_VS_END: *u8 = "\ncast_wgsl_rc="
444const RK_CAST_FS_BEGIN: *u8 = "--- castfs_wgsl WGSL ---\n"
445const RK_CAST_FS_END: *u8 = "\ncastfs_wgsl_rc="
482const RK_LM_JS_SAFE_INTEGER_MAX:i64=9007199254740991
576const RK_CAST_GLSL_VS_BEGIN: *u8 = "--- cast_glsl GLSL ---\n"
577const RK_CAST_GLSL_VS_END: *u8 = "\ncast_glsl_rc="
578const RK_CAST_GLSL_FS_BEGIN: *u8 = "--- castfs_glsl GLSL ---\n"
579const RK_CAST_GLSL_FS_END: *u8 = "\ncastfs_glsl_rc="
738const GPE_GPU_TIMESTAMP_ENDPOINTS: i64 = 2
739const GPE_GPU_TIMESTAMP_BUFFERS: i64 = 2
740const GPE_GPU_SLOT_BUFFER_BYTES: i64 = GPE_GPU_TIMESTAMP_ENDPOINTS * GPE_GPU_TIMESTAMP_BUFFERS * __size_of(i64)
742const GPE_GPU_POLICY_MAX_INTEGER: i64 = 9007199254740991
743const GPE_GPU_POLICY_RADIX: i64 = 10
744const GPE_FACING_INTEGER_MAX: i64 = 2147483647
745const GPE_FACING_HALF_TURN_Q12: i64 = 12868
1269const GPE_HSTR_WORDS_PER_STRAND: i64 = 24
1270const GPE_AXES: i64 = 3
1276const GPE_HAIR_GUIDES: i64 = 900
1316const GPE_HAIR_CYC_FIRST: i64 = 1
1317const GPE_HAIR_CYC_LAST: i64 = 3
1320const GPE_HAIR_CYC_SKIP: i64 = 0
1321const GPE_HAIR_CYC_LEN: i64 = 1
1322const GPE_HAIR_CYC_SLOTS: i64 = 2
1379const GPE_HAIR_DRIVE_FRAMES: i64 = 24
1386const GPE_HAIR_DRIVE_AMP_Q8: i64 = 32
1389const GPE_HAIR_SETTLE_PERIODS_MAX: i64 = 40
1588const GPE_HAIR_AMP_CAP: i64 = 3400
1614const span=(ztop-zbot)||1;
1752const GPE_RD_HTML_CAP: i64 = 262144
1753const GPE_RD_PLANS: i64 = 3
1754const GPE_RD_PLAN_GE: *u8 = "buildroot/knowledge/compare/gameengine.plan"
1755const GPE_RD_PLAN_GR: *u8 = "buildroot/knowledge/compare/graphics.plan"
1756const GPE_RD_PLAN_CS: *u8 = "buildroot/knowledge/compare/charsim.plan"
2161const H8=[[.09,.07,.07],[.24,.15,.10],[.38,.24,.14],[.48,.28,.15],[.55,.25,.14],[.70,.32,.14],[.62,.47,.28],[.82,.66,.40]];\n// E-2 EYEBALL GEOMETRY. Painted eyes top out at 'alive'; a real eye is a SPHERE, which is why\n// it catches light and why the iris shifts with parallax as the head turns -- a flat disc never\n// will at any resolution. This transforms the bind-space eye centre through the HEAD joint's own\n// dual quaternion (the same composition the vertex shader uses), so the eyeball rides her skull\n// exactly. Falls back to paint if anything failed at load (uEyeG stays 0).\nfunction eyeWorld(N,v,bp,ihx,ihy,scl,px,py,pz,joint=N.hj){\nconst nj=N.nj,jf=N.jf,hj=joint;\nconst o0=(2*v)*nj*4,o1=(2*v+1)*nj*4;\nconst rx=jf[o0+hj*4],ry=jf[o0+hj*4+1],rz=jf[o0+hj*4+2],rw=jf[o0+hj*4+3];\nconst dx=jf[o1+hj*4],dy=jf[o1+hj*4+1],dz=jf[o1+hj*4+2],dw=jf[o1+hj*4+3];\nconst bx=bp[0],by=bp[1],bz=bp[2];\nconst cx=ry*bz-rz*by+rw*bx,cy=rz*bx-rx*bz+rw*by,cz=rx*by-ry*bx+rw*bz;\nconst sx=bx+2*(ry*cz-rz*cy),sy=by+2*(rz*cx-rx*cz),sz=bz+2*(rx*cy-ry*cx);\nconst tx=2*(rw*dx-dw*rx+(ry*dz-rz*dy));\nconst ty=2*(rw*dy-dw*ry+(rz*dx-rx*dz));\nconst tz=2*(rw*dz-dw*rz+(rx*dy-ry*dx));\nconst mx=sx+tx,my=sy+ty,mz=sz+tz;\nconst yx=mx,yy=mz,yz=-my;\nconst S=1.78/171530*scl;\nreturn [px+(yx*ihy-yz*ihx)*S,py+yy*S,pz+(yx*ihx+yz*ihy)*S];\n}\nfunction nxEyeSource(pos,nv,AN9){\n const SEG=18,RNG=12,SPv=[],SIv=[];\n for(let r=0;r<=RNG;r++){const th=r*Math.PI/RNG;for(let s=0;s<=SEG;s++){const ph=s*2*Math.PI/SEG;SPv.push(Math.sin(th)*Math.cos(ph),Math.cos(th),Math.sin(th)*Math.sin(ph));}}\n for(let r=0;r<RNG;r++)for(let s=0;s<SEG;s++){const a=r*(SEG+1)+s,b=a+SEG+1;SIv.push(a,b,a+1,a+1,b,b+1);}\n const HHb=.115*AN9.H,exl=.16*HHb,ezb=AN9.zmn+.9420*AN9.H,Rb=.046*HHb;let my0=1e18,my1=1e18;\n for(let v=0;v<nv;v++){const vx=pos[v*3],vy=pos[v*3+1],vz=pos[v*3+2];if(Math.abs(vz-ezb)>.07*HHb||Math.abs(Math.abs(vx)-exl)>.11*HHb)continue;if(vx<0){if(vy<my0)my0=vy;}else if(vy<my1)my1=vy;}\n if(my0>1e17)my0=-.10*HHb;if(my1>1e17)my1=-.10*HHb;\n return{vertices:new Float32Array(SPv),indices:new Uint16Array(SIv),R:Rb,bp:[[-exl,my0+.70*Rb,ezb],[exl,my1+.70*Rb,ezb]],ec:new Float32Array(72),eg:new Float32Array(96),ecol:new Float32Array(72)};\n}\nasync function nxGpuEyeCreate(dev,owner,source,mkg){\n if(!source||!(source.vertices instanceof Float32Array)||!(source.indices instanceof Uint16Array)||source.vertices.length%3||!source.indices.length)throw Error('eye source: invalid geometry');\n for(const v of source.vertices)if(!Number.isFinite(v))throw Error('eye source: nonfinite vertex');for(const i of source.indices)if(i>=source.vertices.length/3)throw Error('eye source: index range');\n if(!NXEV||!NXEF||NXEV_SIZE<=0||NXEF_SIZE<=0)throw Error('eye shader: layout absent');\n const module=async function(code){if(!code)throw Error('eye shader: absent');const m=dev.createShaderModule({code});const info=await m.getCompilationInfo();const bad=info.messages.filter(x=>x.type==='error');if(bad.length)throw Error('eye shader: '+bad.map(x=>x.message).join(';'));return m;};\n const vm=await module(EYE_WGSL_VS),fm=await module(EYE_WGSL_FS);\n const pipeline=await dev.createRenderPipelineAsync({layout:'auto',vertex:{module:vm,entryPoint:'main',buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:'float32x3'}]}]},fragment:{module:fm,entryPoint:'main',targets:[{format:navigator.gpu.getPreferredCanvasFormat()}]},primitive:{topology:'triangle-list',cullMode:'none'},depthStencil:{format:'depth24plus',depthWriteEnabled:true,depthCompare:'less'}});\n if(GPU!==owner)throw Error('eye upload: renderer replaced');\n const e={pipeline,bp:mkg(source.vertices,GPUBufferUsage.VERTEX),ib:mkg(source.indices,GPUBufferUsage.INDEX),ni:source.indices.length,vb:mkg(new Uint8Array(NXEV_SIZE),GPUBufferUsage.UNIFORM),fb:mkg(new Uint8Array(NXEF_SIZE),GPUBufferUsage.UNIFORM),vdata:new ArrayBuffer(NXEV_SIZE),fdata:new ArrayBuffer(NXEF_SIZE),rows:0};\n e.bgv=dev.createBindGroup({layout:pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:e.vb}}]});e.bgf=dev.createBindGroup({layout:pipeline.getBindGroupLayout(1),entries:[{binding:0,resource:{buffer:e.fb}}]});return e;\n}\nfunction nxGpuEyePrepare(dev,G,R,N,nv){G.eyeFrame=(G.eyeFrame||0)+1;G.eyeSubmitted=0;const e=R.eye;G.eyePrepared=false;const status=window.__nx_eye_gpu;if(status){status.frame=G.eyeFrame;status.submitted=0;status.validated=0;}if(!e||!N.eye||window.__nx_eye_override===0){if(status&&e)status.state='painted-fallback';return false;}if(status)status.state='prepared';\n const E=N.eye,F=new Float32Array(e.vdata),H=new Float32Array(e.fdata),V=NXEV,K=NXEF;F.fill(0);H.fill(0);const camera=[Number(nxView(\"view_x\",\"camx\"))/25

functions

46func rk_tier_ladder() -> *u8 { return tl_emit() }
called by 1: gpe_frame_hud calls 1: tl_emit
68func gpe_mt_declare(twin:*u8,bytes:i64,url:*u8,pages:i64,maximum:i64)->i64
94func gpe_mt_boot(out: *u8, p0: i64) -> i64
called by 1: gpe_frame_hud calls 3: gpe_apgpe_putsgpe_num
135func gpe_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
136func gpe_pn(v: i64) -> i64
207func gpe_slen(s: *u8) -> i64 { var k: i64 = 0; while s[k] != (0 as u8) { k = k + 1 } return k }
208func gpe_ap(out: *u8, pos: i64, s: *u8) -> i64
214func gpe_ap_n(out: *u8, pos: i64, s: *u8, n: i64) -> i64
241func rk_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
242func rk_err(s: *u8) -> i64 { sys_write(2, s, rk_slen(s)); return 0 }
243func rk_num(out: *u8, pos: i64, v: i64) -> i64
254func rk_find(buf: *u8, n: i64, from: i64, needle: *u8) -> i64
267func rk_js_str(out: *u8, pos: i64, src: *u8, n: i64) -> i64
283func rk_capture_wgsl(buf: *u8, ol: *i64) -> i64
299func rk_capture_layout(buf: *u8, ol: *i64) -> i64
303func rk_int_after(buf: *u8, n: i64, needle: *u8) -> i64
320func rk_uniform_offset(buf: *u8, n: i64, name: *u8) -> i64
339func rk_uniform_block(out: *u8, pos: i64) -> i64
381func rk_capture_world(buf: *u8, ol: *i64) -> i64
385func rk_world_span(buf: *u8, n: i64, begin: *u8, end: *u8, bo: *i64) -> i64
397func rk_world_block(out: *u8, pos: i64) -> i64
449func rk_capture_cast(buf: *u8, ol: *i64) -> i64
459func gpe_cast_identity(out:*u8,pos:i64,buf:*u8,n:i64,vo:*i64,fo:*i64)->i64
483func rk_lm_decimal(b:*u8,s:i64,e:i64)->i64
487func rk_lm_prop(b:*u8,s:i64,e:i64,key:*u8)->i64
494func rk_lm_row(b:*u8,s:i64,e:i64,r:*i64)->i64
510func rk_lm_null(out:*u8,pos:i64,name:*u8)->i64
515func rk_layout_obj(out:*u8,pos:i64,buf:*u8,n:i64,rowskey:*u8,sizekey:*u8,name:*u8)->i64
580func rk_cast_glsl(out:*u8,pos:i64,buf:*u8,n:i64)->i64
599func rk_eye_stage(out:*u8,pos:i64,buf:*u8,n:i64,begin:*u8,end:*u8,rc_key:*u8,name:*u8)->i64
607func rk_eye_block(out:*u8,pos:i64)->i64
637func rk_owned_new()->*NxBufOwned
641func rk_owned_close(b:*NxBufOwned)->i64
645func rk_capture_cast_owned(b:*NxBufOwned)->i64
653func rk_cast_block(out: *u8, pos: i64) -> i64
693func rk_webgpu_door(out: *u8, pos: i64) -> i64
747func gpe_facing_key(t: *NxJsonTok, key: *u8) -> i64
754func gpe_facing_parse(raw: *u8, n: i64, values: *i64) -> i64
792func gpe_facing_policy(out: *u8, pos: i64) -> i64
808func gpe_gpu_timing_policy(out: *u8, pos: i64) -> i64
867func gpe_catalogue_string(out:*u8,pos:i64,src:*u8,n:i64)->i64
877func gpe_prepared_catalogue(out:*u8,pos:i64)->i64
891func gpe_scene_light_recipe_emit(out:*u8,pos:i64)->i64
918func gpe_visitors_gpu(out: *u8,pos: i64) -> i64
926func gpe_emit_webgpu(out: *u8, pos: i64) -> i64
962func gpe_verify(out: *u8, n: i64) -> i64
1134func gpe_num(out: *u8, pos: i64, v: i64) -> i64
1156func gpe_sunt(out: *u8, pos: i64) -> i64
1176func gpe_npcs_emit(out: *u8, pos: i64, vnum: i64) -> i64
1236func gpe_build(wasm: *u8, wn: i64, title: *u8, native: *u8, ctrl: *u8, vnum: i64, out: *u8) -> i64
1277func gpe_hstr_pts() -> i64 { return GPE_HSTR_WORDS_PER_STRAND/GPE_AXES }
1278func gpe_hair_nseg() -> i64 { return gpe_hstr_pts() - 1 }
1279func gpe_hair_seglen() -> i64 { return SD_Q8 }
1287func gpe_hair_seed(st: *i64, n: i64, rigid: i64) -> i64
1328func gpe_hair_cycle(out: *i64) -> i64
1361func gpe_hair_cycle_at(slot: i64) -> i64
1393func gpe_hair_drive(t: i64) -> i64
1398func gpe_hair_frames() -> i64 { return GPE_HAIR_DRIVE_FRAMES }
1406func gpe_hair_chain_bake(tbl: *i64, rigid: i64) -> i64
1492func gpe_dress_runtime(out: *u8, pos: i64) -> i64
1519func gpe_hair_runtime(out: *u8, pos: i64) -> i64
1577func gpe_hair_npc_doors(out: *u8, pos: i64) -> i64
1593func gpe_hair_geometry(out: *u8, pos: i64) -> i64
1645func gpe_garment_draw(out: *u8, pos: i64) -> i64
1654func gpe_vb_find(b: *u8, n: i64, pat: *u8, from: i64) -> i64
1678func gpe_version_badge(out: *u8, pos: i64) -> i64
1757func gpe_rd_board(path: *u8, dom: *u8, since: *u8, recent: *ReleaseRecent, counts: *i64, read: *i64) -> i64
1767func gpe_release_block(out: *u8, pos: i64) -> i64
1836func gpe_frame_hud(out: *u8, pos: i64) -> i64
1858func gpe_sky_atmos(out: *u8, p: i64, src: *u8) -> i64
1862func gpe_demand_lifecycle(out: *u8, p0: i64) -> i64
1866func gpe_build_context_s(wasm: *u8, wn: i64, title: *u8, native: *u8, ctrl: *u8, vnum: i64, seed: i64, spec: *u8, out: *u8, context_path:*u8) -> i64