diff options
| -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++; } |
