MGA: Fix most remaining display problems with Millennium II

This commit is contained in:
Cacodemon345
2023-12-29 15:45:26 +06:00
parent 592229af94
commit a037b7618e

View File

@@ -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;
}
}