Page MenuHome

Fixes for games, with GHOST under SDL
Closed, ArchivedPublicPATCH

Description

This patch:
- Fixes SDL fullscreen mode for game engine (blenderplayer): updated GHOST_DisplayManagerSDL method signatures to match parent class; they were not overriding the base methods.
- Fixes embedded game engine exit; used to cause segfault: joystick code was freeing video resource.

Note that mode switching is not supported yet.

Event Timeline

The second part of the patch fixes a segfault when exiting the embedded player. Attaching a backtrace of the segfault.

This fix may break joystick use when not using SDL for video: this is the log message from the last time those lines were changed:

r38697 | blendix | 2011-07-26 01:44:41 +1000 (Tue, 26 Jul 2011) | 6 lines

Fix #28014: joystick sensor not working. Broke this with an earlier commit
trying to fix blenderplayer startup warnings. It seems we do need to init
the SDL video subsystem even if we only want events, thanks Juha Maki-Kanto
for pointing this out.

Added sdl_blenderplayer_1.patch, which adds ifdefs around the changed lines: if GHOST isn't running under SDL, the old behaviour of initialising video in the joystick code is used.

Committed with approval from Campbell, r43071. Thanks, Campbell, for the suggestion about ifdefing the joystick subsystem initialisation code.

Alex Fraser (z0r) changed the task status from Unknown Status to Unknown Status.Jan 2 2012, 1:38 PM

Hi,

The patch looks fine to me at least, I'm not an official dev though :)

One somewhat related issue I didn't think of before is that if GHOST is also consuming events from SDL similarly to the joystick-system, then there needs to be something keeping them from processing each other's events. Couldn't find anything like this on a cursory glance, but if this is an issue then there is a function called SDL_PeepEvents to only take certain events from the queue (apparently this function changed a bit between 1.2 -> 1.3, googled it and it now takes a range of events instead of an event-mask). Alternatively some kind of SDL-wrapper to handle these types of issues could be made, but would require some more thought.