Repository navigation
Web console: the WebUSB landing page (configure and inspect the emulator) - #136
Conversation
- Left / right on the game list jump to the previous / next console. - The console in the header opens a console picker (tap it, or X): all consoles, or only one console's games. The console is outlined while the list is filtered, and left / right then move the filter. Launching a game the filter hides lifts it. - USB link (protocol 3): CONSOLE_FILTER (emulink filter <console|all>), the filter in STATUS, and SCREENSHOT of the launcher's screen when no game runs (lv_snapshot, now enabled). - Graphics: a filtered roller does not wrap (a short list showed twice), and the Game Gear badge is lighter (it vanished on the dark header). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
- web/: the Emulator Console, plain HTML / CSS / ES modules (no build): dashboard (what runs, frame rate, memory, firmware, last crash, USB drive), the screen live with an on-screen / keyboard controller and save states, the library by console with boxart (play, filter the launcher, add / remove games), the SD card's files (download, upload, delete), the launcher's settings, the system (info, restart, firmware update through the updater and espp's OTA console, the other services in their espp apps) and the console log (Web Serial). link.js is the protocol, shared with tab5-emu like tools/emulink. - The WebUSB landing page is now this console on the project's GitHub Pages (the old espp device_hub.html URL does not exist). - Link protocol 4: SETTINGS (get / set the launcher's settings, as its controls do) and the console key and boxart path in LIST_ROMS; emulink settings [name=value]. - .github/workflows/pages.yml publishes web/ (Pages source: GitHub Actions). 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
esp_tinyusb 3.0.1 (TinyUSB 0.21.0~6, the DWC2 SETUP-DMA erratum workaround) corrupts the PSRAM heap on esp-box-emu while a Genesis game runs: the link task's next allocation hits a tlsf assert or an MMU entry fault. With 3.0.0 the same firmware is fine (checked on the box with the same commit built both ways). A fresh build resolves '>=3.0.0' to 3.0.1, so CI would have shipped it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
The heap corruption seen with Sonic 2 on the box turned out to be intermittent: the same builds that failed also pass repeated trials, so the runs that blamed esp_tinyusb 3.0.1 were not evidence of a cause. The corruption is tracked separately; no pin until it is understood. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
The heap corruption seen with Sonic 2 on the box turned out to be intermittent: the same builds that failed also pass repeated trials, so the runs that blamed esp_tinyusb 3.0.1 were not evidence of a cause. The corruption is tracked separately; no pin until it is understood. 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.
🟡 Changes recommended
Automatic reconnect still attempts to claim the updater’s interface after an intentional OTA hand-off, competing with the OTA console for exclusive device access.
5 open issues
What changed in this PR
Adds a browser-based Emulator Console as the firmware’s WebUSB landing page, using the existing USB link shared with emulink.
Changes:
- Adds device monitoring, screen capture and controls, game and file management, settings, system actions, and serial logs.
- Extends control protocol 4 with launcher settings and richer ROM metadata, plus CLI support.
- Updates the landing-page URL and adds GitHub Pages deployment.
| File | Description |
|---|---|
web/README.md |
Documents console features and local hosting. |
web/link.js |
Implements USB framing and device-control APIs. |
web/index.html |
Defines the console’s tabs and controls. |
web/app.js |
Implements connection handling and console interactions. |
web/app.css |
Styles the responsive interface and themes. |
tools/emulink/emulink/control.py |
Adds the settings protocol call. |
tools/emulink/emulink/cli.py |
Adds the emulink settings command. |
README.md |
Introduces the web console and its features. |
main/remote_control.hpp |
Adds protocol 4 settings and richer ROM listings. |
components/gui/src/gui.cpp |
Reads, validates, and applies launcher settings. |
components/gui/include/gui.hpp |
Declares the remote settings interface. |
components/box-emu/src/box-emu.cpp |
Points WebUSB to the emulator console. |
.github/workflows/pages.yml |
Checks scripts and publishes web/ to GitHub Pages. |
Review effort: Balanced
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
- Reconnect automatically only after an unexpected loss: not after Disconnect or a hand-off (the updater re-enumerates with the same serial and is the OTA console's to open); the delayed connect rechecks. - Disconnect releases buttons held from the page and drops the boxart cache (revoking its URLs) and the last screenshot; replies for an older connection are not cached. - The dashboard's core dump link hands the device off like Open app. - File writes, deletes and metadata.csv edits run one at a time. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
…picker - With a console filter on, Up from the first game lands on the header, which now moves on to that first game (the filtered roller stops at both ends, as Down does on the last game) instead of wrapping to the last. - Selecting a game or setting the filter from the link closes the console picker first: a game started from there left the picker over the list with the list's keypad group restored after the game. 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
… one pass
- CONSOLE_FILTER with an empty payload now returns {filter, consoles}
without touching the launcher ("all" clears the filter, as before), and
emulink filter with no console sends that query instead of re-setting
the current filter (which rebuilt the list and could undo a newer pick).
- The picker counts each console's games in one pass over the grouped list.
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
There was a problem hiding this comment.
🟡 Changes recommended
Multi-file uploads can be redirected to another folder during navigation, potentially truncating identically named files at the unintended destination.
10 open issues
Upload navigation can redirect remaining files to another folder · New Automatic reconnect races with OTA handoff Custom dialog does not trap focus or block background controls · New Disconnect during discovery can restore stale connected UI · New Pending settings callback can modify a newly connected board · New Timed-out request can leave reply rejection unhandled · New Concurrent metadata updates can overwrite each other Core-dump link skips vendor-interface handoff Disconnect leaves held controller buttons pressed Disconnect retains device-specific image cache and capture
Review effort: Balanced
- A multi-file upload writes to the folder it was dropped in, through the connection it started on, whatever the page shows meanwhile. - A settings change still debouncing when its connection ends is dropped. - connect() stops after discovery if the link was lost meanwhile. - The confirmation dialog makes the page behind it inert and gives focus back afterwards. - A request observes its send and its reply together: a timeout while the frame is queued rejects at once, with no unhandled rejection. 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.
🟡 Changes recommended
Add Game can send boxart and metadata to the wrong board after a connection change, overwriting that board’s boxart and creating an entry for a ROM it never received.
8 open issues
Keep game metadata updates bound to the original connection · New Automatic reconnect races with OTA handoff Fix keyboard handling for global shortcuts and pad buttons · New Serialize file reads with writes and deletes · New Concurrent metadata updates can overwrite each other Core-dump link skips vendor-interface handoff Disconnect leaves held controller buttons pressed Disconnect retains device-specific image cache and capture
5 resolved since last review
Upload navigation can redirect remaining files to another folder Timed-out request can leave reply rejection unhandled Pending settings callback can modify a newly connected board Disconnect during discovery can restore stale connected UI Custom dialog does not trap focus or block background controls
Review effort: Balanced
…he picker - CONSOLE_FILTER (set) runs on the main loop under the GUI lock, like LAUNCH, and is refused while a launch the loop has taken has not started its cart yet: the new filter could change the game it starts. - Re-reading metadata.csv closes an open console picker, whose consoles and counts are the old list's. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
… queued reads - Add Game writes the ROM, its boxart and the metadata.csv line through the connection it started on and stops if that changed. - On the Screen tab, Enter / Space on a focused control activate it instead of pressing Start; on a focused pad button they press that button (released on keyup or blur). - File reads go through the operation queue as well, so a download never sees a file half rewritten by an upload. 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
web/app.js and web/link.js match tab5-emu again (4663b35): launch, quit, save, load, the drive switch and the ROM reload wait for a capture in progress; no '..' in card paths; the confirmation answers Escape, keeps Tab on its buttons, and a second question answers the first with no; buttons are released on connect; the capture is cleared on disconnect; missing box art is retried after a reload or the card's return; game frames only in a game; a failed PNG is reported. Firmware: buffered data lost when a read or the card handover closed the file is reported by the next FILE_CLOSE (as tab5-emu b655ce1). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Moves the Web Console section up next to Quick Start, explains the WebUSB landing page and each tab, and adds dashboard / screen / library / settings / files / system screenshots from the box (images/web-console/). The MAC address is blanked in the system shot. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
…larifyCondition) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
main's tree is feat/console-filter's tip (8a0cd6c), already merged here, so this branch's tree is kept as is. 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. |


This PR adds the Emulator Console, a web page that configures and inspects the emulator over USB. The firmware now advertises it as its WebUSB landing page, so Chrome or Edge offers to open it when the board is plugged in. It is published at
https://esp-cpp.github.io/esp-box-emu/(see setup below), and the source is inweb/: plain HTML, CSS and ES modules with no build step.Tabs:
metadata.csvline) or remove one.registry.jsby protocol and hands the device over.Firmware changes:
SETTINGSrequest to read the launcher's settings or change one (name=value), with each setting's limits.LIST_ROMSnow includes each game's console key and boxart path. There's a matchingemulink settings [name=value].esp-cpp.github.io/esp-box-emu/instead ofesp-cpp.github.io/espp/apps/device_hub.html, which doesn't exist; the hub isdispatcher_hub.html, and this page links to it..github/workflows/pages.ymlpublishesweb/on a push to main. It needs Settings → Pages → Source: GitHub Actions enabled once.link.js(framing, emu.control and the system service) andapp.jsare the same files in esp-box-emu and tab5-emu, liketools/emulink. The page also accepts the Device Hub's hand-off query string (?autoconnect=1&transport=usb&vid=…&pid=…&serial=…).Tested on both boards in Chrome from
http://localhost:8737:The JS framing is also cross-checked against emulink's Python codec.
Not tested: the Console tab (Web Serial needs the port picked in the browser's chooser) and the OTA hand-off.
Known issue (not caused by this PR): during these tests the box crashed while Sonic 2 (Genesis) was running. The crash was in the link task's next allocation, with a corrupted heap: a TLSF assert or an MMU fault. It is intermittent, and I couldn't pin it to a change; details are in the conversation. The page itself only makes ordinary link requests.
Screenshots (on the ESP-Box-Emu)
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY