Apple's OS X Lion (10.7) Breaks Fullscreen for SDL-based Games

Dominus let me know via the Aiera IRC channel that there have been reports that Apple’s latest version of OS X, code-named “Lion”, breaks fullscreen capability for SDL-based games. Utilities like DOSBox, and Ultima engine remakes like Exult, Pentagram, Nuvie, and xu4, are all affected, and will not work in fullscreen mode under the latest OS X (version 10.7).

The issue is rather technical, but here is what appears to be a basic summary:

CGDisplayBaseAddress() has been deprecated in 10.6 and while it still exists on 10.7, it now returns NULL instead of the display’s base address. SDL_SetVideoMode() ends up calling a number of deprecated CG functions via the Quartz implementation including CGDisplayBaseAddress(). It is SDL_SetVideoMode()’s call to SDL_ClearSurface() that actually causes the crash when it tries to clear the frame buffer memory at address zero. 

A new set of APIs has been added as of 10.6 and while they let you capture a display, they do not allow direct frame buffer access. Quartz or OpenGL are the only methods that can update a captured display. 

The work to switch to the new APIs in the context of SDL is not trivial.

Apple is rather notorious, in my experience, for being something of an ass when it comes to deprecating functions between OS revisions; I recall the days when Nuvie had different build versions published for OS X Leopard and Tiger; the build for one absolutely would not run on the other. To be fair, if memory serves, that had more to do with a change in the bit-length of a particular variable type…but even so, it’s still illustrative of Apple’s rather heavy-handed method of discontinuing programmatic support for deprecated items.

And now it appears that SDL has been affected by that same attitude.

I’m sure a workaround will appear shortly, one which will be incorporated into these various projects in due time. For the moment, though, be thou advised that running your favourite Ultima games in fullscreen under OS X will probably result in crashes.

15 Responses

  1. Dominus says:

    Not sure whether a workaround will be available soon… As for dosbox, set output to opengl in the preference file (~/library/preferences/dosbox 0.74 preferences) and you are set for fullscreen again.
    Unfortunately the Ultima engines do not have that. Exult can use OpenGl but that is experimental and fullscreen is totally borked with that 😉

  2. efry says:

    Also Compiling for older PPC Macs is a lot harder in Lion. I believe they have removed the old PPC toolchain from XCode.

  3. Dominus says:

    Yes, via xcode you cannot compile for ppc anymore.
    Via dev tools and unix style compiling/autotools/makefiles you can cross compile for PPC, but ONLY if you installed xcode 3.26 prior to switching to Lion.

  4. Dominus says:

    this is fixed in SDL mercurial http://forums.libsdl.org/viewtopic.php?t=7355
    I’m doing updated snapshots for Exult, Pentagram and xU4 now

  5. Dominus says:

    xu4 snapshot will take a bit longer. I need to build the SDK and I have no idea how to do that with the screwed xcode stuff 🙁

  6. Dominus says:

    xu4 snapshot works as well now. Built the SDL framework and all is dandy again 🙂

  7. Thommy says:

    For DOSBox, just download Boxer. The port of DOSBox in there uses the native windowing APIs and cuts out SDL entirely.

  8. Dominus says:

    tinkered some more with the snapshots, so the PPC built does correctly work in fullscreen (using old SDL for that – since new SDL code fixes Lion but breaks PPC :)).
    So, Exult, Pentagram and xU4 will be updated.

  9. Dominus says:

    Through insane trickery (at least with xu4 since that needs a special PPC framework for compiling and other framework for the intel branches and then an amalgam of those for packaging – exult and pentagram just get pointed at special prefixes and then compile statically), all are still universal 😉

  10. Dominus says:

    spammer!!!!

    • WtF Dragon says:

      There’s a particularly clever spambot that Akismet is having trouble dealing with.

      Fortunately, I can mostly stay on top of it from the WordPress iPhone app. Still…annoying!

  11. Jet says:

    Yeah, it’s really annoying – but it’s also the price of progress. If apple wasn’t a dick about this stuff, some clowns would still be using deprecated stuff 20 years from now; not an exaggeration, not hyperbole – this is exactly what has happened with some of the windows APIs. It’s really a shame, because pretty much everything that sucks about windows – the good old windows from the 90s we all love to hate, has been fixed. But the fixes don’t show up in the real-world because most programs out there still haven’t updated the APIs they’re using.

    Also, probably long since fixed, but here’s a commit related to this issue:
    http://lists.libsdl.org/pipermail/commits-libsdl.org/2011-August/004205.html