From a037b7618e8a52cba45c4e5bae00f1931ed59ad1 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 29 Dec 2023 15:45:26 +0600 Subject: [PATCH] MGA: Fix most remaining display problems with Millennium II --- src/video/vid_mga.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index d5ee42b30..2f524db5d 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -740,15 +740,14 @@ mystique_out(uint16_t addr, uint8_t val, void *priv) if (mystique->crtcext_idx < 6) mystique->crtcext_regs[mystique->crtcext_idx] = val; - if (mystique->crtcext_idx == 6 && (old ^ val) == CRTCX_R3_MGAMODE && mystique->type >= MGA_2164W) - svga_recalctimings(svga); - if ((mystique->type >= MGA_1064SG) && (mystique->crtcext_idx == 0) && (mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE)) { svga->rowoffset = svga->crtc[0x13] | ((mystique->crtcext_regs[0] & CRTCX_R0_OFFSET_MASK) << 4); + if (!(mystique->type >= MGA_2164W)) svga->rowoffset <<= 1; + svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd]; if ((mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8)) && !(mystique->type >= MGA_2164W)) { @@ -758,6 +757,36 @@ mystique_out(uint16_t addr, uint8_t val, void *priv) if (!(mystique->type >= MGA_2164W)) svga->ma_latch <<= 1; + + if (mystique->type == MGA_2164W) + { + switch (svga->bpp) { + case 8: + svga->render = svga_render_8bpp_highres; + break; + case 15: + svga->render = svga_render_15bpp_highres; + break; + case 16: + svga->render = svga_render_16bpp_highres; + if (svga->dispend >= 1024) + svga->rowoffset <<= 1; + break; + case 24: + svga->render = svga_render_24bpp_highres; + if (svga->hdisp >= 1024) + svga->rowoffset <<= 1; + break; + case 32: + svga->render = svga_render_32bpp_highres; + svga->rowoffset <<= 1; + if (svga->hdisp >= 1024) { + svga->ma_latch <<= 1; + } + break; + } + } + if (svga->ma_latch != mystique->ma_latch_old) { if (svga->interlace && svga->oddeven) svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) + @@ -1015,7 +1044,7 @@ mystique_recalctimings(svga_t *svga) break; case 16: svga->render = svga_render_16bpp_highres; - if (svga->hdisp >= 1024) + if (svga->dispend >= 1024) svga->rowoffset <<= 1; break; case 24: @@ -1026,6 +1055,9 @@ mystique_recalctimings(svga_t *svga) case 32: svga->render = svga_render_32bpp_highres; svga->rowoffset <<= 1; + if (svga->hdisp >= 1024) { + svga->ma_latch <<= 1; + } break; } }