code wiki / _hdl_build / nx_game_edit.nx
nx_game_edit.nx
buildroot/runtime/_hdl_build/nx_game_edit.nx
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
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
structs
| none |
consts
| 27 | const K_MAGIC_65536: i64 = 65536 |
| 28 | const K_MAGIC_99999: i64 = 99999 |
functions
| 30 | func 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 } |
| 31 | func 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 } |
| 32 | func ge_wn(fd: i64, v: i64) -> i64 |
| 43 | func ge_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 44 | func ge_streq(a: *u8, b: *u8) -> i64 |
| 50 | func ge_atoi(s: *u8) -> i64 |
| 59 | func ge_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 70 | func ge_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 82 | func ge_match(buf: *u8, pos: i64, key: *u8) -> i64 |
| 87 | func ge_linestart(buf: *u8, pos: i64) -> i64 |
| 92 | func ge_find(buf: *u8, len: i64, key: *u8) -> i64 |
| 101 | func ge_pint(buf: *u8, pos: i64) -> i64 |
| 112 | func ge_skipint(buf: *u8, pos: i64) -> i64 |
| 119 | func ge_int(buf: *u8, len: i64, key: *u8, dflt: i64) -> i64 |
| 125 | func ge_fsm_ne(buf: *u8, len: i64) -> i64 |
| 133 | func ge_count_rows(buf: *u8, len: i64) -> i64 |
| 141 | func ge_title_crypt(buf: *u8, len: i64) -> i64 |
| 147 | func ge_fsm_cell(buf: *u8, len: i64, state: i64, event: i64) -> i64 |
| 169 | func ge_knob_ok(key: *u8, value: i64) -> i64 |
| 193 | func ge_apply(inbuf: *u8, inlen: i64, key: *u8, value: i64, outbuf: *u8) -> i64 |
| 229 | func ge_row_ints(buf: *u8, after: i64, le: i64, tmp: *i64, ne: i64) -> i64 |
| 244 | func ge_apply_fsm(inbuf: *u8, inlen: i64, state: i64, event: i64, value: i64, outbuf: *u8) -> i64 |
| 290 | func ge_tok(buf: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64 called by 1: ge_apply_batch |
| 315 | func ge_apply_batch(inbuf: *u8, inlen: i64, script: *u8, slen: i64, outbuf: *u8) -> i64 |
| 359 | func ge_report(fd: i64, r: *i64, ok: i64) -> i64 |
| 384 | func main(argc: i64, argv: *i64) -> i64 |