MGA: Fixes hard freezes when using DynaView 3D on non-16-bpp modes on Windows 3.x.

This commit is contained in:
OBattler
2024-04-03 14:08:05 +02:00
parent c8a1843cdf
commit 48718eb169

View File

@@ -4505,6 +4505,19 @@ blit_line(mystique_t *mystique, int closed, int autoline)
int b = 0;
switch (mystique->maccess_running & MACCESS_PWIDTH_MASK) {
case MACCESS_PWIDTH_8:
if (!(mystique->dwgreg.dr[4] & (1 << 23)))
r = (mystique->dwgreg.dr[4] >> 20) & 0x7;
if (!(mystique->dwgreg.dr[8] & (1 << 23)))
g = (mystique->dwgreg.dr[8] >> 20) & 0x7;
if (!(mystique->dwgreg.dr[12] & (1 << 23)))
b = (mystique->dwgreg.dr[12] >> 21) & 0x3;
dst = (r << 5) | (g << 2) | b;
((uint8_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask) >> 12] = changeframecount;
break;
case MACCESS_PWIDTH_16:
if (!(mystique->dwgreg.dr[4] & (1 << 23)))
r = (mystique->dwgreg.dr[4] >> 18) & 0x1f;
@@ -4518,6 +4531,33 @@ blit_line(mystique_t *mystique, int closed, int autoline)
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_w) >> 11] = changeframecount;
break;
case MACCESS_PWIDTH_24:
old_dst = *(uint32_t *) &svga->vram[((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask];
if (!(mystique->dwgreg.dr[4] & (1 << 23)))
r = (mystique->dwgreg.dr[4] >> 15) & 0xff;
if (!(mystique->dwgreg.dr[8] & (1 << 23)))
g = (mystique->dwgreg.dr[8] >> 15) & 0xff;
if (!(mystique->dwgreg.dr[12] & (1 << 23)))
b = (mystique->dwgreg.dr[12] >> 15) & 0xff;
dst = (r << 16) | (g << 8) | b;
((uint32_t *) svga->vram)[((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask] = dst | (old_dst & 0xFF000000);
svga->changedvram[(((mystique->dwgreg.ydst_lin + x) * 3) & mystique->vram_mask) >> 12] = changeframecount;
break;
case MACCESS_PWIDTH_32:
if (!(mystique->dwgreg.dr[4] & (1 << 23)))
r = (mystique->dwgreg.dr[4] >> 15) & 0xff;
if (!(mystique->dwgreg.dr[8] & (1 << 23)))
g = (mystique->dwgreg.dr[8] >> 15) & 0xff;
if (!(mystique->dwgreg.dr[12] & (1 << 23)))
b = (mystique->dwgreg.dr[12] >> 15) & 0xff;
dst = (r << 16) | (g << 8) | b;
((uint32_t *) svga->vram)[(mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l] = dst;
svga->changedvram[((mystique->dwgreg.ydst_lin + x) & mystique->vram_mask_l) >> 10] = changeframecount;
break;
default:
fatal("LINE I/ZI PWIDTH %x %08x\n", mystique->maccess_running & MACCESS_PWIDTH_MASK, mystique->dwgreg.dwgctrl_running);
}