]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix mode switch height change not updating row_map (for example PAL/NTSC)
authorToni Wilen <twilen@winuae.net>
Sun, 14 Sep 2025 09:31:53 +0000 (12:31 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 14 Sep 2025 09:31:53 +0000 (12:31 +0300)
drawing.cpp

index 4c89c51eed8c03fbbdbe6cab3edf2b9b9087484f..2fc9c46bc87400df3865f6b9bc2570b5c2629183 100644 (file)
@@ -1285,7 +1285,7 @@ void init_row_map(void)
        struct vidbuffer *vb = vidinfo->inbuffer;
        static uae_u8 *oldbufmem;
        static struct vidbuffer *oldvb;
-       static int oldheight, oldpitch;
+       static int oldheight_alloc, oldheight, oldpitch;
        static bool oldgenlock, oldburst;
        int i, j;
 
@@ -1300,7 +1300,8 @@ void init_row_map(void)
 
        if (oldbufmem && oldbufmem == vb->bufmem &&
                oldvb == vb &&
-               oldheight == vb->height_allocated &&
+               oldheight_alloc == vb->height_allocated &&
+               oldheight == vb->outheight &&
                oldpitch == vb->rowbytes &&
                oldgenlock == init_genlock_data &&
                oldburst == (row_map_color_burst_buffer ? 1 : 0)) {
@@ -1335,7 +1336,8 @@ void init_row_map(void)
        }
        oldvb = vb;
        oldbufmem = vb->bufmem;
-       oldheight = vb->height_allocated;
+       oldheight_alloc = vb->height_allocated;
+       oldheight = vb->outheight;
        oldpitch = vb->rowbytes;
        oldgenlock = init_genlock_data;
        oldburst = row_map_color_burst_buffer ? 1 : 0;
@@ -1513,6 +1515,12 @@ static void center_image (void)
        vidinfo->inbuffer->xoffset = visible_left_border << (RES_MAX - currprefs.gfx_resolution);
        vidinfo->inbuffer->yoffset = thisframe_y_adjust << VRES_MAX;
 
+       int linedbl = currprefs.gfx_vresolution;
+       if (doublescan > 0 && interlace_seen <= 0) {
+               linedbl = 0;
+       }
+       min_ypos_for_screen = minfirstline << linedbl;
+
        if (center_reset > 0) {
                center_reset--;
        }
@@ -1972,7 +1980,10 @@ static void vbcopy(struct vidbuffer *vbout, struct vidbuffer *vbin)
 {
        if (vbout->locked) {
                for (int h = 0; h < vbout->height_allocated && h < vbin->height_allocated; h++) {
-                       memcpy(vbout->bufmem + h * vbout->rowbytes, vbin->bufmem + h * vbin->rowbytes, (vbin->width_allocated > vbout->width_allocated ? vbout->width_allocated : vbin->width_allocated) * vbout->pixbytes);
+                       uae_u8 *dst = vbout->bufmem + h * vbout->rowbytes;
+                       uae_u8 *src = vbin->bufmem + h * vbin->rowbytes;
+                       int len = vbin->width_allocated > vbout->width_allocated ? vbout->width_allocated : vbin->width_allocated;
+                       memcpy(dst, src, len * vbout->pixbytes);
                }
        }
 }