Merge pull request #1690 from 86Box/master

Bring the branch up to par with master.
This commit is contained in:
Miran Grča
2021-09-14 22:34:42 +02:00
committed by GitHub
15 changed files with 538 additions and 440 deletions

View File

@@ -144,7 +144,11 @@ static inline uint32_t f82c425_makecol(uint8_t rgbi, int gs4, int inv)
}
c = 0x10 * gs4 * ((rgbi >> gs4) + 2);
#ifdef NO_BLUE
return makecol(c, c + 0x08, c - 0x20);
#else
return makecol(c, c + 0x08, 0x70);
#endif
}
/* Saturating/non-saturating addition for SMARTMAP(see below). */

View File

@@ -1877,6 +1877,22 @@ s3_queue(s3_t *s3, uint32_t addr, uint32_t val, uint32_t type)
wake_fifo_thread(s3);
}
static uint32_t
s3_hwcursor_convert_addr(svga_t *svga)
{
if ((svga->bpp == 8) && ((svga->gdcreg[5] & 0x60) >= 0x20) && (svga->crtc[0x45] & 0x10)) {
if ((svga->gdcreg[5] & 0x60) >= 0x40)
return ((svga->hwcursor_latch.addr & 0xfffff1ff) | ((svga->hwcursor_latch.addr & 0x200) << 2)) | 0x600;
else if ((svga->gdcreg[5] & 0x60) == 0x20)
return ((svga->hwcursor_latch.addr & 0xfffff0ff) | ((svga->hwcursor_latch.addr & 0x300) << 2)) | 0x300;
else
return svga->hwcursor_latch.addr;
} else
return svga->hwcursor_latch.addr;
}
static void
s3_hwcursor_draw(svga_t *svga, int displine)
{
@@ -1887,6 +1903,7 @@ s3_hwcursor_draw(svga_t *svga, int displine)
int xx;
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
uint32_t fg, bg;
uint32_t real_addr;
switch (svga->bpp)
{
@@ -1939,10 +1956,12 @@ s3_hwcursor_draw(svga_t *svga, int displine)
if (svga->interlace && svga->hwcursor_oddeven)
svga->hwcursor_latch.addr += 16;
real_addr = s3_hwcursor_convert_addr(svga);
for (x = 0; x < 64; x += 16)
{
dat[0] = (svga->vram[svga->hwcursor_latch.addr & svga->vram_display_mask] << 8) | svga->vram[(svga->hwcursor_latch.addr + 1) & svga->vram_display_mask];
dat[1] = (svga->vram[(svga->hwcursor_latch.addr + 2) & svga->vram_display_mask] << 8) | svga->vram[(svga->hwcursor_latch.addr + 3) & svga->vram_display_mask];
dat[0] = (svga->vram[real_addr & svga->vram_display_mask] << 8) | svga->vram[(real_addr + 1) & svga->vram_display_mask];
dat[1] = (svga->vram[(real_addr + 2) & svga->vram_display_mask] << 8) | svga->vram[(real_addr + 3) & svga->vram_display_mask];
if (svga->crtc[0x55] & 0x10) {
/*X11*/
for (xx = 0; xx < 16; xx++) {
@@ -1971,6 +1990,7 @@ s3_hwcursor_draw(svga_t *svga, int displine)
}
}
svga->hwcursor_latch.addr += 4;
real_addr = s3_hwcursor_convert_addr(svga);
}
if (svga->interlace && !svga->hwcursor_oddeven)
svga->hwcursor_latch.addr += 16;

View File

@@ -367,7 +367,9 @@ video_take_screenshot(const char *fn)
memset(&(b_rgb[y][x * 3]), 0x00, 3);
else {
temp = buffer32->line[blit_data.y + y][blit_data.x + x];
memcpy(&(b_rgb[y][x * 3]), &temp, 3);
b_rgb[y][x * 3] = (temp >> 16) & 0xff;
b_rgb[y][(x * 3) + 1] = (temp >> 8) & 0xff;
b_rgb[y][(x * 3) + 2] = temp & 0xff;
}
}
}