diff options
| author | gbc dev <gbc@localhost> | 2026-07-17 00:27:28 +0200 |
|---|---|---|
| committer | gbc dev <gbc@localhost> | 2026-07-17 00:27:28 +0200 |
| commit | 506a6611fae8b56c895fe17ed0b94e2f194407da (patch) | |
| tree | 65f17a9bd15d03ba93b87bf812a47a60f303439e /src/control.c | |
| parent | render: Game Boy chrome, LCD palette recolor, and frame capture (diff) | |
| download | sl0pboy-506a6611fae8b56c895fe17ed0b94e2f194407da.tar.gz sl0pboy-506a6611fae8b56c895fe17ed0b94e2f194407da.tar.xz sl0pboy-506a6611fae8b56c895fe17ed0b94e2f194407da.zip | |
record: capture the displayed frame (chrome + palette)
The video recorder now writes render_capture_frame() instead of the raw
LCD framebuffer, so captures match what's shown: chrome frames record at
their larger dimensions (written into the .gbv header) and the LCD palette
is baked in. Button presses also show up lit in recordings.
Diffstat (limited to 'src/control.c')
| -rw-r--r-- | src/control.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/control.c b/src/control.c index 0ace343..16e769a 100644 --- a/src/control.c +++ b/src/control.c @@ -510,7 +510,9 @@ static void dispatch(GB *gb, int fd, const char *orig, char *line) { if (ok && n > 0) every = (u32)n; } FILE *f = fopen(argv[2], "wb"); if (!f) { reply(fd, "err cannot open '%s'", argv[2]); return; } - u16 w = SCREEN_W, h = SCREEN_H; + // Capture what the user sees: chrome frame + LCD recolor if enabled. + int cw, ch; render_capture_size(&cw, &ch); + u16 w = (u16)cw, h = (u16)ch; // playback interval per captured frame (the GB runs ~59.73 fps) u16 ms = (u16)(1000.0 * every / 59.73 + 0.5); u8 hdr[10] = { 'G','B','C','V', @@ -670,7 +672,9 @@ void control_record_frame(GB *gb) { if (!rec_fp || !gb->ppu.frame_ready) return; gb->ppu.frame_ready = false; // consume: don't re-capture while paused if ((rec_phase++ % rec_every) != 0) return; - fwrite(gb->ppu.fb, 1, sizeof(gb->ppu.fb), rec_fp); + int w, h; + const u8 *frame = render_capture_frame(gb, &w, &h); // matches the display + fwrite(frame, 1, (size_t)w * h * 3, rec_fp); rec_written++; } |
