NX2 Debug Server and Frame Captures
The NX2 debug server exposes live emulator inspection and control through the stdio MCP adapter at tools/nx2/debug_mcp.py. The adapter reconnects between calls, so the game may be restarted while it remains running.
Start the debug server
Set the server environment variable before launching the emulator, then run the adapter as a stdio MCP server:
# Terminal 1: start the emulator with the debug endpoint enabled.
EDEN_NX2_DEBUG_SERVER=127.0.0.1:6545 ./bin/eglantine
# Terminal 2 (or your MCP host): run the stdio adapter.
python3 -I tools/nx2/debug_mcp.py
The Qt app binary is eglantine; the CLI build is eden-cli. The server accepts a port alone or a host and port, but only loopback addresses are permitted. The adapter defaults to 127.0.0.1:6545; override it with --server.
| Setting | Purpose |
|---|---|
EDEN_NX2_DEBUG_SERVER=<port> or <host>:<port> | Starts the in-process debug server. Only loopback hosts are accepted. |
EDEN_NX2_DEBUG_WRITE=1 | Enables the write_memory tool. Disabled by default. |
EDEN_NX2_FRAME_DUMP=<dir> | Arms a Vulkan frame dump at startup. |
EDEN_NX2_FRAME_DUMP_AT=<seconds>|<frame>f|file | Selects when the startup dump runs; defaults to 60 seconds. file waits for <dir>/capture.now, checked every 30 presented frames. |
EDEN_NX2_FRAME_DUMP_SAMPLED=1 | Includes sampled textures, bound uniform/storage buffers, and compute dispatch group counts in the startup dump. |
EDEN_NX2_REJECT_HASH=<key-or-hash>,... | Rejects native shader programs at startup by native program key or shader hash. |
The debug endpoint can inspect and control a running game. It accepts loopback hosts only; do not expose it through a network proxy or port forward.
Runtime tools
The adapter exposes tools including status, screenshot, log_tail, log_filter, capture_frame, capture_image, reject_shaders, read_memory, search_memory, read_gpu_memory, input, and input_sequence. VTX-HLE also provides nvn_draws, nvn_draw_skip, nvn_draw_dump, and nvn_stats. Tool names and argument schemas are published by the adapter's tools/list method.
capture_frame captures the next frame and returns its directory, summary, entry counts, and manifest entries. Its sampled and buffers options control sampled texture and buffer recording separately; sampled_max_mib and sampled_tics can limit sampled texture readbacks. Set index: true to build index.html with frame_dump_index.py. capture_image returns a PNG from a capture made during the current adapter session.
reject_shaders adds or restores native programs at runtime by key or shader hash; cached pipelines are dropped at the next frame end. On VTX-HLE it has no effect; use nvn_draw_skip instead.
| Runtime option | Limit or behavior |
|---|---|
read_memory, read_gpu_memory | Read-only; up to 64 KiB per request. GPU memory is read at the next frame end. |
search_memory | Up to 256 results per call and 10 seconds of search budget; defaults to the heap region. |
input, input_sequence | Up to 36,000 presented frames; sequences allow up to 1,000 steps. Inputs are released when the request finishes or times out. |
write_memory | Writes 1–4,096 guest-memory bytes; requires EDEN_NX2_DEBUG_WRITE=1. Record and restore the returned previous bytes. |
capture_frame | Waits up to 600 seconds. One frame capture can run at a time. |
screenshot | Height 144–2,160 pixels; waits up to 30 seconds for a presented frame. |
write_memory changes guest memory and is disabled unless explicitly enabled at startup. Use it only for controlled experiments, and restore the previous bytes when finished.
Frame dump contents
A frame dump records color targets from each pass, storage images written by compute dispatches, and the presented image as .raw.zst files with PNG previews. manifest.jsonl records draw/dispatch indices, shader hashes and native program keys, formats, dimensions, GPU addresses, and per-channel statistics. Float previews are sRGB-encoded; NaN and Inf pixels appear magenta. Readbacks are encoded on a worker thread; staging is drained every 256 MiB, and captures stop at 2 GiB with "truncated": true in the summary.
Sampled entries include sampler state. Buffer entries identify stage, binding, GPU address, and size; buffer bytes are deduplicated in buffer_<hash>.bin.zst. GPU-written ranges are copied from the GPU. Compute dispatch entries include launch group counts.
To make a contact sheet manually:
python3 -I tools/nx2/frame_dump_index.py <dump-directory>
Inspect the first pass whose output is wrong, then examine its shaders and related entries.
Frame dumps and read_gpu_memory require Vulkan. capture_frame, reject_shaders, and GPU-memory reads are handled at the Vulkan frame drain point. status FPS and injected input progress count Switch 2 presented frames, not elapsed wall-clock frames.