Take a dropped payload, and stop drowning the console

Double-clicking the emulator printed a usage line to a console nobody sees
and exited. It now opens a window that accepts a dropped .bin, with O for the
system file dialog - GetOpenFileName on Windows, zenity or kdialog on Linux,
since there is no such thing there without dragging in a toolkit. The window
draws a dashed frame and an upload glyph from rectangles and one filled
triangle; no text, because a font would have to be vendored for a screen that
lives a few seconds and the instruction is on the title bar already. It is
created and destroyed before the emulator's own display comes up, so it
cannot interfere with the framebuffer window. A headless or toolkit-less
machine falls back to the old usage message, and dragging a payload onto the
executable still skips all of it - that arrives as argv[1].

Dropping a payload was then unusably slow, and the reason had nothing to do
with the picker. A full hwtest sweep printed 52,452 lines, of which about
51,900 were per-register-access traces: 29,673 [gpio], 16,707 [mmio], 5,430
[sdmmc]. Redirected to a file that is merely wasteful, which is why it went
unnoticed - every scripted run here redirects. On a Windows console it is
not: each line goes through conhost one write at a time. Those traces now
need --trace or RCM_EMU_TRACE=1, which drops default output to 578 lines -
the payload's own UART plus the handful of [emu], [display], [pcie] and
[audio] lines worth seeing. The flag brings all 48,354 back when a
register-level question needs answering.

Also adds RCM_EMU_PICK, which runs the picker's window lifecycle and returns
a path as if it had been dropped, so that path can be tested by a script
instead of only by a human dragging a file.
This commit is contained in:
Baptiste MOINE committed 2026-08-20 10:29:28 +02:00
1 parent 390d64abe6
commit a71ccdf682
9 files changed
+288 -37

No files matched your search

+7
View File
@@ -119,6 +119,13 @@ green:
![PIN recovery demo](img/pin_recovery_demo.png)
### Running without arguments
Starting the emulator with no payload opens a small window that takes a
dropped `.bin`, or press **O** for the system file dialog (zenity or kdialog
on Linux). Dragging a payload onto the executable itself still works and
skips the picker - it arrives as `argv[1]`.
### Build (Windows)
Cross-compiled from Linux in a container, because neither dependency has a