From 0c2efae9c393e8df3ab4669d78b96cd9e4b49f5a Mon Sep 17 00:00:00 2001 From: TomW Date: Wed, 9 Jul 2014 22:12:59 +0100 Subject: [PATCH] Fixed cursor in interlaced modes on S3 Vision864/Trio32/Trio64. --- src/vid_s3.c | 5 +++++ src/vid_svga.c | 21 +++++++++++++++++++++ src/vid_svga.h | 3 +++ 3 files changed, 29 insertions(+) diff --git a/src/vid_s3.c b/src/vid_s3.c index 089851a..5c77165 100644 --- a/src/vid_s3.c +++ b/src/vid_s3.c @@ -1725,6 +1725,9 @@ void s3_hwcursor_draw(svga_t *svga, int displine) int xx; int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff; + if (svga->interlace && svga->hwcursor_oddeven) + svga->hwcursor_latch.addr += 16; + // pclog("HWcursor %i %i\n", svga->hwcursor_latch.x, svga->hwcursor_latch.y); for (x = 0; x < 64; x += 16) { @@ -1747,6 +1750,8 @@ void s3_hwcursor_draw(svga_t *svga, int displine) } svga->hwcursor_latch.addr += 4; } + if (svga->interlace && !svga->hwcursor_oddeven) + svga->hwcursor_latch.addr += 16; } diff --git a/src/vid_svga.c b/src/vid_svga.c index 4e1f676..bf8067f 100644 --- a/src/vid_svga.c +++ b/src/vid_svga.c @@ -403,10 +403,27 @@ void svga_poll(void *p) { // if (!(vc & 15)) pclog("VC %i %i\n", vc, GetTickCount()); if (svga->displine == svga->hwcursor_latch.y && svga->hwcursor_latch.ena) + { svga->hwcursor_on = 64 - svga->hwcursor_latch.yoff; + svga->hwcursor_oddeven = 0; + } + + if (svga->displine == svga->hwcursor_latch.y+1 && svga->hwcursor_latch.ena && svga->interlace) + { + svga->hwcursor_on = 64 - svga->hwcursor_latch.yoff; + svga->hwcursor_oddeven = 1; + } if (svga->displine == svga->overlay_latch.y && svga->overlay_latch.ena) + { svga->overlay_on = svga->overlay_latch.ysize - svga->overlay_latch.yoff; + svga->overlay_oddeven = 0; + } + if (svga->displine == svga->overlay_latch.y+1 && svga->overlay_latch.ena && svga->interlace) + { + svga->overlay_on = svga->overlay_latch.ysize - svga->overlay_latch.yoff; + svga->overlay_oddeven = 1; + } svga->vidtime += svga->dispofftime; // if (output) printf("Display off %f\n",vidtime); @@ -430,12 +447,16 @@ void svga_poll(void *p) { svga->overlay_draw(svga, svga->displine); svga->overlay_on--; + if (svga->overlay_on && svga->interlace) + svga->overlay_on--; } if (svga->hwcursor_on) { svga->hwcursor_draw(svga, svga->displine); svga->hwcursor_on--; + if (svga->hwcursor_on && svga->interlace) + svga->hwcursor_on--; } if (svga->lastline < svga->displine) diff --git a/src/vid_svga.h b/src/vid_svga.h index a13ab20..ce570de 100644 --- a/src/vid_svga.h +++ b/src/vid_svga.h @@ -90,6 +90,9 @@ typedef struct svga_t int hwcursor_on; int overlay_on; + int hwcursor_oddeven; + int overlay_oddeven; + void (*render)(struct svga_t *svga); void (*recalctimings_ex)(struct svga_t *svga);