Repository navigation
Genesis CPU setting (Normal / 125%), wait-loop skip, Maximum Carnage fix - #138
Conversation
- Settings v2 (migrated from v1) adds genesis_cpu_percent; the launcher's settings get a "Genesis CPU" row (Normal / 125%), applied when a Genesis game starts. At 125% the 68000 finishes its frame work in time: Sonic 3 no longer drops to half speed for ~3 s when Sonic loses his rings, at the cost of a few drawn frames (the 68000 takes ~1 ms more per frame). - gwenesis: built with M68K_OVERCLOCK_SHIFT (the clock setting) and M68K_IDLE_SKIP (the 68000's wait-for-frame loops are not emulated, recovering most of the overclock's 68000 time). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
… muted) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
…wenesis #2 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Adds a persisted “Genesis CPU” setting (Normal vs 125%) and applies it on Genesis launch, while also updating the bundled gwenesis submodule and enabling M68K idle-loop skipping / overclock support at build time.
Changes:
- Introduce
SettingsV2withgenesis_cpu_percentand migrate fromSettingsV1viaespp::PersistentData. - Add a new GUI settings-row to toggle Genesis CPU (Normal ↔ 125%) and apply it when initializing Genesis emulation.
- Update gwenesis submodule and enable
M68K_OVERCLOCK_SHIFT+M68K_IDLE_SKIPbuild definitions.
| File | Description |
|---|---|
| main/main.cpp | Extend settings logging to include Genesis CPU percent. |
| main/genesis_cart.hpp | Apply the configured Genesis CPU percent during Genesis cart init. |
| components/settings/src/settings.cpp | Include genesis_cpu_percent in settings equality comparison. |
| components/settings/include/settings.hpp | Add SettingsV2, migration, and update persistent store template parameters. |
| components/gui/src/gui.cpp | Add GUI controls + behavior for Genesis CPU toggle. |
| components/gui/include/gui.hpp | Declare Genesis CPU setter and store new LVGL object pointers. |
| components/genesis/gwenesis | Bump gwenesis submodule revision. |
| components/genesis/CMakeLists.txt | Enable overclock/idle-skip compile-time flags for the Genesis component. |
Review effort: Lite
| AppSettings::get().modify([percent](Settings &s) { s.genesis_cpu_percent = static_cast<uint8_t>(percent); }); | ||
| if (genesis_cpu_label_) { | ||
| lv_label_set_text(genesis_cpu_label_, percent > 100 ? "125%" : "Normal"); |
There was a problem hiding this comment.
Fixed in 32ee4e8: Settings::genesis_cpu_choice() maps any value to exactly 100 or 125; the setter stores that, and the label and toggle are based on it.
| case Emulator::SEGA_GENESIS: | ||
| case Emulator::SEGA_MEGA_DRIVE: | ||
| logger_.info("genesis::init()"); | ||
| genesis_set_cpu_percent(AppSettings::get().get_settings().genesis_cpu_percent); |
There was a problem hiding this comment.
Fixed in 32ee4e8: the cart applies Settings::genesis_cpu_choice(...), so a stored value outside the two choices runs as one of them. (genesis_set_cpu_percent() in the core also clamps to 100..200.)
| s.volume, s.muted ? " (muted)" : "", s.brightness, s.video_setting, s.resume_last_save, | ||
| s.haptic_waveform, s.genesis_cpu_percent, s.last_rom); |
There was a problem hiding this comment.
No change here: fmt formats unsigned char / signed char (so uint8_t) as integers; only plain char is formatted as a character. The values print as numbers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Settings::genesis_cpu_choice() maps any stored value to 100 or 125; the GUI stores, shows and toggles through it and the Genesis cart applies it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
|
✅Static analysis result - no issues found! ✅ |
ESP-IDF Size Report for 'Esp Box Emu'
FLASH uses app .bin size or json2 flash sum. RAM sums DRAM+IRAM via idf_size. Percentages shown when totals are available. |

Builds on #137 (based on its branch; retarget to
mainonce #137 is merged). Needs esp-cpp/gwenesis#2, which this pins.What
genesis_cpu_percentin a newSettingsV2, which migrates fromSettingsV1throughespp::PersistentData. It's applied when a Genesis game launches. 125% removes Sonic 3's native slowdown when Sonic loses his rings.M68K_IDLE_SKIP, next toM68K_OVERCLOCK_SHIFT=8.Testing (ESP32-S3-BOX-3)
Note: a slot-0 Maximum Carnage save written during the old hang still loads into the hang. Start fresh or use the menu Reset.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY