diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index f0cbad9eb..19720f674 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -5732,25 +5732,26 @@ static uint32_t mystique_conv_16to32(svga_t* svga, uint16_t color, uint8_t bpp) { mystique_t *mystique = (mystique_t*)svga->priv; + uint32_t ret = 0x00000000; if (svga->lut_map) { if (bpp == 15) { - if (mystique->xgenctrl & (1 << 2)) { + if (mystique->xgenctrl & (1 << 2)) color &= 0x7FFF; - } uint8_t b = getcolr(svga->pallook[(color & 0x1F) | (!!(color & 0x8000) >> 8)]); uint8_t g = getcolg(svga->pallook[((color & 0x3E0) >> 5) | (!!(color & 0x8000) >> 8)]); uint8_t r = getcolb(svga->pallook[((color & 0x7C00) >> 10) | (!!(color & 0x8000) >> 8)]); - return video_15to32[color] & 0xFF000000 | makecol(r, g, b); + ret = (video_15to32[color] & 0xFF000000) | makecol(r, g, b); } else { uint8_t b = getcolr(svga->pallook[color & 0x1f]); uint8_t g = getcolg(svga->pallook[(color & 0x7e0) >> 5]); uint8_t r = getcolb(svga->pallook[(color & 0xf800) >> 11]); - return video_16to32[color] & 0xFF000000 | makecol(r, g, b); + ret = (video_16to32[color] & 0xFF000000) | makecol(r, g, b); } - } - - return (bpp == 15) ? video_15to32[color] : video_16to32[color]; + } else + ret = (bpp == 15) ? video_15to32[color] : video_16to32[color]; + + return ret; } static void *