Add -headless-render flag and savescreen debug command#61
Open
acscpt wants to merge 3 commits intoscarybeasts:masterfrom
Open
Add -headless-render flag and savescreen debug command#61acscpt wants to merge 3 commits intoscarybeasts:masterfrom
acscpt wants to merge 3 commits intoscarybeasts:masterfrom
Conversation
Without it the render buffer is only allocated when -frame-cycles is set. The new flag enables render-derived state (e.g. frame_buffer_crc32) in headless mode without requiring frame dumps to disk, useful for debugger and automation harness use.
Writes the raw BGRA render buffer to a file. Convert to PNG with e.g. ImageMagick: convert -size WxH -depth 8 bgra:screen.bgra out.png. The command prints the buffer dimensions on success so the converter arguments are easy to derive. Requires the render buffer to be allocated (i.e. GUI mode, or headless with -headless-render or -frame-cycles).
Re-runs the RVI rendering scenario in headless mode with -headless-render and -opt video:always-render and asserts the framebuffer CRC matches the existing GUI-mode value, proving headless rendering is pixel-identical and the buffer allocation path works. A second test exercises savescreen and asserts the dumped BGRA file size matches the expected render dimensions.
acscpt
added a commit
to acscpt/beebjit
that referenced
this pull request
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Chris,
This adds the ability to capture rendered screen output from a headless beebjit session via the existing debugger, useful for automation harnesses. Three commits, with functional test coverage included:
-headless-renderflag: allocates the render buffer in headless mode. Without it the buffer isNULL(only allocated when-frame-cycles > 0), which short-circuits the video pipeline. The new flag opens a parallel allocation path so render-derived state likeframe_buffer_crc32is available without forcing a-frame-cyclesworkaround.savescreen <file>debug command: writes the BGRA framebuffer to a file. Mirrors the existingsavemempattern (util_file_try_open/util_file_write/util_file_close) and usesrender_has_bufferfor the null check. Prints dimensions on success so converters likeconvert -size WxH -depth 8 bgra:screen.bgra out.pngare easy to invoke.Functional tests in
run_functional_tests.sh: one re-runs the existing RVI rendering scenario in headless mode with-headless-render -opt video:always-renderand asserts the same0x2c23c1b6CRC, proving headless rendering is pixel-identical to GUI rendering and exercising the new buffer-allocation path. Another assertssavescreenwrites a file of the expected size (768×640×4 = 1,966,080 bytes).The two flags compose:
-headless-renderallocates the buffer,savescreenreads it. Each works on its own (savescreenworks in GUI mode where the buffer is always allocated;-headless-renderis useful for any scenario wantingframe_buffer_crc32without disk dumps).Testing
build.shtest suite green including the two new functional tests.