Skip to content

Commit af51f4f

Browse files
committed
MEGA65: screenshot-on-exit uses full frame
1 parent 9fbcf95 commit af51f4f

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

targets/mega65/vic4.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,23 +248,35 @@ void vic4_close_frame_access ( void )
248248
#ifdef XEMU_FILES_SCREENSHOT_SUPPORT
249249
// Screenshot
250250
if (XEMU_UNLIKELY(vic4_registered_screenshot_request)) {
251-
unsigned int x1, y1, x2, y2;
252-
xemu_get_viewport(&x1, &y1, &x2, &y2);
251+
unsigned int x1, y1, w, h;
252+
if (configdb.screenshot_and_exit) {
253+
// if it's "screenshot on exit" then we want the full NTSC/PAL frame (not the cropped viewport only)
254+
x1 = 0;
255+
y1 = 0;
256+
w = TEXTURE_WIDTH; // 720;
257+
h = max_rasters;
258+
} else {
259+
// This function returns the viewport as "bounding box" ...
260+
xemu_get_viewport(&x1, &y1, &w, &h);
261+
// ... let's calculate the width/height instead
262+
w = w - x1 + 1;
263+
h = h - y1 + 1;
264+
}
253265
vic4_registered_screenshot_request = 0;
254266
if (!xemu_screenshot_png(
255267
NULL, configdb.screenshot_and_exit,
256268
1, 1, // no ratio/zoom correction is applied
257269
pixel_start + y1 * TEXTURE_WIDTH + x1, // pixel pointer corresponding to the top left corner of the viewport
258-
x2 - x1 + 1, // width
259-
y2 - y1 + 1, // height
270+
w, // width
271+
h, // height
260272
TEXTURE_WIDTH // full width (ie, width of the texture)
261273
)) {
262274
const char *p = strrchr(xemu_screenshot_full_path, DIRSEP_CHR);
263275
if (p)
264276
OSD(-1, -1, "%s", p + 1);
265277
}
266278
if (configdb.screenshot_and_exit) {
267-
DEBUGPRINT("VIC4: exiting on 'exit-on-screenshot' feature." NL);
279+
DEBUGPRINT("VIC4: exiting on 'exit-on-screenshot' feature (%ux%u)." NL, w, h);
268280
XEMUEXIT(0);
269281
}
270282
}

0 commit comments

Comments
 (0)