joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.81k stars 383 forks source link

Yellow screen in highcolor and truecolor modes on macOS #1431

Open degaart opened 4 years ago

degaart commented 4 years ago

Describe the bug 15-bit, 16-bit, 24-bit and 32-bit color VBE applications give corrupted yellowish output on macOS.

To Reproduce Steps to reproduce the behavior:

  1. Download univbe
  2. Run vbetest.exe
  3. Choose interactive visual compliance tests
  4. Choose a high-color or true-color mode
  5. Output lacks blue component and is tinted yellow

Expected behavior Correct output

Screenshots

Environment (please complete the following information):

Additional context Looks like issue #614

Attached screenshot and debug log

Screen Shot 2020-03-04 at 11 22 53

dosbox-x-0.83-sdl2.log

msikma commented 4 years ago

Just wanted to note that this goes for every VGA/SVGA machine. CGA, EGA and many others work just fine and show a normal screenshot with blue channel in it. So there's something specific to the VGA code that's causing this.

I recall vanilla DOSBox having a similar bug that only occurred on high color depth, like for example when playing Archimedean Dynasty.

msikma commented 4 years ago

Maybe the same bug as #727 even though that one's specifically about SDL1 and this is about SDL2.

brunocastello commented 3 years ago

This issue is still present with the SDL2 build as of 0.83.10

brunocastello commented 2 years ago

This issue is still persistent with the SDL2 build 0.83.24.

Anyone know how can we fix it? It'd be quite important because apparently the SDL2 build is more stable than SDL1, which I had been using for years because of this bug in particular...

myon98 commented 2 years ago

I've experienced this too, and from a quick glance through the codebase I think it just assumes the pixel format of the SDL_Surface returned from SDL_GetWindowSurface without checking. And on MacOS it seems like it is BGRA on SDL1 while ARGB on SDL2.

It seems that some places check if defined(MACOSX) && !defined(C_SDL2) but others only check if defined(MACOSX), causing it to incorrectly apply the correction to SDL2 as well.

I've tried to search for such places and added SDL2 checks to them, and the problem seems to be fixed. I'll make a pull request later, although I can't test them very thoroughly except for making sure that the Windows 3.1 doesn't look yellow in the particular video mode I'm using.