aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorDavid-John Willis2012-07-29 21:04:53 +0100
committerDavid-John Willis2012-07-29 21:15:27 +0100
commit3b6398cd40838b7b2679eb597d453e3e81b1e6ef (patch)
tree17eecfdba21d8b60116661d00afe6ae76fd3a9e7 /backends
parente58724a180b965e16eec816fd6bcb2bb71607307 (diff)
downloadscummvm-rg350-3b6398cd40838b7b2679eb597d453e3e81b1e6ef.tar.gz
scummvm-rg350-3b6398cd40838b7b2679eb597d453e3e81b1e6ef.tar.bz2
scummvm-rg350-3b6398cd40838b7b2679eb597d453e3e81b1e6ef.zip
GPH: Clean up initialisation code and start event manager after log files are setup (if needed).
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/gph/gph-backend.cpp49
-rw-r--r--backends/platform/gph/gph.h9
2 files changed, 36 insertions, 22 deletions
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
diff --git a/backends/platform/gph/gph.h b/backends/platform/gph/gph.h
index 80f43f0bab..90a798154f 100644
--- a/backends/platform/gph/gph.h
+++ b/backends/platform/gph/gph.h
@@ -26,13 +26,11 @@
#if defined(GPH_DEVICE)
#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/sdl/posix/posix.h"
#include "backends/events/gph/gph-events.h"
#include "backends/graphics/gph/gph-graphics.h"
-#define __GP2XWIZ__
-
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
@@ -45,6 +43,11 @@ public:
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
void quit();
+
+protected:
+ bool _inited;
+ bool _initedSDL;
+ virtual void initSDL();
};
#endif