From 3b6398cd40838b7b2679eb597d453e3e81b1e6ef Mon Sep 17 00:00:00 2001 From: David-John Willis Date: Sun, 29 Jul 2012 21:04:53 +0100 Subject: GPH: Clean up initialisation code and start event manager after log files are setup (if needed). --- backends/platform/gph/gph-backend.cpp | 49 +++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'backends/platform/gph/gph-backend.cpp') diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp index 49a1edf411..485780b472 100644 --- a/backends/platform/gph/gph-backend.cpp +++ b/backends/platform/gph/gph-backend.cpp @@ -20,6 +20,8 @@ * */ +#if defined(GPH_DEVICE) + // Disable symbol overrides so that we can use system headers. #define FORBIDDEN_SYMBOL_ALLOW_ALL @@ -32,8 +34,6 @@ #include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" -#include "base/main.h" - #include "common/archive.h" #include "common/config-manager.h" #include "common/debug.h" @@ -64,23 +64,6 @@ void OSystem_GPH::initBackend() { assert(!_inited); - // Create the events manager - if (_eventSource == 0) - _eventSource = new GPHEventSource(); - - // Create the graphics manager - if (_graphicsManager == 0) { - _graphicsManager = new GPHGraphicsManager(_eventSource); - } - - // Create the mixer manager - if (_mixer == 0) { - _mixerManager = new DoubleBufferSDLMixerManager(); - - // Setup and start mixer - _mixerManager->init(); - } - /* Setup default save path to be workingdir/saves */ char savePath[PATH_MAX+1]; @@ -165,16 +148,42 @@ void OSystem_GPH::initBackend() { /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' at the bottom is ;-). */ ConfMan.registerDefault("aspect_ratio", true); + ConfMan.registerDefault("fullscreen", true); /* Make sure SDL knows that we have a joystick we want to use. */ ConfMan.setInt("joystick_num", 0); + // Create the events manager + if (_eventSource == 0) + _eventSource = new GPHEventSource(); + + // Create the graphics manager + if (_graphicsManager == 0) { + _graphicsManager = new GPHGraphicsManager(_eventSource); + } + /* Pass to POSIX method to do the heavy lifting */ OSystem_POSIX::initBackend(); _inited = true; } +void OSystem_GPH::initSDL() { + // Check if SDL has not been initialized + if (!_initedSDL) { + + uint32 sdlFlags = SDL_INIT_EVENTTHREAD; + if (ConfMan.hasKey("disable_sdl_parachute")) + sdlFlags |= SDL_INIT_NOPARACHUTE; + + // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers) + if (SDL_Init(sdlFlags) == -1) + error("Could not initialize SDL: %s", SDL_GetError()); + + _initedSDL = true; + } +} + void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { /* Setup default extra data paths for engine data files and plugins */ @@ -222,3 +231,5 @@ void OSystem_GPH::quit() { OSystem_POSIX::quit(); } + +#endif -- cgit v1.2.3