From 0a55e75b06fda425e493377d1487bd27905a770b Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 24 Dec 2023 02:16:51 +0600 Subject: [PATCH] MGA: Gamma-correct hardware cursor --- src/include/86box/vid_svga.h | 2 ++ src/video/vid_mga.c | 2 +- src/video/vid_svga_render.c | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/include/86box/vid_svga.h b/src/include/86box/vid_svga.h index 52a9c9b0a..709641457 100644 --- a/src/include/86box/vid_svga.h +++ b/src/include/86box/vid_svga.h @@ -337,6 +337,8 @@ enum { RAMDAC_8BIT }; +uint32_t svga_lookup_lut_ram(svga_t* svga, uint32_t val); + /* We need a way to add a device with a pointer to a parent device so it can attach itself to it, and possibly also a second ATi 68860 RAM DAC type that auto-sets SVGA render on RAM DAC render change. */ extern void ati68860_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga); diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index 1f93c339e..a04187fbe 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -5404,7 +5404,7 @@ mystique_hwcursor_draw(svga_t *svga, int displine) case XCURCTRL_CURMODE_XGA: for (uint8_t x = 0; x < 64; x++) { if (!(dat[1] & (1ULL << 63))) - svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ULL << 63)) ? mystique->cursor.col[1] : mystique->cursor.col[0]; + svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ULL << 63)) ? svga_lookup_lut_ram(svga, mystique->cursor.col[1]) : svga_lookup_lut_ram(svga, mystique->cursor.col[0]); else if (dat[0] & (1ULL << 63)) svga->monitor->target_buffer->line[displine][offset + svga->x_add] ^= 0xffffff; diff --git a/src/video/vid_svga_render.c b/src/video/vid_svga_render.c index e94916fd5..18e0438fd 100644 --- a/src/video/vid_svga_render.c +++ b/src/video/vid_svga_render.c @@ -30,8 +30,8 @@ #include <86box/vid_svga_render.h> #include <86box/vid_svga_render_remap.h> -static inline uint32_t -lookup_lut_ram(svga_t* svga, uint32_t val) +uint32_t +svga_lookup_lut_ram(svga_t* svga, uint32_t val) { if (!svga->lut_map) return val; @@ -42,7 +42,7 @@ lookup_lut_ram(svga_t* svga, uint32_t val) return makecol32(r, g, b) | (val & 0xFF000000); } -#define lookup_lut(val) lookup_lut_ram(svga, val) +#define lookup_lut(val) svga_lookup_lut_ram(svga, val) void svga_render_null(svga_t *svga)