code wiki / _hdl_build / nx_game_ws_register.nx

nx_game_ws_register.nx source

↩ module page · 60 lines · 3532 B

1// nx_game_ws_register.nx -- register the 2026-07-02 game-system arc into the WMS registry SSOT 2// (knowledge/store/ws-, via nx_workstream_store / nx_seg_store) the SAFE read-modify-write way (reads the 3// live ws:ids index, appends if absent, commits records; NEVER nx_workstream_seed). Mirrors nx_hub_ws_register. 4// Streams: the browser-flagship games arc (MineWorld = the Minecraft-procgen rung, LIVE), the GTA-online 5// shared-world multiplayer ladder (seeded on the proven pets relay + lockstep/prediction organs), and the 6// vox3d pitch-inversion fix discovered by the mineworld gate (QUEUED -- live /voxels untouched this session). 7// license_tier: ORIGINAL expect_exit: 0 8import "nx_workstream_store.nx" 9import "nx_seg_store.nx" 10import "nx_syscalls.nx" 11const K_MAGIC_262144: i64 = 262144 12 13func gwr_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 14func gwr_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 15 16func gwr_addid(idsbuf: *u8, olenp: *i64, id: *u8) -> i64 { 17 if ws_member(idsbuf, olenp[0], id) == 1 { return 0 } 18 var o: i64 = olenp[0] 19 if o > 0 { idsbuf[o] = 9 as u8; o = o + 1 } 20 var i: i64 = 0 21 while id[i] != (0 as u8) { idsbuf[o] = id[i]; o = o + 1; i = i + 1 } 22 olenp[0] = o 23 return 1 24} 25func gwr_rec(w: *i64, key: *u8, val: *u8) -> i64 { return ss_add(w, 1, key, val, gwr_len(val)) } 26 27func main() -> i64 { 28 let w: *i64 = ss_begin() 29 let pq: *i64 = sys_mmap(16) as *i64 30 let lq: *i64 = sys_mmap(16) as *i64 31 let idsbuf: *u8 = sys_mmap(K_MAGIC_262144) 32 let olenp: *i64 = sys_mmap(8) as *i64 33 olenp[0] = 0 34 if ws_get("ws:ids\x00" as *u8, pq, lq) == 1 { 35 let src: *u8 = pq[0] as *u8 36 let n: i64 = lq[0] 37 var i: i64 = 0 38 while i < n { idsbuf[i] = src[i]; i = i + 1 } 39 olenp[0] = n 40 } 41 gwr_addid(idsbuf, olenp, "GAME-BROWSER-FLAGSHIP\x00" as *u8) 42 gwr_addid(idsbuf, olenp, "GAME-GTA-ONLINE-LADDER\x00" as *u8) 43 gwr_addid(idsbuf, olenp, "GAME-VOX3D-PITCH-FIX\x00" as *u8) 44 ss_add(w, 1, "ws:ids\x00" as *u8, idsbuf, olenp[0]) 45 gwr_rec(w, "ws:GAME-BROWSER-FLAGSHIP\x00" as *u8, "GAME-BROWSER-FLAGSHIP\tE-NGE\tACTIVE\t0\tproject-nishi-browser-flagship-games-2026-07-02.md\truntime/nx_wasm_mineworld.nx\tsovereign-game-engine-5pillar-roadmap-2026-06-20\x00" as *u8) 46 gwr_rec(w, "ws:GAME-GTA-ONLINE-LADDER\x00" as *u8, "GAME-GTA-ONLINE-LADDER\tE-NGE\tACTIVE\t0\tproject-nishi-browser-flagship-games-2026-07-02.md\truntime/_hdl_build/nx_mp_serve.nx\tGAME-BROWSER-FLAGSHIP\x00" as *u8) 47 gwr_rec(w, "ws:GAME-VOX3D-PITCH-FIX\x00" as *u8, "GAME-VOX3D-PITCH-FIX\tE-NGE\tQUEUED\t0\tproject-nishi-browser-flagship-games-2026-07-02.md\truntime/nx_wasmvox3d.nx\tGAME-BROWSER-FLAGSHIP\x00" as *u8) 48 let segid: i64 = ws_seg_next(WS_PREFIX) 49 let rc: i64 = ss_commit(WS_PREFIX, w, segid) 50 if rc != 0 { gwr_w("nx_game_ws_register: COMMIT FAILED\n\x00" as *u8); return 1 } 51 var ver: i64 = 0 52 if ws_get("ws:GAME-BROWSER-FLAGSHIP\x00" as *u8, pq, lq) == 1 { ver = ver + 1 } 53 if ws_get("ws:GAME-GTA-ONLINE-LADDER\x00" as *u8, pq, lq) == 1 { ver = ver + 1 } 54 if ws_get("ws:GAME-VOX3D-PITCH-FIX\x00" as *u8, pq, lq) == 1 { ver = ver + 1 } 55 gwr_w("nx_game_ws_register: registered 3 game workstreams in the WMS SSOT; verified=\x00" as *u8) 56 let bb: *u8 = sys_mmap(8); bb[0] = (48 + ver) as u8; sys_write(1, bb, 1) 57 gwr_w("/3; ws:ids index updated (read-modify-write, seed NOT rerun).\n\x00" as *u8) 58 if ver == 3 { return 0 } 59 return 1 60}