Skip to content

Commit 093cb8a

Browse files
committed
bflibrary: Make SDL1 mode checking accept SVGA/XGA res
The SDL1 video mode availability verification was given too much authority - it could reject a mode if entering it requires additional blitting. We cannot allow that when any remade Bullfrog games will use these resolutions by default. This change forces the library to try to cope with 640x400 and 640x480, even if it marks these modes as not available.
1 parent a5059c9 commit 093cb8a

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

bflibrary/src/x86-win-sdl/sscreen.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,13 +672,29 @@ TbBool LbHwCheckIsModeAvailable(TbScreenMode mode)
672672
SDL_FreeSurface(draw_surface);
673673
}
674674

675-
closestBPP = SDL_VideoModeOK(mdinfo->Width, mdinfo->Height,
676-
mdinfo->BitsPerPixel, sdlFlags);
675+
closestBPP = SDL_VideoModeOK(mdWidth, mdHeight, mdinfo->BitsPerPixel, sdlFlags);
676+
677+
if ((closestBPP == 0) && (mdWidth == 640) && ((mdHeight == 400) || (mdHeight == 480)) &&
678+
((mdinfo->BitsPerPixel == 8) || (mdinfo->BitsPerPixel == 24)))
679+
{
680+
// The 640x400 and 640x480 must always be available, even if SDL will need to cheat to achieve that
681+
closestBPP = 24;
682+
}
677683

678684
// Even if different colour depth is returned, as long as the value is
679685
// non-zero, SDL can simulate any bpp with additional internal surface
680686
firstSurfaceOk = (closestBPP != 0);
681687

688+
if (!firstSurfaceOk || !secondSurfaceOk)
689+
{
690+
const char *reason = NULL;
691+
if (!firstSurfaceOk)
692+
reason = "SDL says the mode is not OK";
693+
if (!secondSurfaceOk)
694+
reason = "cannot create second surface";
695+
LOGDBG("Mode %s unavailable - %s", mdinfo->Desc, reason);
696+
}
697+
682698
return firstSurfaceOk && secondSurfaceOk;
683699
}
684700

0 commit comments

Comments
 (0)