unittester: Finish implementing 0x01 "Capture Screen Snapshot"

And it's looking like the overscan bounds and offset calculation will need to be correct.
Otherwise, things will break.
Let's see what happens when I get command 0x02 working...
This commit is contained in:
GreaseMonkey
2024-01-07 21:32:59 +13:00
parent d44c439bd8
commit 2e020584cf
2 changed files with 7 additions and 4 deletions

View File

@@ -248,7 +248,7 @@ unittester_write(uint16_t port, uint8_t val, UNUSED(void *priv))
/* Monitor disabled - clear snapshot */
unittester.snap_monitor = 0x00;
} else {
/* Capture snapshot from monitor */
/* Compute bounds for snapshot */
const monitor_t *m = &monitors[unittester.snap_monitor - 1];
unittester.snap_img_width = m->mon_xsize;
unittester.snap_img_height = m->mon_ysize;
@@ -256,7 +256,12 @@ unittester_write(uint16_t port, uint8_t val, UNUSED(void *priv))
unittester.snap_overscan_height = m->mon_ysize + m->mon_overscan_y;
unittester.snap_img_xoffs = (m->mon_overscan_x >> 1);
unittester.snap_img_yoffs = (m->mon_overscan_y >> 1);
/* TODO: Actually take snapshot! --GM */
/* Take snapshot */
for (size_t y = 0; y < unittester.snap_img_height; y++) {
for (size_t x = 0; x < unittester.snap_img_width; x++) {
unittester_screen_buffer->line[y][x] = m->target_buffer->line[y][x];
}
}
}
/* We have 12 bytes to read. */