Skip to content

Genesis: rebuild YM2612 pointers after loading a save state - #21

Merged
finger563 merged 2 commits into
mainfrom
fix/genesis-savestate-sound
Nov 13, 2026
Merged

finger563 merged 2 commits into
mainfrom
fix/genesis-savestate-sound

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Bumps components/genesis/gwenesis to esp-cpp/gwenesis#1, the same fix as esp-cpp/esp-box-emu#137.

Problem

A save state written by another firmware build restored stale YM2612 pointers (operator routing, detune rows). On the box this left Sonic 2 silent after resuming, even after an emulator reset, and the stray writes corrupted the heap.

Fix

The load now rebuilds those pointers and keeps this build's YM2612 / SN76489 audio rates. New saves store the full 512-byte register file.

The submodule points at the gwenesis PR branch commit (d984bd5). If that PR is squash-merged, re-pin it to the merge commit on esp32 before merging this one.

Testing

  • Verified on the ESP32-S3-BOX-3: resuming an old Sonic 2 save, the sound is correct immediately.
  • On the Tab5 the firmware builds, and Sonic 2 (Genesis) runs stably. The card had no Sonic 2 save, so the save-state path itself was exercised on the box only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

Bumps components/genesis/gwenesis to esp-cpp/gwenesis#1. A save state
written by another firmware build restored stale YM2612 pointers (operator
routing, detune rows), so the FM output went silent and stray writes
corrupted memory; the load now rebuilds them and keeps this build's audio
rates.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Copilot AI balanced review requested due to automatic review settings November 13, 2026 18:10

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.

🔵 Needs a closer look

The missing submodule and lack of attachable changed files prevent a complete review, while Tab5 save/load compatibility still requires target-device validation.

No open issues 🎉

What changed in this PR

This PR updates the Genesis emulator’s gwenesis submodule to fix stale YM2612 pointers restored from save states created by another firmware build, addressing lost audio and heap corruption.

Changes:

  • Rebuilds YM2612 operator-routing and detune pointers after loading a save state.
  • Preserves the current build’s YM2612 and SN76489 audio rates.
  • Stores the full 512-byte register file in new saves.

The submodule may need re-pinning if the upstream PR is squash-merged. No changed-file paths were supplied for review; this overview reflects the PR description.

File Description

Review effort: Balanced

@github-actions

Copy link
Copy Markdown

ESP-IDF Size Report for 'Tab5 Emu'

Metric Base PR Delta
FLASH 0 bytes (0.00%) 0 bytes (0.00%) 0 bytes (0.00%)
DRAM 267,922 bytes (60.71%) 267,922 bytes (60.71%) 0 bytes (0.00%)
IRAM 0 bytes 0 bytes 0 bytes
RAM (DRAM+IRAM) 267,922 bytes 267,922 bytes 0 bytes (0.00%)

FLASH uses app .bin size or json2 flash sum. RAM sums DRAM+IRAM via idf_size. Percentages shown when totals are available.
DRAM/IRAM usage does not include memory used by the heap allocator at runtime.
This report was generated by esp-idf-size-delta.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
@finger563
finger563 merged commit 4e05432 into main Nov 13, 2026
1 check passed
@finger563
finger563 deleted the fix/genesis-savestate-sound branch November 13, 2026 22:59
finger563 added a commit that referenced this pull request Nov 13, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
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