code wiki / _hdl_build / nx_game_edit.nx

nx_game_edit.nx

buildroot/runtime/_hdl_build/nx_game_edit.nx

21655 B510 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic game
docsdependenciesstructsconstsfunctions

about

nx_game_edit.nx -- the FINE-CONTROL EDITOR KERNEL (G-ECO-004): the Godot-class editor's core primitive, the second authoring front-end of the Nishi game ecosystem. A structured, VALIDATED, preservation-correct EDIT on a data game-spec. Two mutation kinds (both = the same responsibility: edit ONE spec field, copy everything else verbatim, keep it emitter-valid): (1) DIFFICULTY KNOB: nx_game_edit <in.spec> <out.spec> <key> <value> key = one of the 8 economy knobs (walls enemy_base enemy_per_level ehp_base ehp_per_level loot dmg_base dmg_rand); value must be in the knob's DATA-DRIVEN range. (2) FSM TRANSITION CELL (the visual FSM-table editor's core): nx_game_edit <in.spec> <out.spec> fsm <state> <event> <value> sets transition table cell (state,event) = value (-1 = no transition, else a state index). Both copy every line of <in.spec> VERBATIM except the one edited field -- name/title/other params/other FSM rows/needs/comments all preserved. SELF-GATE (no args, the way nx_sov_build_run invokes it): on game_crypt.spec assert BOTH (a) KNOB walls=30 applies, enemy_base/ehp_base/dmg_base + 6 FSM rows + title unchanged, and unknown-key/over-range/under-range REFUSE; and (b) FSM cell (1,4)->-1 applies, cells (1,1)=2 and (1,3)=3 + row count + walls unchanged, and bad-state/bad-event/bad-value REFUSE. GAMEEDIT-GATE verdict=GREEN iff all hold. Live-preview-by-emit is the next rung (here preview = the edited spec RE-PARSES valid, the contract the emitter requires). HONEST: knob/cell RANGES are DATA (no buried magic numbers). TUTOR-authored tooling (the editor front-end); the GAMES remain emitter output. Feature-add, not a measured-exceed claim. Sovereign syscalls only. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_game_edit.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap ge_read sys_openat_rd sys_read sys_close ge_w sys_write sys_exit ge_streq ge_apply_fsm ge_int ge_find ge_len ge_linestart ge_match ge_pint ge_fsm_ne ge_find ↻ ge_skipint ge_pint ↻ sys_mmap ↻ ge_match ↻ ge_row_ints ge_pint ↻ ge_skipint ↻ ge_catn sys_mmap ↻ ge_atoi ge_apply_batch sys_mmap ↻ ge_tok ge_streq ↻ ge_apply ge_knob_ok sys_mmap ↻ ge_streq ↻ ge_len ↻ ge_catn ↻ ge_atoi ↻

structs

none

consts

27const K_MAGIC_65536: i64 = 65536
28const K_MAGIC_99999: i64 = 99999

functions

30func ge_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 2: ge_reportmain calls 1: sys_write
31func ge_c(fd: i64, c: i64) -> i64 { let b: *u8 = sys_mmap(8); b[0] = c as u8; sys_write(fd, b, 1); return 0 }
called by 2: ge_wnmain calls 2: sys_mmapsys_write
32func ge_wn(fd: i64, v: i64) -> i64
called by 1: ge_report calls 3: ge_csys_mmapsys_write
43func ge_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 3: ge_findge_applymain
44func ge_streq(a: *u8, b: *u8) -> i64
50func ge_atoi(s: *u8) -> i64
called by 2: ge_apply_batchmain
59func ge_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
70func ge_catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: ge_applyge_apply_fsm calls 1: sys_mmap
82func ge_match(buf: *u8, pos: i64, key: *u8) -> i64
87func ge_linestart(buf: *u8, pos: i64) -> i64
92func ge_find(buf: *u8, len: i64, key: *u8) -> i64
101func ge_pint(buf: *u8, pos: i64) -> i64
112func ge_skipint(buf: *u8, pos: i64) -> i64
119func ge_int(buf: *u8, len: i64, key: *u8, dflt: i64) -> i64
called by 2: ge_apply_fsmmain calls 2: ge_findge_pint
125func ge_fsm_ne(buf: *u8, len: i64) -> i64
133func ge_count_rows(buf: *u8, len: i64) -> i64
called by 1: main calls 2: ge_linestartge_match
141func ge_title_crypt(buf: *u8, len: i64) -> i64
called by 1: main calls 2: ge_findge_match
147func ge_fsm_cell(buf: *u8, len: i64, state: i64, event: i64) -> i64
169func ge_knob_ok(key: *u8, value: i64) -> i64
called by 1: ge_apply calls 2: sys_mmapge_streq
193func ge_apply(inbuf: *u8, inlen: i64, key: *u8, value: i64, outbuf: *u8) -> i64
229func ge_row_ints(buf: *u8, after: i64, le: i64, tmp: *i64, ne: i64) -> i64
called by 1: ge_apply_fsm calls 2: ge_pintge_skipint
244func ge_apply_fsm(inbuf: *u8, inlen: i64, state: i64, event: i64, value: i64, outbuf: *u8) -> i64
290func ge_tok(buf: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64
called by 1: ge_apply_batch
315func ge_apply_batch(inbuf: *u8, inlen: i64, script: *u8, slen: i64, outbuf: *u8) -> i64
359func ge_report(fd: i64, r: *i64, ok: i64) -> i64
called by 1: main calls 2: ge_wge_wn
384func main(argc: i64, argv: *i64) -> i64