# vm-map/engine-ctx.toml -- CANONICAL source for the EngineCtx struct (hand-edited). # Generated: build/engine-ctx.json + docs/engine-ctx-reference.md via `tools/engine_ctx_build.py --build`. # Applied to the Ghidra /v2 image via run_script_inline (docs/superpowers/plans/2026-07-09-engine-ctx-struct.md). # ctx = the engine context (esi; thiscall `this`). The VM global bank G[...] is a SEPARATE address space # (vm-map/globals.toml), NOT ctx offsets -- do not add globals here. Grows one [[field]] at a time as we RE more. [meta] struct_name = "EngineCtx" size = 0xa1000 [[field]] offset = 0x408 name = "gfx_obj_registry" type = "int" note = "retained gfx-object map (std::map handle->object); geometry/draw get-or-create, 0x215 returns obj+4 source slot, 0x1f7 erases" [[field]] offset = 0x40c name = "sys4ini_count" type = "int" note = "SYS4INI record count" [[field]] offset = 0x410 name = "archive_name_table" type = "void*" note = "archive-name table base (arc_id*0x100 indexes it)" [[field]] offset = 0x414 name = "sys4ini_records" type = "void*" note = "SYS4INI 80-byte record base {name[64],arc_id,file_number,offset,size}; record = base + id*0x50" [[field]] offset = 0x13dc name = "message_skip_enabled" type = "int" note = "persistent all-message Skip flag; op 0x88 writes it and adv_interpreter_tick injects input bit 0x40 while nonzero" [[field]] offset = 0x3028 name = "alt_pack_table" type = "int" note = "call-script high-byte alternate pack table (unused by corpus)" [[field]] offset = 0xb558 name = "gfx_dirty_a" type = "int" note = "gfx dirty flag (anim set raises)" [[field]] offset = 0xb560 name = "gfx_dirty_b" type = "int" note = "gfx dirty flag" [[field]] offset = 0x14d54 name = "gfx_obj_ptr_table" type = "void*" note = "per-object pointer table (ops 0x212/0x213 write obj+0x64/0x68/0x6c)" [[field]] offset = 0x14f45 name = "script_frame_index" type = "int" note = "call-script frame index (0x1e-dword frames)" [[field]] offset = 0x46d14 name = "query_table_46d14" type = "void*" note = "stride-0x14 table read by op 0x216" [[field]] offset = 0x51b64 name = "frame_timer" type = "int" note = "frame timer (present updates 0x51b64/0x51b68)" [[field]] offset = 0x51b78 name = "anim_clock_elapsed" type = "int" note = "global anim clock elapsed (op 0x238 zeroes)" [[field]] offset = 0x51b7c name = "anim_clock_duration" type = "int" note = "global anim clock total duration (op 0x238 sets)" [[field]] offset = 0x52bd4 name = "surfaces" type = "void*" note = "surface array base [~1000 slots]; create/set-texture (0x1f8/0x1f9) allocate" [[field]] offset = 0x53d14 name = "cur_ctx_index" type = "uint" note = "current gfx-object / script-context index (curCtx); indexes 0x78-byte records" [[field]] offset = 0x53d28 name = "frame_codebase" type = "void*" note = "current frame codebase (PC = codebase + off*4)" [[field]] offset = 0x53d2c name = "frame_pc" type = "int" note = "current frame PC column (op = *(0x53d2c + curCtx*0x78))" [[field]] offset = 0x53d60 name = "ctx_record_base" type = "void*" note = "0x78-byte context-record array base (coroutine/script contexts)" [[field]] offset = 0x53d64 name = "frame_script_resource_id" type = "uint" note = "raw packed SYS4/AAI resource id for this 0x78-byte script frame; persisted ReadTextDB script key" [[field]] offset = 0x53d88 name = "cmd_type_table" type = "int" note = "per-object cmd-type column base (write *(0x53d88 + curCtx*0x78))" [[field]] offset = 0x550fc name = "message_skip_display_enabled" type = "int" note = "persistent all-message Skip state returned by op 0x19a for the ADV control-strip active overlay" [[field]] offset = 0x55104 name = "auto_message_enabled" type = "int" note = "ADV Auto mode flag; op 0x1b6 reads, op 0x1b7 writes, adv_input_service_poll consumes" [[field]] offset = 0x55120 name = "anti_tamper_a" type = "int" note = "anti-tamper checksum operand" [[field]] offset = 0x55124 name = "anti_tamper_b" type = "int" note = "anti-tamper checksum operand" [[field]] offset = 0x5512c name = "anti_tamper_fp" type = "int" note = "anti-tamper (import fn ptr / result)" [[field]] offset = 0x55248 name = "ret_stack_a" type = "void*" note = "per-frame return stack (op 0x8f call pushes)" [[field]] offset = 0x552e8 name = "ret_stack_b" type = "void*" note = "per-frame return stack (companion)" [[field]] offset = 0x5f304 name = "sleep_timer" type = "int" note = "sleep timer object (op 0xc8; +8 active, +0x14 start-ms, +0x18 duration)" [[field]] offset = 0x6da78 name = "message_skip_activation_guard" type = "int" note = "set when op 0x88 enables Skip; suppresses the enabling click from immediately becoming a hotspot activation" [[field]] offset = 0x6da80 name = "message_skip_cancel_click_phase" type = "int" note = "press/release phase used only when set:CancelMesSkipOnClick is nonzero" [[field]] offset = 0x6da88 name = "coroutine_yield_a" type = "void*" note = "op 0x7b yield-state save (op1 -> +ctxidx*4)" [[field]] offset = 0x6db28 name = "coroutine_yield_b" type = "void*" note = "op 0x7b yield-state save (op2 -> +ctxidx*4)" [[field]] offset = 0x6dbc8 name = "coroutine_runstate" type = "int" note = "op 0x7c resume gate (run-state bit 0x2000000)" [[field]] offset = 0x6dbcc name = "coroutine_resume_off" type = "int" note = "op 0x7c resume PC offset" [[field]] offset = 0x6dbd4 name = "adv_read_skip_state" type = "int" note = "current ADV read/click-skip service state; queried by op 0x1cc, maintained from ReadTextSkip + per-PC read history" [[field]] offset = 0x6dbe4 name = "adv_auto_voice_pending" type = "int" note = "set by play-voice ops when voice service exists; Auto waits for voice completion then arms AutoMessageTime0; op 0x1bc resets" [[field]] offset = 0x6dbf4 name = "message_skip_queued_voice_id" type = "int" note = "latest voice resource deferred by op 0xc4 while run_state_flags message-skip bit is active" [[field]] offset = 0x6dbf8 name = "message_skip_queued_voice_arg" type = "int" note = "second argument retained with message_skip_queued_voice_id; Himegari op 0xc4 stores zero" [[field]] offset = 0x9b24c name = "dispatch_table" type = "void*" note = "opcode->handler table base [0x400]; handler(op) = *(0x9b24c + op*4)" [[field]] offset = 0xa0cc0 name = "screen_w" type = "int" note = "screen width (640)" [[field]] offset = 0xa0cc4 name = "screen_h" type = "int" note = "screen height (480)" [[field]] offset = 0xa0cc8 name = "screen_bpp" type = "int" note = "screen bpp (8)" [[field]] offset = 0xa0ce4 name = "run_state_flags" type = "uint" note = "interpreter run-state flags (bit1 sleeping; 0x8000000 skip/fast-forward)"