Add tests for controller fire attempt suppression and usecode interpreter functionality
- Enhanced isometric_controls_tests.cpp to include assertions for controller fire attempt suppression under various conditions. - Added tests for the Usecode interpreter in usecode_vm_tests.cpp, verifying script execution and stack manipulation. - Introduced a new PowerShell script, clean-old-build-artifacts.ps1, to facilitate the cleanup of old build artifacts in specified directories.
This commit is contained in:
parent
49a15602b6
commit
ffb1918f35
41 changed files with 3611 additions and 349 deletions
|
|
@ -14,6 +14,53 @@ Current best read: No Regret still contains the hidden usecode debugger as a rea
|
|||
|
||||
This is the most important cross-build finding so far for the retail unlock problem. In retail `CRUSADER.EXE`, the current blocker is that fresh live recovery still finds reads but no recovered writer for `1478:659c/659e`, and the retail break-state object still points at inert vtable slots. In `REGRET.EXE`, the analogous global at `1480:712c/712e` has both many debugger-side reads and one direct write from a compact constructor/store stub at `1398:0000`, and that same bootstrap rewires the freshly created object away from the inert base vtable and onto a live frontend vtable whose slot `0` is `usecode_debugger_open_for_current_unit`.
|
||||
|
||||
## Latest Ghidra Coverage Sweep (2026-10-07)
|
||||
|
||||
The earlier conclusion that the two current-entry push helpers had no callers was an analysis-boundary artifact and is superseded by this pass. The interpreter hook at `13f0:038b` dispatches bytecode through an indirect near jump at `13f0:0457`, indexed by a 122-word table at `13f0:3d9f` for opcodes `0x00..0x79`. Ghidra originally had the hook's min/max span but only two disjoint body ranges; most switch-case instructions were not in its listing or function body, so caller recovery missed their calls.
|
||||
|
||||
The table was decoded and all 122 entries mapped to 106 distinct handler targets. Those targets now contribute 4,624 decoded instructions in 22 non-overlapping address ranges attached to the hook function. The whole-hook decompiler request still exceeds the MCP read timeout, so the case bodies were analyzed from disassembly and call/reference data. This was an analysis-only Ghidra change; program bytes were not patched.
|
||||
|
||||
The recovered debugger lifecycle is:
|
||||
|
||||
- Opcode `0x5b` reads the line word and calls `usecode_debugger_break_state_update_line_and_maybe_break` at `13f0:04b5`.
|
||||
- Opcode `0x5c` calls `usecode_debugger_break_state_push_current_entry` at `13f0:051d`, assembling the record from live unit/source/frame context.
|
||||
- Opcode `0x57` snapshots and pops the parent record at `13f0:2a56`, creates the child process context, then pushes a copy at `13f0:2ab9` when debugger state is active.
|
||||
- Opcode `0x50` pops a current-entry record on return at `13f0:3378`; the hook also has its guarded final unwind at `13f0:3d78`.
|
||||
|
||||
Thus Regret does have a statically connected producer and the intended interpreter push/pop lifecycle. The `.unk` file is still only the displayed source; the bytecode handlers and live VM context supply the line and frame record. Runtime balance and payload values still need validation. The bootstrap's ordinary activation path and the exact trigger for opening the UI in an unmodified play session also remain unknown. A few virtual UI callbacks and indirect VM targets are incompletely characterized.
|
||||
|
||||
### Debugger UI Vtable Sweep (2026-10-07)
|
||||
|
||||
A second UI pass recovered the callback registration that direct-call searches missed. The Ghidra vtable helper treated the data as two-byte pointers, but the raw bytes and constructors show tables of 18 four-byte far pointers, stored as little-endian code offset followed by code segment. The three UI roots are contiguous at `1480:689a`, `1480:68e2`, and `1480:692a`, each separated by `0x48` bytes. The `1398:193f` entry at source-pane slot `+0x08` matches the already recovered source-pane click handler, validating this decode.
|
||||
|
||||
| UI table | Root | Recovered debugger overrides |
|
||||
| --- | --- | --- |
|
||||
| Main debugger gump | `1480:689a` | `+0x00` `usecode_debugger_gump_destroy`; `+0x10` `ui_gump_reposition_after_parent_move`; `+0x14` `usecode_debugger_forward_child_event`; `+0x18` `usecode_debugger_translate_registered_event`; `+0x30` `usecode_debugger_gump_forward_base_event_if_clean`; `+0x34` shared UI dispatcher at `1360:0cb2`. |
|
||||
| Auxiliary child control | `1480:68e2` | `+0x00` `usecode_debugger_aux_control_destroy`; `+0x08` source-line click handler `usecode_debugger_source_pane_handle_click`; `+0x10` shared parent-move handler; `+0x30` `usecode_debugger_aux_control_draw_line_rows`; `+0x34` shared UI dispatcher. Click, selected-row, and draw behavior identify it as a source-line selection/rendering control; exact screen layout remains uncertain. |
|
||||
| Source pane | `1480:692a` | `+0x00` `usecode_debugger_source_pane_destroy`; `+0x04` `usecode_debugger_source_pane_forward_event_to_pointer_handler`; `+0x08` `usecode_debugger_source_pane_handle_event_type_2`; `+0x10` pointer handler `usecode_debugger_source_pane_handle_pointer_event`; `+0x14` `usecode_debugger_source_pane_on_layout_change`; `+0x18` command handler `usecode_debugger_source_pane_handle_command`; `+0x30` visible-line draw `usecode_debugger_source_pane_draw_visible_lines`; `+0x34` shared UI dispatcher. |
|
||||
|
||||
The tables also share their framework defaults: slot `+0x0c` is `1008:3db1`; slots `+0x1c`, `+0x20`, `+0x24`, `+0x28`, and `+0x2c` are `1008:3db6`, `3dbb`, `3dc0`, `3dc5`, and `3dca` respectively (the last returns zero). Their common tail is `+0x34` `ui_gump_dispatch_event`, `+0x38` `1008:3dd1`, `+0x3c` `1360:12ee`, `+0x40` `1008:3de6`, and `+0x44` `1008:3deb`. Thus the override lists above plus these shared slots account for all 18 entries in each UI table.
|
||||
|
||||
The shared dispatcher at `1360:0cb2` translates UI event codes `1`, `2`, `4`, `8`, `0x10`, and `0x20` to vtable byte offsets `+0x04` through `+0x18`; its `0x40` lane iterates child callbacks at `+0x34`, and `0x100` dispatches at `+0x24`. This establishes why `1398:0ef9`, `1398:0e81`, and `1398:0aa1` had no direct callers: they are reached through source-pane table slots, not direct call instructions. The `0ef9` thunk forwards the pane and event to that same pane's slot `+0x10`, resolved to `1398:0f16`; it does not call a separate nested widget. The parent debugger event handler at `1398:2243` reads the auxiliary control's selected row at `+0x47` for event `0x0d` and clears the corresponding marker byte in the ten-row table at `1480:64f0 + row*0x29 + 9`, linking the child selection control to breakpoint-marker handling.
|
||||
|
||||
`1398:0e81` was absent from the function database despite being a source-pane vtable target. Its raw body is now defined through the far return at `1398:0ef8`, immediately before the next function at `1398:0ef9`, and named `usecode_debugger_source_pane_handle_event_type_2`. It tests event-structure field `+0x0c`: value `1` installs the widget pointer in shared graphics-context globals, sets widget flag bits `0x09`, and invokes the pane's own virtual slot `+0x10`; value `3` clears that shared context and those flag bits. The callback target is `1398:0f16`; the user-gesture meanings of event values `1` and `3` remain unknown.
|
||||
|
||||
The bootstrap override table at `1480:6972` begins with two confirmed far-pointer entries: slot `+0x00` opens the current-unit debugger and slot `+0x04` formats an expression into the shared buffer. The following bytes are not treated as further vtable entries; the neighboring UI tables were identified independently from their constructor vptr stores and complete 18-entry layouts.
|
||||
|
||||
### Remaining Nearby Gaps
|
||||
|
||||
The debugger-owned UI/source-buffer code, the three adjacent UI vtables, all `13e0` break-state helpers, the full table-dispatched `13f0` hook body, and the adjacent `13f8` context factory/wrapper path are now mapped to a bounded level. Remaining questions are narrower:
|
||||
|
||||
- `1398:16ee` constructs the auxiliary source-line selection/rendering control. Its click, selected-row field, and line-row draw behavior are established; exact screen geometry and draw ordering remain unknown.
|
||||
- The event values handled by `1398:0e81` are established, but their user-gesture meanings are not. `1398:0ef9` forwards the same pane/event to pointer handler `1398:0f16`.
|
||||
- `1398:304b` and `1398:305c` have no callers or address-taken references. They wrap shared `1250:056a/06eb` setup/cleanup with key `0x95ff` and the item-cache path at `1480:1476+0x0a`; a cache/resource role is likely, but debugger ownership and runtime reachability are unproven.
|
||||
- `1398:306f` is another unreferenced destructor-style thunk through shared UI cleanup `1360:046e`, absent from the three recovered debugger vtables. The class owner is unresolved. The neighboring destructor entries `1398:30a9`, `1398:30e3`, and `1398:311d` are now mapped to the main gump, auxiliary child, and source pane respectively.
|
||||
- The interpreter has three indirect far calls, now classified by opcode. Opcode `0x0f` calls through runtime table `1480:96e6`, built by `usecode_interpreter_load_intrinsic_table` (`13f8:062f`) during usecode startup; target values depend on loaded records. Opcode `0x70` has static sub-operations `2..6` at `13f0:3468`, `3539`, `3610`, `3695`, and `3720`, converging on `13f0:38a3` through a runtime object's `+0x04` field. Opcode `0x73` calls through a stack-selected object's `+0x02` field at `13f0:3975`. These final targets remain runtime-dependent and none is needed to explain the direct opcode `0x5c` record producer.
|
||||
- `usecode_debugger_bootstrap_init`, `usecode_debugger_open_modal`, and `usecode_debugger_open_for_current_unit` have no recovered static callers. The bootstrap also has no recovered raw far-call encoding or far-pointer copy. The ordinary usecode startup chain `13f8:0cdf -> 13f8:1499 -> 13f8:062f` installs the interpreter wrapper/hook and builds runtime tables, but no static bridge to the debugger bootstrap was found. Examined cheat/input paths likewise have no references to the debugger openers, so normal-session bootstrap and deliberate UI activation remain runtime questions.
|
||||
- Segment:offset labels are program-specific. In `REGRET.EXE`, `13a0:01ee` and `13a0:0361` are item operations, not the similarly addressed debugger formatter functions documented for `CRUSADER.EXE`.
|
||||
|
||||
These are bounded UI/dispatch and runtime questions, not an unlocated second debugger subsystem or a missing producer. The remaining high-value checks are dynamic: verify the bootstrap is reached, capture the opcode `0x5c` record fields, and observe breakpoint/open/resume behavior in a live session.
|
||||
|
||||
## Verified Regret Findings
|
||||
|
||||
### 1. The broad hidden cheat/debug framework still exists
|
||||
|
|
@ -38,6 +85,7 @@ These functions are now renamed live in the active `REGRET.EXE` database:
|
|||
- `1398:0086` = `usecode_debugger_open_for_current_unit`
|
||||
- `1398:020d` = `usecode_debugger_open_modal`
|
||||
- `1398:0291` = `usecode_debugger_format_expression_to_shared_buffer`
|
||||
- `1398:045c` = `usecode_debugger_format_descriptor_expression`
|
||||
- `1398:088f` = `usecode_debugger_source_pane_create`
|
||||
- `1398:0ba7` = `usecode_debugger_source_pane_handle_command`
|
||||
- `1398:0f16` = `usecode_debugger_source_pane_handle_pointer_event`
|
||||
|
|
@ -45,9 +93,13 @@ These functions are now renamed live in the active `REGRET.EXE` database:
|
|||
- `1398:1118` = `usecode_debugger_source_pane_draw_visible_lines`
|
||||
- `1398:1413` = `usecode_debugger_source_pane_clamp_viewport`
|
||||
- `1398:15ac` = `usecode_debugger_source_pane_load_file`
|
||||
- `1398:1791` = `usecode_debugger_source_pane_draw`
|
||||
- `1398:1791` = `usecode_debugger_aux_control_draw_line_rows`
|
||||
- `1398:193f` = `usecode_debugger_source_pane_handle_click`
|
||||
- `1398:19b1` = `usecode_debugger_gump_create`
|
||||
- `1398:0ae8` = `usecode_debugger_source_pane_init_current_line`
|
||||
- `1398:0b06` = `usecode_debugger_source_pane_set_line_position`
|
||||
- `1398:0b52` = `usecode_debugger_source_pane_center_on_line`
|
||||
- `1398:2882` = `usecode_debugger_gump_build_menus`
|
||||
- `1398:1c2c` = `usecode_debugger_translate_registered_event`
|
||||
- `1398:1dc6` = `usecode_debugger_forward_child_event`
|
||||
- `1398:1df3` = `usecode_debugger_handle_event`
|
||||
|
|
@ -67,10 +119,15 @@ These functions are now renamed live in the active `REGRET.EXE` database:
|
|||
- `13e0:0474` = `usecode_debugger_break_state_vtable_slot1_return_zero`
|
||||
- `13f0:0000` = `interpreter_push_saved_farptr`
|
||||
- `13f0:003c` = `interpreter_pop_saved_farptr`
|
||||
- `13f0:00b8` = `usecode_interpreter_get_intrinsic_table_entry`
|
||||
- `13f0:00e8` = `usecode_interpreter_context_init`
|
||||
- `13f0:01c7` = `usecode_interpreter_reserve_stack_bytes`
|
||||
- `13f0:0244` = `usecode_interpreter_context_create`
|
||||
- `13f0:034f` = `usecode_interpreter_advance_source_cursor`
|
||||
- `13f0:035f` = `usecode_interpreter_context_load_source_cursor_from_global_unit`
|
||||
- `13f0:038b` = `usecode_debugger_interpreter_hook`
|
||||
- `13f8:062f` = `usecode_interpreter_load_intrinsic_table`
|
||||
- `13f8:0eec` = `usecode_interpreter_create_process_context`
|
||||
- `13f8:10da` = `usecode_interpreter_run_context_with_debugger_hook`
|
||||
- `13f8:1d72` = `entity_vm_runtime_get_slot_chunk_ptr_at_offset`
|
||||
- `1398:2c2e` = `usecode_debugger_source_buffer_create_from_path`
|
||||
|
|
@ -79,6 +136,16 @@ These functions are now renamed live in the active `REGRET.EXE` database:
|
|||
- `1398:2e0a` = `usecode_debugger_source_buffer_load_text`
|
||||
- `1398:2f4f` = `usecode_debugger_source_buffer_split_lines_in_place`
|
||||
- `1398:301d` = `usecode_debugger_source_buffer_get_line_ptr`
|
||||
- `1398:0aa1` = `usecode_debugger_source_pane_on_layout_change`
|
||||
- `1398:0e81` = `usecode_debugger_source_pane_handle_event_type_2`
|
||||
- `1398:0ef9` = `usecode_debugger_source_pane_forward_event_to_pointer_handler`
|
||||
- `1398:16ee` = `usecode_debugger_aux_control_create`
|
||||
- `1398:1c08` = `usecode_debugger_gump_forward_base_event_if_clean`
|
||||
- `1398:30a9` = `usecode_debugger_gump_destroy`
|
||||
- `1398:30e3` = `usecode_debugger_aux_control_destroy`
|
||||
- `1398:311d` = `usecode_debugger_source_pane_destroy`
|
||||
- `1328:00d7` = `ui_gump_reposition_after_parent_move`
|
||||
- `1360:0cb2` = `ui_gump_dispatch_event`
|
||||
|
||||
Why `1398:0086` matches the current-unit wrapper:
|
||||
|
||||
|
|
@ -101,7 +168,8 @@ Newly closed helper roles in this pass:
|
|||
- `usecode_debugger_source_pane_draw_visible_lines` is the stronger local draw body for visible source rows, including current-line highlight and breakpoint marks.
|
||||
- `usecode_debugger_source_pane_clamp_viewport` constrains the source viewport and syncs the pane against child scrollbars.
|
||||
- `usecode_debugger_source_pane_load_file` is the common file-load path used both by the current-unit opener and by the file-open event lane.
|
||||
- `usecode_debugger_source_pane_draw` renders the visible source pane from the loaded `.unk` buffer and overlays debugger-side markers.
|
||||
- `usecode_debugger_aux_control_draw_line_rows` renders the ten-row line table, selected-row highlight, and per-row markers through the debugger frontend formatter.
|
||||
- `usecode_debugger_source_pane_draw_visible_lines` renders text from the loaded `.unk` buffer and overlays debugger-side markers; it is distinct from the auxiliary line-row renderer.
|
||||
- `usecode_debugger_source_pane_handle_click` maps mouse position back to a visible line index.
|
||||
- `usecode_debugger_break_state_add_breakpoint`, `remove_breakpoint`, `find_breakpoint_or_next_index`, and `has_breakpoint` close the breakpoint-table maintenance cluster.
|
||||
- `usecode_debugger_break_state_push_current_entry`, `push_current_entry_copy`, and `pop_current_entry` close the current-entry stack helper cluster enough to stop treating it as anonymous storage logic.
|
||||
|
|
@ -222,11 +290,16 @@ The wrapper at `13f8:10da` now makes that path clearer:
|
|||
|
||||
That is not the shape of a manual debugger launcher. It is the shape of ordinary VM execution with an optional debugger sidecar.
|
||||
|
||||
The final direct-xref closure in Regret is now tighter than the earlier pass:
|
||||
The initial direct-xref closure was incomplete because the hook's computed opcode targets were not part of its Ghidra function body. After decoding the table and extending the body to the recovered handler blocks:
|
||||
|
||||
- exhaustive `1480:712c/712e` data-use recovery now shows only the already-named bootstrap/open/format/draw/event functions plus `usecode_debugger_interpreter_hook`; no extra hidden debugger-object consumers surfaced outside that cluster
|
||||
- direct address searches for the helper entry points also stayed narrow: `usecode_debugger_break_state_clear_runtime_break_flags` is only called from the hook prologue, `usecode_debugger_break_state_pop_current_entry` is only called from the hook unwind, `usecode_debugger_interpreter_hook` is only called from `usecode_interpreter_run_context_with_debugger_hook`, and `usecode_interpreter_context_create` is only called from the upstream usecode-process/context factory path at `13f8:0eec`
|
||||
- that means the remaining uncertainty is no longer broad subsystem discovery; it is the exact location of the missing current-entry push inside an already-identified interpreter/runtime path
|
||||
- `usecode_debugger_break_state_push_current_entry` has a caller at `13f0:051d` in opcode `0x5c`.
|
||||
- `usecode_debugger_break_state_push_current_entry_copy` has a caller at `13f0:2ab9` in opcode `0x57`.
|
||||
- `usecode_debugger_break_state_pop_current_entry` has callers at `13f0:2a56` (opcode `0x57` parent/child transition), `13f0:3378` (opcode `0x50` return), and `13f0:3d78` (hook final unwind).
|
||||
- `usecode_debugger_break_state_update_line_and_maybe_break` has a caller at `13f0:04b5` in opcode `0x5b`.
|
||||
- the hook's global references now include its line, push, child-context, return, and unwind handlers. `1480:712c/712e` still has only one recovered write, from `usecode_debugger_bootstrap_init` at `1398:0064`.
|
||||
- `usecode_interpreter_create_process_context` is called by `Usecode_ItemCallEvent` and by two interpreter opcode paths at `13f0:2a8b` and `13f0:2bed`.
|
||||
|
||||
The producer is therefore directly wired into the bytecode interpreter; no runtime-synthesized call is needed to explain record creation. The remaining indirect calls in the hook are ordinary intrinsic/object callback dispatches and are not the current-entry producer sites.
|
||||
|
||||
### 8. No Regret appears to keep an auto-open-on-break path that retail No Remorse lacks
|
||||
|
||||
|
|
@ -256,7 +329,7 @@ Current direct-caller state in the live database:
|
|||
- no normal direct callers to `usecode_debugger_open_modal`
|
||||
- `usecode_debugger_handle_event` is reached only through debugger callback wrappers (`usecode_debugger_translate_registered_event` and `usecode_debugger_forward_child_event`)
|
||||
- `usecode_debugger_interpreter_hook` is called from `usecode_interpreter_run_context_with_debugger_hook`, which looks like a real runtime/interpreter-side consumer
|
||||
- no normal direct callers are yet recovered for `usecode_debugger_break_state_push_current_entry` or `usecode_debugger_break_state_push_current_entry_copy`
|
||||
- the current-entry push/copy helpers are called from opcode `0x5c` and opcode `0x57` handlers inside the interpreter hook
|
||||
|
||||
So the current best distinction is:
|
||||
|
||||
|
|
@ -265,39 +338,41 @@ So the current best distinction is:
|
|||
|
||||
In other words, No Regret looks better wired than retail No Remorse, but still not yet proven to expose a deliberate user-facing launcher.
|
||||
|
||||
### 10. The required seeding currently looks engine-side, not like a compiled-usecode feature
|
||||
### 10. The required seeding is engine-side bytecode dispatch, not a UI or `.unk` feature
|
||||
|
||||
This pass materially tightens the `who seeds the records?` question.
|
||||
|
||||
What the new names and caller map now support:
|
||||
|
||||
- `usecode_debugger_break_state_pop_current_entry` has a direct caller in `usecode_debugger_interpreter_hook`
|
||||
- opcode `0x5b` updates the current line through `usecode_debugger_break_state_update_line_and_maybe_break`
|
||||
- opcode `0x5c` calls `usecode_debugger_break_state_push_current_entry` with live interpreter inputs
|
||||
- opcode `0x57` snapshots/pops the parent record around child-context creation, then pushes the copied record into the child debugger state
|
||||
- opcode `0x50` pops a current-entry record during interpreter return
|
||||
- the hook epilogue has an additional guarded pop when interpreter execution unwinds
|
||||
- `usecode_interpreter_run_context_with_debugger_hook` wraps an ordinary interpreter execution path, not a debugger-only path
|
||||
- the hook clears runtime break flags on entry, runs the interpreter loop, and unwinds debugger current-entry depth on exit
|
||||
- the current-entry push helpers still have no recovered script-visible or UI-visible callers
|
||||
- the new source-buffer/file-load chain is only consumed by debugger UI and current-unit open paths, not by the interpreter-side seeding path
|
||||
- the hook clears runtime break flags on entry and dispatches bytecode through a jump table; source loading remains a separate UI concern
|
||||
|
||||
Caller-recovery status after the wider disassembly pass:
|
||||
Caller-recovery status after the complete table-driven disassembly pass:
|
||||
|
||||
- the direct caller of `usecode_debugger_break_state_push_current_entry` is still not surfaced as a normal xref in the current Regret database
|
||||
- the strongest current structural candidate remains an unrecovered or still-overlapped interpreter-side producer analogous to retail `Interpreter_NextUsecodeOp`
|
||||
- the deeper recovered Regret chain is now explicit: `Usecode_ItemCallEvent -> 13f8:0eec -> usecode_interpreter_context_create -> usecode_interpreter_context_init / interpreter_push_saved_farptr -> usecode_debugger_interpreter_hook`
|
||||
- that outer factory path also explains where the debugger-side source cursor comes from: `13f8:0eec` and `usecode_interpreter_context_load_source_cursor_from_global_unit` both use `entity_vm_runtime_get_slot_chunk_ptr_at_offset` against the current live usecode root at `1480:71a1/71a3`
|
||||
- the nearby `13f0` context/setup helpers seed the live interpreter object's source-stream and frame-base lanes (`+0xd6/+0xd8` and `+0xda/+0xdc`), but the visible direct call path there still reaches stack/context helpers rather than the debugger push helper itself
|
||||
- the direct callers now show the exact producer/copy/pop lifecycle instead of only the hook epilogue
|
||||
- the context-creation chain is explicit: `Usecode_ItemCallEvent -> usecode_interpreter_create_process_context -> usecode_interpreter_context_create`; opcode `0x57` and `0x58` also call the process-context factory
|
||||
- the context factory and `usecode_interpreter_context_load_source_cursor_from_global_unit` resolve source data through `entity_vm_runtime_get_slot_chunk_ptr_at_offset` against the current live usecode root at `1480:71a1/71a3`
|
||||
- the interpreter context carries source-stream and frame lanes at `+0xd6/+0xd8` and `+0xda/+0xdc`; opcode `0x5c` serializes the relevant live values into the debugger record
|
||||
- a seemingly promising `1458:` lane that writes fields at `+0x72/+0x74/+0x76/+0x78/+0x7a/+0x7c` turned out to be the RIFF/animation parser family, not the debugger, so it should be treated as a false structural cousin rather than as debugger seeding evidence
|
||||
|
||||
What this now rules out with fairly high confidence:
|
||||
|
||||
- there is no additional large unnamed Regret-side debugger subsystem still hiding outside the already recovered `1398` / `13e0` / `13f0` / `13f8` lanes
|
||||
- there is no second recovered writer or alternate global-owner path for the debugger object beyond `usecode_debugger_bootstrap_init`
|
||||
- there is no recovered direct UI/source-buffer-side path that seeds the current-entry stack before `RUN`
|
||||
- there is no ordinary standalone caller of `usecode_debugger_break_state_push_current_entry` waiting to be found by one more basic xref sweep
|
||||
- current-entry seeding is not performed by the `.unk` loader or source-pane UI; it occurs in interpreter bytecode handlers
|
||||
- the producer calls are in the opcode switch body, not separate standalone functions
|
||||
|
||||
Current best read from that combination:
|
||||
|
||||
- current-entry seeding is part of engine-side interpreter bookkeeping around live usecode execution
|
||||
- the record format, producer calls, matching spawn/return pops, and source/frame inputs all exist in the recovered interpreter path
|
||||
- record creation is gated by the debugger global and relevant bytecode paths; a manually opened modal still does not manufacture a running VM context
|
||||
- it is not currently evidenced as a direct feature toggled by `.unk` contents
|
||||
- it is not currently evidenced as a distinct compiled-usecode opcode that scripts can invoke to manufacture debugger state
|
||||
- the `0x5b`/`0x5c` handlers are bytecode dispatch cases; exact toolchain behavior and how often retail scripts emit them still need runtime/corpus validation
|
||||
|
||||
Compiled usecode still matters, but in a narrower way:
|
||||
|
||||
|
|
@ -305,7 +380,7 @@ Compiled usecode still matters, but in a narrower way:
|
|||
- it provides the runtime activity that naturally flows through the interpreter wrapper/hook path
|
||||
- but the actual debugger-object and current-entry stack ownership still appears to live in executable-side VM code
|
||||
|
||||
So the current answer to `is there an automated mechanism?` is `yes, probably`, but the mechanism currently looks like ordinary interpreter-side debug bookkeeping rather than a dedicated source-file or script-level launcher feature.
|
||||
So the current answer to `does this executable statically automate current-entry seeding?` is **yes**: opcode `0x5c` pushes the record; opcode `0x57` propagates it across child-process creation; opcode `0x50` and the hook unwind pop it. The ordinary debugger activation path and live-runtime behavior still need testing.
|
||||
|
||||
### 11. What the seeding record actually is, and what that implies for simulation
|
||||
|
||||
|
|
@ -316,14 +391,14 @@ The current-entry push helpers are now explicit enough to answer the practical `
|
|||
- `+0x00..+0x08` = inline unit-name string, asserted to fit in `8` bytes plus terminator
|
||||
- `+0x09..+0x0c` = first runtime far pointer
|
||||
- `+0x0d..+0x10` = second runtime far pointer
|
||||
- `+0x11..+0x14` = third runtime far pointer
|
||||
- `+0x11..+0x14` = third far-pointer field; the shipped opcode `0x5c` producer currently supplies `0:0`
|
||||
|
||||
The important part is not the string. It is what the debugger later does with the payload dwords.
|
||||
|
||||
Known current consumers:
|
||||
|
||||
- `usecode_debugger_open_for_current_unit` uses the inline unit name to build the `.unk` path under `s_usecode`
|
||||
- `usecode_debugger_format_expression_to_shared_buffer` resolves the top current-entry record and passes entry `+0x09` and `+0x0d` into `FUN_1398_045c`
|
||||
- `usecode_debugger_format_expression_to_shared_buffer` resolves the top current-entry record and passes entry `+0x09` and `+0x0d` into `usecode_debugger_format_descriptor_expression`
|
||||
- the formatter helper then dereferences those payload dwords as live source/descriptor and frame/evaluation context, not as inert metadata
|
||||
|
||||
That means the debugger seeding issue is **not** `how do we invent filenames or line numbers`. It is `how do we capture a valid live VM snapshot and serialize it into the break-state stack`.
|
||||
|
|
@ -332,10 +407,24 @@ The recovered interpreter-side precursor path now explains where that snapshot d
|
|||
|
||||
- `usecode_interpreter_context_create` seeds the live interpreter context with source-stream cursor at `+0xd6/+0xd8`
|
||||
- the same helper seeds a second live lane at `+0xda/+0xdc` that the hook immediately dereferences as a frame/stream-adjacent context root
|
||||
- `+0xe1/+0xe3` is the strongest current candidate for the third current-entry dword, though that trailing entry field still lacks a live consumer in Regret
|
||||
- `+0xe1/+0xe3` is initialized as another interpreter-context lane, but the audited opcode `0x5c` producer does not read it; that producer explicitly supplies `0:0` for record field `+0x11`, and no static consumer of that field was found in the audited formatter path
|
||||
- `usecode_interpreter_context_load_source_cursor_from_global_unit` and the upstream `13f8:0eec` factory both derive the source cursor from the current usecode root at `1480:71a1/71a3` through `entity_vm_runtime_get_slot_chunk_ptr_at_offset`
|
||||
|
||||
So the seeding data is already present in ordinary in-process runtime state. The missing piece is the serializer/call site that pushes it into the debugger break-state object.
|
||||
The first two record pointers are derived from live interpreter state: the first is the current source-stream segment with its cursor offset advanced by the line operand; the second is the interpreter segment with the context offset plus `context[+0xd4] + 4`. Opcode `0x5c` passes those pointers to the shipped record-writing helper and explicitly passes `0:0` for the third field. No external serializer or new producer call is required for the recovered interpreter path. The intended meaning of the unused third field, any alternate runtime writer, and the ordinary debugger bootstrap/launch path remain unresolved.
|
||||
|
||||
#### Recovered producer check and simulation answer
|
||||
|
||||
The current Ghidra evidence on `REGRET.EXE` is:
|
||||
|
||||
- The opcode switch at `13f0:0457` has 122 table entries and 106 distinct decoded destinations.
|
||||
- The `0x5c` destination calls `13e0:02f5`; the `0x57` destination calls `13e0:03b0` after saving the parent record.
|
||||
- The matching pop calls are at `13f0:2a56`, `13f0:3378`, and `13f0:3d78`.
|
||||
- Opcode `0x5b` updates the break-state line at `13f0:04b5`.
|
||||
- The debugger global at `1480:712c/712e` still has one recovered write at bootstrap `1398:0064`; the interpreter handlers read it to gate these operations.
|
||||
|
||||
Therefore, the executable contains and statically connects the debugger record format, producer, child-context propagation, line update, and return/unwind behavior. The first two pointer fields are computed from transient VM state, not recovered from `.unk`; the shipped opcode `0x5c` producer writes zero to the third field. What remains unproven is runtime behavior: the actual first-two pointer values at execution, whether another path writes the third field, whether the active build's ordinary bootstrap initializes the global in a normal session, and whether the debugger reaches the expected pause/open flow without a patch.
|
||||
|
||||
The rebuild can simulate the record without reproducing 16-bit segmented addresses literally. `UsecodeProcessTask` already carries class/event identity, bytecode and program counter, a value stack, routine/call frames, and a process frame; the context factory also models source/owner pointers in emulated runtime memory. A debugger layer can derive a structured current-entry stack from those values and balance it on nested calls/returns. That is enough to model line/callstack/breakpoint state. It is **not** yet enough to claim full original debugger parity: `UsecodeInterpreterState::step()` implements only a subset of opcodes, and watch/inspect formatting still needs descriptor evaluation and intrinsic/runtime coverage.
|
||||
|
||||
### 12. Existing data versus live memory: what has to be true for the debugger to work
|
||||
|
||||
|
|
@ -381,13 +470,13 @@ What an external helper **would** have to do if it existed:
|
|||
|
||||
That is possible in principle for a development-only DOS memory poking tool, but it would still be a **live memory injector**, not an external source-file preprocessor.
|
||||
|
||||
The stronger current explanation is simpler:
|
||||
The table-driven handler recovery changes the earlier explanation:
|
||||
|
||||
- the game already has all the required data in-process
|
||||
- Regret still has the debugger object, hook, open path, and stack helpers
|
||||
- the missing visible push is most likely inside a table-driven, overlapped, or otherwise not-cleanly-recovered interpreter path rather than in a separate external system
|
||||
- opcode `0x5c` calls the record pusher and opcode `0x57` copies a saved record into a child process context
|
||||
|
||||
So the external-process hypothesis is not impossible, but it is not needed to explain the current evidence and currently looks less likely than an internal interpreter-side producer.
|
||||
An external-process hypothesis is still unsupported and is not needed to explain record creation. An external writer could still be used for experiments, but the executable already contains a statically recovered producer path.
|
||||
|
||||
### 14. How we can simulate the seeding today
|
||||
|
||||
|
|
@ -397,18 +486,19 @@ There are three realistic simulation strategies, and they are not equally good.
|
|||
|
||||
This is the most promising route.
|
||||
|
||||
The recovered Regret path already creates the live context data we need:
|
||||
The recovered Regret path already creates and serializes the live context data we need:
|
||||
|
||||
- `Usecode_ItemCallEvent -> 13f8:0eec -> usecode_interpreter_context_create -> usecode_debugger_interpreter_hook`
|
||||
- `Usecode_ItemCallEvent -> usecode_interpreter_create_process_context`
|
||||
- opcode `0x5c` updates the line/entry state; opcodes `0x57` and `0x50` handle child-context and return transitions
|
||||
|
||||
So the smallest high-confidence simulation is to add or re-enable a push at an existing in-process point where all ingredients are already live:
|
||||
For ordinary interpreter execution, the record producer is already wired. A patch is not needed to add that call. The unproven patch question is instead how the hidden debugger object is bootstrapped or deliberately opened in a normal session. For a controlled experiment, the relevant live inputs at opcode `0x5c` are:
|
||||
|
||||
- current unit name
|
||||
- source-stream cursor
|
||||
- frame payload pointer
|
||||
- debugger object pointer
|
||||
|
||||
Conceptually, this means restoring the missing `push_current_entry` behavior near the interpreter-context creation / hook handoff instead of inventing new data.
|
||||
Conceptually, a runtime experiment should break at the recovered opcode `0x5c` callsite and capture the existing record, rather than insert a duplicate producer.
|
||||
|
||||
Why this is strongest:
|
||||
|
||||
|
|
@ -425,9 +515,9 @@ For a minimal one-shot debugger open, the injected state would need at least:
|
|||
- debugger object at `1480:712c/712e` already valid
|
||||
- depth `+0x7a >= 1`
|
||||
- inline unit-name record at `+0x7c`
|
||||
- entry `+0x09` = valid live source cursor far pointer
|
||||
- entry `+0x0d` = valid live frame payload far pointer
|
||||
- entry `+0x11` = probably safe as zero or borrowed from the third interpreter lane unless a new consumer proves otherwise
|
||||
- entry `+0x09` = source-stream segment:`source_cursor_offset + line_operand`, as assembled by opcode `0x5c`
|
||||
- entry `+0x0d` = interpreter segment:`context_offset + context[+0xd4] + 4`, as assembled by opcode `0x5c`
|
||||
- entry `+0x11` = `0:0` in the shipped opcode `0x5c` producer; the audited formatter does not consume it, and borrowing `+0xe1/+0xe3` is unsupported by the static producer evidence
|
||||
- current line `+0x72` set coherently enough for the source pane and breakpoint checks
|
||||
|
||||
This could probably make `open_for_current_unit` and some expression/inspect flows work if the payload pointers are borrowed from a real live interpreter context.
|
||||
|
|
@ -450,37 +540,31 @@ This is useful, but it does not solve the seeding problem by itself.
|
|||
|
||||
So offline-only work is supportive, not sufficient.
|
||||
|
||||
### 15. What an in-process patch would actually do
|
||||
### 15. What an in-process patch would still need to do
|
||||
|
||||
The safest current model is **not** `hex-edit the EXE until it behaves`. It is `restore one missing debugger-side serialization step at a point where the game already has all required live data`.
|
||||
The producer itself should not be patched: the opcode `0x5c` path already calls it, and opcode `0x57`/`0x50` provide context transition and return pops. Any patch experiment should target only a demonstrated remaining gap, such as making the existing bootstrap reachable or exposing a deliberate debugger-open command.
|
||||
|
||||
The candidate in-process patch is small in *behavioral* scope even if it still has to be handled carefully at the byte level:
|
||||
The candidate launcher patch should preserve the recovered interpreter lifecycle:
|
||||
|
||||
- leave the existing debugger object/bootstrap path alone
|
||||
- leave the existing UI/event/gump code alone
|
||||
- leave the existing interpreter context creation path alone
|
||||
- add or re-enable one call into `usecode_debugger_break_state_push_current_entry` or `...push_current_entry_copy` at a point where the current unit name and the three payload dwords already exist live
|
||||
- route an intentional input or debug trigger to the existing open/break-state path only after confirming the bootstrap and live interpreter context are valid
|
||||
|
||||
In concrete terms, the best current patch window is the already-recovered handoff around:
|
||||
The recovered handoff to observe (not duplicate) is:
|
||||
|
||||
- `Usecode_ItemCallEvent`
|
||||
- `13f8:0eec`
|
||||
- `usecode_interpreter_context_create`
|
||||
- `usecode_debugger_interpreter_hook`
|
||||
- opcode `0x5b` line update at `13f0:04b5`
|
||||
- opcode `0x5c` record push at `13f0:051d`
|
||||
- opcode `0x57` child-context record propagation at `13f0:2a56/2ab9`
|
||||
- opcode `0x50` return pop at `13f0:3378`
|
||||
|
||||
That is the narrowest place where all of these are already true at once:
|
||||
These sites already establish that:
|
||||
|
||||
- a live interpreter/process object exists
|
||||
- the source-stream cursor is already computed
|
||||
- the frame/evaluation payload lane already exists
|
||||
- the debugger object global can already be tested
|
||||
- the debugger global is checked before record operations
|
||||
- live source/frame context is available to the producer
|
||||
- nested process and return paths maintain debugger-entry depth
|
||||
|
||||
So an in-process patch would most likely mean one of these two designs:
|
||||
|
||||
1. restore a missing direct push call near context creation or immediately before the debugger hook runs
|
||||
2. synthesize the equivalent `0x15`-byte record in-place and then increment debugger depth exactly once per entered debugged frame
|
||||
|
||||
The first design is strongly preferred because it reuses the shipped helper and keeps the later pop/unwind behavior matched.
|
||||
If a patch is later needed, first capture the bootstrap and modal-open call paths; do not add another push without evidence of a missing transition, or the existing pop paths may become unbalanced.
|
||||
|
||||
### 16. Why this should be done in Ghidra on a writable patch target, not by blind hex editing
|
||||
|
||||
|
|
@ -582,7 +666,7 @@ Why watch/inspect depend on seeding:
|
|||
|
||||
- the dispatcher routes both commands through the debugger object's formatter callback
|
||||
- `usecode_debugger_format_expression_to_shared_buffer` resolves the top current-entry record from the break-state stack
|
||||
- it passes entry `+0x09` and `+0x0d` into `FUN_1398_045c`
|
||||
- it passes entry `+0x09` and `+0x0d` into `usecode_debugger_format_descriptor_expression`
|
||||
- that helper dereferences those values as live descriptor/source and frame/evaluation context
|
||||
|
||||
So watch and inspect are not a workaround for missing seeding. They are actually one of the strongest proofs that seeding must be correct.
|
||||
|
|
@ -629,23 +713,24 @@ So the extra debugger commands help a lot in narrowing validation order, but the
|
|||
Current best path, in order of likelihood and engineering sanity:
|
||||
|
||||
1. Create a writable Regret patch target and keep the reference `REGRET.EXE` untouched.
|
||||
2. Identify the smallest concrete callsite near `13f8:0eec -> usecode_interpreter_context_create -> usecode_debugger_interpreter_hook` where a debugger push can be added with minimal byte disruption.
|
||||
3. Prefer a patch that calls the shipped `usecode_debugger_break_state_push_current_entry` helper rather than reimplementing the record layout by hand.
|
||||
4. If a direct call will not fit cleanly, use a tiny detour/trampoline into spare writable code space on the patch target rather than forcing a larger inline rewrite.
|
||||
5. Validate the patch first by opening the debugger and exercising file open, goto-line, search, and `change globals`.
|
||||
6. Only then test `watch` and `inspect`, because they are the first strong consumers of the seeded runtime payload.
|
||||
7. Only after those work, test `RUN`, then `break next`, then `single step`, because the pop-on-unwind behavior means resume features are stricter than one-shot UI success.
|
||||
2. In the live session, break at the recovered opcode `0x5b` line update and opcode `0x5c` push; capture the record, all three dwords, line, and stack depth.
|
||||
3. Confirm opcode `0x57` child-context copying and opcode `0x50`/hook unwind pops keep depth balanced.
|
||||
4. Verify whether the bootstrap runs in an ordinary session and identify how break-next/single-step becomes armed.
|
||||
5. Validate the existing path first with source open, goto-line, search, and `change globals`.
|
||||
6. Then test `watch` and `inspect` against the captured runtime pointers.
|
||||
7. Finally test `RUN`, `break next`, and `single step` across a complete execution/unwind cycle.
|
||||
|
||||
What is *less* likely to be the winning path:
|
||||
|
||||
- offline `.unk` or line-number work alone
|
||||
- a large multi-site executable rewrite
|
||||
- blind direct hex editing of the reference binary
|
||||
- an external helper unless it is effectively a smart live-memory injector that reads the real interpreter context
|
||||
- adding another current-entry push call; the `0x5c` producer is already present and statically called
|
||||
- an external helper unless it is being used for controlled live-state capture/injection
|
||||
|
||||
So the most likely route to working debug functionality is:
|
||||
|
||||
- **small in-process patch on a writable Regret copy**
|
||||
- **runtime validation of the existing interpreter producer, followed only if needed by a small launcher/bootstrap patch on a writable Regret copy**
|
||||
- **reuse shipped helper(s) and existing VM context data**
|
||||
- **validate in stages, with `change globals` before `watch/inspect`, and `watch/inspect` before full resume/step**
|
||||
|
||||
|
|
@ -674,7 +759,7 @@ Known remaining risk in this prototype:
|
|||
|
||||
- it assumes one current-entry push per wrapped hook invocation is the right balance for the later pop-on-unwind path
|
||||
- it assumes the `g_processNames` entry is the correct unit-name source in this lane
|
||||
- it assumes the third current-entry dword can be borrowed from `+0xe1/+0xe3` without harming current consumers
|
||||
- the 2026-10-08 static reconciliation supersedes this assumption: the shipped opcode `0x5c` producer passes `0:0`, while this prototype copies `+0xe1/+0xe3`. The prototype therefore diverges from the normal producer and is not evidence that the third field should contain that context lane; runtime effects remain untested.
|
||||
|
||||
So this should be treated as a tightly scoped runtime experiment, not as a final debugger restoration.
|
||||
|
||||
|
|
@ -1429,6 +1514,8 @@ Under the user's current stability constraint, the strongest recommendation is t
|
|||
|
||||
## What The `.unk` File Actually Looks Like
|
||||
|
||||
> The consolidated `.unk` evidence, unresolved questions, and reverse-engineering plan are maintained in [usecode-unk-format.md](./usecode-unk-format.md). This section preserves the original Regret debugger investigation and experiment history; update the dedicated note when format status changes.
|
||||
|
||||
Now that the patched Regret build can open the hidden debugger menu, the next blocker is the file-open prompt. The immediate practical question is whether that prompt wants one of the stock `UNK*.DAT` files or some other artifact.
|
||||
|
||||
Current best answer: the debugger does **not** appear to want `UNKDS.DAT` directly. It wants a per-unit `.unk` file under the `USECODE` root, and that file is expected to be a plain text source-style listing, not a small binary metadata blob.
|
||||
|
|
@ -1716,28 +1803,21 @@ Current safest interpretation:
|
|||
|
||||
### 3. Who seeds the records
|
||||
|
||||
This answer is now partly verified and partly inferred.
|
||||
The current-entry helpers have direct callers in the decoded bytecode-dispatch body:
|
||||
|
||||
What is directly verified:
|
||||
- `usecode_debugger_bootstrap_init` seeds the **object itself** and stores it into `1480:712c/712e`.
|
||||
- `13e0:02f5` pushes a new record from the opcode `0x5c` handler at `13f0:051d`.
|
||||
- `13e0:03b0` copies a saved `0x15`-byte record from the opcode `0x57` handler at `13f0:2ab9`.
|
||||
- `13e0:03f7` pops at `13f0:2a56` during the parent/child transition, at `13f0:3378` on opcode `0x50` return, and at `13f0:3d78` during hook unwind.
|
||||
- Opcode `0x5b` calls `usecode_debugger_break_state_update_line_and_maybe_break` at `13f0:04b5`.
|
||||
|
||||
- `usecode_debugger_bootstrap_init` seeds the **object itself** and stores it into `1480:712c/712e`
|
||||
- `13e0:02f5` seeds a **new current-entry record** from `(unit name, three runtime dwords)`
|
||||
- `13e0:03b0` seeds a **new current-entry record** by copying an already-built `0x15`-byte record wholesale
|
||||
- `13e0:03f7` pops one current-entry record on interpreter-side unwind
|
||||
- `usecode_debugger_interpreter_hook` is the live interpreter-side consumer that owns the pop on exit
|
||||
The earlier zero-caller result came from an incomplete function body: the indirect opcode table at `13f0:0457` had not been decoded, leaving the case instructions outside the hook's Ghidra body. After mapping the case blocks, Ghidra resolves the callers to `usecode_debugger_interpreter_hook`.
|
||||
|
||||
What is not yet fully recovered as a normal xref in the current MCP session:
|
||||
What remains unproven is runtime behavior, not the static producer: whether the bootstrap runs in an ordinary session, what exact values all three dwords carry at runtime, and whether the expected break/open/resume path is reached without a patch.
|
||||
|
||||
- the exact direct callsite that invokes `13e0:02f5` or `13e0:03b0`
|
||||
So the current answer to `who seeds the records?` is:
|
||||
|
||||
Current best evidence-based conclusion anyway:
|
||||
|
||||
- the record seeding is almost certainly performed by interpreter-side instrumentation around real usecode entry, not by the source loader and not by the modal-open wrapper
|
||||
- the push/pop pairing strongly points to a runtime-enter / runtime-leave model: enter usecode context -> push record -> run -> unwind -> pop record
|
||||
|
||||
So the current best answer to `who seeds the records?` is:
|
||||
|
||||
> the debugger bootstrap seeds the object, but a separate interpreter-side runtime path seeds the current-entry records. The exact static caller of `13e0:02f5` / `13e0:03b0` is still not recovered cleanly in the present database, but the runtime ownership is clearly on the interpreter side rather than on the file-loader side.
|
||||
> The debugger bootstrap creates the object. During interpreter execution, opcode `0x5c` pushes the live current-entry record; opcode `0x57` carries it across child-context creation; opcode `0x50` and the hook unwind pop it. The `.unk` loader does not seed this state.
|
||||
|
||||
### 4. Why `open_modal` is not enough
|
||||
|
||||
|
|
@ -1818,16 +1898,16 @@ Current safest read:
|
|||
|
||||
- manual synthetic seeding is plausible, but it needs **captured real runtime values** from a live interpreter context, not invented placeholders
|
||||
|
||||
#### Tier C: let the interpreter seed the record naturally, then open the debugger
|
||||
#### Tier C: let the recovered interpreter producer seed naturally
|
||||
|
||||
This is now the strongest practical route.
|
||||
This is now the strongest practical route. The producer is already present in opcode `0x5c`; no call needs to be added. The key remaining runtime question is whether the debugger object is bootstrapped and the expected line/context data are valid in an ordinary session.
|
||||
|
||||
Desired sequence:
|
||||
|
||||
1. bootstrap the debugger object
|
||||
2. arm break-next or single-step in the object
|
||||
3. allow one real usecode/interpreter pass to run
|
||||
4. let the interpreter-side debugger path push a genuine current-entry record
|
||||
4. let opcode `0x5c` push a genuine current-entry record, then verify its fields and depth
|
||||
5. open through the normal current-unit path or let the slot-`0` auto-open path fire
|
||||
|
||||
Why this is stronger than manual record fabrication:
|
||||
|
|
@ -1841,13 +1921,17 @@ Why this is stronger than manual record fabrication:
|
|||
If the immediate goal is `make the debugger work properly`, the best current manual recipe is no longer `generate a better .unk` by itself. The better recipe is:
|
||||
|
||||
1. keep the current JS exporter and synthetic Regret line floor so source load stays stable
|
||||
2. capture one real current-entry record from a live interpreter-side seed point
|
||||
2. either capture one real current-entry record at a verified or instrumented seed point, or wire a push where the live context is available
|
||||
3. reuse those captured values either:
|
||||
- by manual object seeding, or
|
||||
- by patching the launcher so the interpreter seeds them naturally before open
|
||||
- by explicitly patching the interpreter path to call the shipped helper before open
|
||||
|
||||
Current candidate capture points:
|
||||
Candidate capture points for a live run:
|
||||
|
||||
- opcode `0x5b` line update at `13f0:04b5`
|
||||
- opcode `0x5c` record push at `13f0:051d`
|
||||
- opcode `0x57` parent pop/copy push at `13f0:2a56` and `13f0:2ab9`
|
||||
- opcode `0x50` return pop at `13f0:3378`
|
||||
- breakpoint on `13e0:02f5`
|
||||
- breakpoint on `13e0:03b0`
|
||||
- breakpoint on `13e0:03f7` to see the matching pop side
|
||||
|
|
@ -1868,17 +1952,17 @@ That would immediately answer the remaining unknowns that static decompilation h
|
|||
|
||||
The path to a fully working debugger session now looks like this.
|
||||
|
||||
### Phase 1. Finish the record-seeding recovery
|
||||
### Phase 1. Validate the recovered record lifecycle at runtime
|
||||
|
||||
Goal:
|
||||
|
||||
- confirm the exact interpreter-side caller that reaches `13e0:02f5` / `13e0:03b0`
|
||||
- confirm the record fields and depth transitions at the recovered opcode handlers
|
||||
|
||||
Concrete actions:
|
||||
|
||||
1. use runtime breakpoints on `13e0:02f5`, `13e0:03b0`, and `13e0:03f7`
|
||||
1. use runtime breakpoints on `13f0:04b5`, `13f0:051d`, `13f0:2a56`, `13f0:2ab9`, and `13f0:3378`
|
||||
2. trigger ordinary usecode activity while the debugger object is live
|
||||
3. capture caller addresses and arguments
|
||||
3. capture the current-entry record, line value, caller opcode, and depth before/after each transition
|
||||
4. map the three packed dwords to concrete runtime structures
|
||||
|
||||
Deliverable:
|
||||
|
|
@ -1912,9 +1996,9 @@ Goal:
|
|||
|
||||
Concrete actions:
|
||||
|
||||
1. patch a hidden input lane only far enough to bootstrap the object and arm break-next / single-step
|
||||
1. first verify whether the existing bootstrap is reached in an ordinary session; patch a hidden input lane only if it is not
|
||||
2. do **not** open only through `open_modal`
|
||||
3. let the next real interpreter pass seed the current-entry record stack
|
||||
3. let opcode `0x5c` seed the current-entry record stack during real interpreter execution
|
||||
4. open through `usecode_debugger_open_for_current_unit` or the slot-`0` auto-open path
|
||||
|
||||
Deliverable:
|
||||
|
|
@ -1952,20 +2036,21 @@ Current safest answer to `what does it take for the debugger to work properly?`
|
|||
Current safest answer to `who seeds the records?` is:
|
||||
|
||||
- bootstrap seeds the object
|
||||
- interpreter-side runtime logic seeds the current-entry records
|
||||
- the exact push caller is still not fully recovered as a named xref, but the push/pop ownership is now clearly on the interpreter side, not on the source loader side
|
||||
- opcode `0x5c` calls the record pusher with live interpreter context
|
||||
- opcode `0x57` copies the record across child-context creation, and opcode `0x50` plus hook unwind pop it
|
||||
- the source/frame inputs are live VM values; no fixed data file is missing
|
||||
|
||||
Current safest answer to `how can we do it manually?` is:
|
||||
|
||||
- not by `.unk` text alone
|
||||
- by either capturing and writing one real current-entry record into the break-state object, or by patching a launcher path that lets the interpreter seed that record naturally before opening the debugger
|
||||
- by observing the existing `0x5c` producer in a live session and capturing the record, or by injecting a captured valid record for a one-shot experiment
|
||||
|
||||
## Open Questions After This Pass
|
||||
|
||||
1. Does retail No Remorse still contain a dormant analogue of the Regret vtable override, not just the writer/bootstrap?
|
||||
2. Are there any Regret-side callsites outside the current xref model that still seed break/step state intentionally for the debugger?
|
||||
3. Does any hidden Regret cheat/debug key or menu path manipulate the break-state bytes at `+0x74/+0x75/+0x76/+0x78` or otherwise force the slot-`0` auto-open path?
|
||||
4. Is `usecode_debugger_bootstrap_init` a real segment-load initializer, and if so where exactly is that load boundary controlled?
|
||||
2. What runtime values do the first two opcode `0x5c` pointers take, and does any alternate runtime path ever write a nonzero value to entry `+0x11`?
|
||||
3. Does the normal Regret bootstrap execute in a retail session, and what input/menu/debug path arms break-next or reaches the slot-`0` auto-open?
|
||||
4. Which runtime-loaded intrinsic targets and VM-object callbacks are reached at `13f0:30ab`, `38a3`, and `3975`? Their opcode roles and dynamic lookup mechanisms are now statically mapped, but the target values require runtime tracing.
|
||||
|
||||
## Recommended Next Step
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue