Skip to content

feat(frontend): debugger overlay live state viewers (T-81-001, PR A) - #49

Merged
doublegate merged 3 commits into
mainfrom
feat/v0.8.0-debugger-state-viewers
Jul 9, 2026
Merged

doublegate merged 3 commits into
mainfrom
feat/v0.8.0-debugger-state-viewers

Conversation

@doublegate

Copy link
Copy Markdown
Owner

Summary

  • Fills in the debugger window's 4 panels (65C816 / PPU / APU / Cart) with real read-only state, gated behind the existing debug-hooks feature flag.
  • A new DebugSnapshot (crates/rustysnes-frontend/src/debug_snapshot.rs) is copied out under the same brief emu lock ShellInfo already uses — the shell's non-negotiable rule (ui_shell.rs's module doc) is that egui never touches the emu lock directly.
  • Includes SA-1 second-CPU register state (System::sa1_regs) and Super FX/GSU register-file state (Board::debug_gsu_state) in the Cart panel from day one, resolving docs/frontend.md's previously-open question in the breadth-inclusive direction this ladder takes.
  • With debug-hooks off, the Debug menu entry itself is feature-gated, so debugger_open can never become true and the app never builds a snapshot — build stays byte-identical.

Scope note

T-81-001's original acceptance criteria bundled breakpoints/stepping into the same ticket as the state viewers. Splitting that out during implementation:

  • This PR (PR A): live state viewers only, no core-crate changes beyond small read-only accessors.
  • PR B (follow-up): minimal 65C816 disassembler + PC breakpoints + step/step-over/step-into, using the existing System::step_instruction().
  • T-81-001b (follow-up ticket): read/write watchpoints — needs a new debug-hooks feature on rustysnes-core itself plus a Bus-level hook, deserving its own focused review since it touches the hottest path in the engine.

to-dos/phase-8-reach/sprint-1-instrumentation.md and docs/frontend.md are updated to reflect this split and current status.

Test plan

  • cargo test --workspace — 332 passed, 0 failed
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo clippy -p rustysnes-frontend --all-targets --features debug-hooks -- -D warnings — clean
  • cargo fmt --check — clean
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps — clean
  • With debug-hooks off, the debug menu/snapshot code path is unreachable (verified via feature gating, not just review)

🤖 Generated with Claude Code

Fill in the debugger window's 4 panels (65C816/PPU/APU/Cart) with real
read-only state, gated behind the debug-hooks flag. A new DebugSnapshot
is copied out under the same brief emu lock ShellInfo already uses,
mirroring the shell's non-negotiable never-hold-the-lock-in-egui rule.

Includes SA-1 second-CPU and Super FX/GSU register-file state in the
Cart panel from day one, resolving docs/frontend.md's open question.

Disassembly + PC breakpoints/step controls (PR B) and read/write
watchpoints (T-81-001b, needs a core-crate debug-hooks feature +
Bus-level hook) are tracked as explicit follow-ups, not bundled here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 9, 2026 12:50
@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a read-only, per-frame “live state” debugger overlay to the RustySNES frontend, using a DebugSnapshot copied under the same brief emu lock as ShellInfo, so egui never touches the lock directly. This expands the existing debugger window scaffold into real CPU/PPU/APU/Cart viewers (including SA-1 and Super FX state) and updates project docs/changelog to reflect the new instrumentation scope split.

Changes:

  • Implemented DebugSnapshot + plumbing (EmuCore::debug_snapshot) and passed it into the egui shell for rendering.
  • Replaced debugger panel stubs with live state viewers (CPU regs/flags, key PPU regs + CGRAM + VRAM window, APU SMP/DSP voice regs, Cart board + SA-1/GSU state).
  • Added small read-only accessors in core/PPU/cart needed to surface this state, and updated docs/to-dos/changelog accordingly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
to-dos/phase-8-reach/sprint-1-instrumentation.md Updates the Phase 8 instrumentation plan to reflect PR A/PR B split and current status.
docs/frontend.md Documents the debugger overlay design/feature gating and resolves the coprocessor panel question.
crates/rustysnes-ppu/src/lib.rs Adds small read-only PPU accessors for overlay display (bg_mode, display_brightness).
crates/rustysnes-frontend/src/ui_shell.rs Renders real debugger panels from a provided DebugSnapshot; feature-gates the Debug menu entry UI.
crates/rustysnes-frontend/src/lib.rs Exposes the new debug_snapshot module.
crates/rustysnes-frontend/src/emu.rs Implements EmuCore::debug_snapshot and VRAM-window snapshotting for the overlay.
crates/rustysnes-frontend/src/debug_snapshot.rs Defines snapshot structs used by the debugger overlay panels.
crates/rustysnes-frontend/src/app.rs Builds the snapshot under lock only when the debugger window is open; passes snapshot into shell render.
crates/rustysnes-core/src/scheduler.rs Exposes SA-1 regs via System::sa1_regs for the Cart panel.
crates/rustysnes-cart/src/coproc/superfx.rs Implements Board::debug_gsu_state for Super FX boards.
crates/rustysnes-cart/src/coproc/gsu.rs Adds read-only GSU register accessors for debug viewing.
crates/rustysnes-cart/src/board.rs Adds default-no-op debug_gsu_state trait hook.
CHANGELOG.md Records the new debugger overlay live state viewers and scope split.

Comment thread crates/rustysnes-frontend/src/ui_shell.rs Outdated
Comment thread crates/rustysnes-frontend/src/debug_snapshot.rs Outdated
Comment thread crates/rustysnes-frontend/src/app.rs Outdated
Comment thread crates/rustysnes-ppu/src/lib.rs Outdated
Comment thread crates/rustysnes-core/src/scheduler.rs Outdated
Comment thread crates/rustysnes-cart/src/coproc/gsu.rs Outdated
Comment thread crates/rustysnes-cart/src/board.rs Outdated
doublegate added a commit that referenced this pull request Jul 9, 2026
This entry belongs to PR #49 (a separate, still-unmerged branch) and
was mistakenly duplicated into this branch's CHANGELOG while resolving
a merge conflict against main -- this PR has nothing to do with the
debugger overlay.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- ui_shell.rs: the "no debugger snapshot yet" message no longer
  claims a ROM-load reason it doesn't actually check -- debug tracks
  debugger_open, not ROM state (a snapshot builds fine for a blank
  core).
- debug_snapshot.rs: stop claiming vram_window_start is "controlled
  by the debugger UI's scroll position" -- no UI calls
  set_debug_vram_scroll yet, so the window is fixed today.
- Five stale `docs/frontend.md §open questions` references updated to
  `§Debugger overlay`, the section that actually documents this now.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
doublegate added a commit that referenced this pull request Jul 9, 2026
…ation" (#48)

* docs(plan): fold the real wasm frontend build into v0.8.0 "Instrumentation"

The user found RustySNES's live wasm demo renders blank by comparing
against RustyNES's own working deployment. Root cause: wasm.rs has
been an explicitly-labeled scaffold stub since v0.1.0 -- it installs a
panic hook, logs one message, and returns, never building the actual
app. Every prior "wasm demo is live" CHANGELOG claim checked only
HTTP-level liveness (200 status, correct content-types), never that
the app actually renders.

A research pass into RustyNES's own wasm.rs/wasm_winit.rs confirmed a
concrete two-stage port path RustySNES's own Cargo.toml feature split
(wasm-winit default / wasm-canvas) already anticipated: a canvas-2D
MVP first (fast, no wgpu/egui dependency), then winit/wgpu unification
through the same App native already uses. Also confirmed a real gap,
not just plumbing: app.rs/audio.rs are currently excluded from the
wasm32 build entirely.

Updates to-dos/VERSION-PLAN.md's v0.8.0 section, to-dos/phase-8-reach/
overview.md (goal, exit criteria, scope, risks), and
sprint-1-instrumentation.md (two new tickets, T-81-005/T-81-006) with
the concrete port plan, sourced from RustyNES's actual code, not
invented from scratch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(changelog): remove debugger-overlay entry accidentally added here

This entry belongs to PR #49 (a separate, still-unmerged branch) and
was mistakenly duplicated into this branch's CHANGELOG while resolving
a merge conflict against main -- this PR has nothing to do with the
debugger overlay.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs: fix bot-flagged issues on PR #48 (split code spans, T-81-005 audio gap)

- Rejoin three inline code spans that were split across a line wrap
  (CommonMark renders the newline as a literal space, corrupting the
  path/identifier), in CHANGELOG.md, VERSION-PLAN.md, and
  sprint-1-instrumentation.md.
- T-81-005's description text never mentioned audio even though its
  acceptance criteria required it; added it to the description so the
  two agree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@doublegate
doublegate merged commit 3e36036 into main Jul 9, 2026
5 checks passed
@doublegate
doublegate deleted the feat/v0.8.0-debugger-state-viewers branch July 9, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants