Fullscreen bug in SDL 1.2.13 affecting Haiku games

This isn’t strictly Haiku-related but I wanted to let people know because SDL is a pretty common library and a lot of Haiku ports use it. The stable release 1.2.13 of the library (which is the one you get on BeBits etc) has two bugs in the function that sets the resolution of the fullscreen mode under BeOS. Depending on the available video modes in your system, this can cause a lot of games not to be able to go completely fullscreen; for example SDL may go into 800x600 when asked to set 640x480, even though native 640x480 is available. This can really kind of ruin the experience.

There are two fixes for this. The first is that I’ve attached a patch for the affected code, which is in /src/video/bwindow/SDL_sysvideo.cc at line 360. You can download SDL 1.2.13 source code, replace the broken code, and recompile (which goes perfectly smooth on a standard Haiku installation, except that you also have to hack “config.guess”-- search for where it tests for “BeOS”, and change that to “Haiku”, or it won’t be able to detect your platform).

You could also try downloading the latest developer SVN; SDL 1.3. There is a (different) patch for it in there. The patch in the SVN though, only works if SDL is able to provide exactly the video mode requested by the game, if not, it still may not work, but for most purposes, it should. I submitted the patch below on SDL bugtrac as well hoping to resolve this possibility.

If someone offers some webspace, I can send the compiled .so file which should be a drop-in replacement, so that non-technical users can get their games working correctly.

<–snip–>
modes = SDL_modelist[((bpp+7)/8)-1];

// find end of list (lowest-resolution mode; modes are ordered
// highest-to-lowest).
i = 0; while(modes[i]) i++;
if (!i) return false;		// what? no modes at all?

// find first mode with resolution >= requested in both dimensions
for (--i; i >= 0; --i)
{
	if (modes[i]->w >= width && modes[i]->h >= height)
		break;
}

// unable to find any mode with that high a resolution!
if (i < 0)
	return false;

width = modes[i]->w;
height = modes[i]->h;

<–snip–>

Did you have a look at HaikuPorts (http://ports.haiku-files.org/wiki)? Maybe you can submit your patch there. Also, have a look at the bugtracker. I seem to remember some tickets recently dealing with SDL and/or fullscreen.

Regards,
Humdinger