From 822a2ef3dccaedd654ca5429b677456328b22ef1 Mon Sep 17 00:00:00 2001 From: CeRiAl Date: Sun, 17 Jul 2011 22:42:45 +0200 Subject: WINCE: Move initialization of TimerManager to overloaded init() method. --- backends/platform/wince/wince-sdl.cpp | 27 +++++++++++++++++++-------- backends/platform/wince/wince-sdl.h | 1 + 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index ec222c6fc1..1abc3cb350 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -42,6 +42,7 @@ #include "audio/mixer_intern.h" #include "audio/fmopl.h" +#include "backends/mutex/sdl/sdl-mutex.h" #include "backends/timer/sdl/sdl-timer.h" #include "gui/Actions.h" @@ -379,14 +380,6 @@ void OSystem_WINCE3::initBackend() { ((WINCESdlEventSource *)_eventSource)->init((WINCESdlGraphicsManager *)_graphicsManager); - // Create the timer (but remove the timer manager from the SDL backend first). - // CE SDL does not support multiple timers (SDL_AddTimer). - // We work around this by using the SetTimer function, since we only use - // one timer in scummvm (for the time being) - delete _timerManager; - _timerManager = new DefaultTimerManager(); - SDL_SetTimer(10, &timer_handler_wrapper); - // Call parent implementation of this method OSystem_SDL::initBackend(); @@ -546,6 +539,24 @@ void OSystem_WINCE3::initSDL() { } } +void OSystem_WINCE3::init() { + // Create SdlMutexManager instance as the TimerManager relies on the + // MutexManager being already initialized + if (_mutexManager == 0) + _mutexManager = new SdlMutexManager(); + + // Create the timer. CE SDL does not support multiple timers (SDL_AddTimer). + // We work around this by using the SetTimer function, since we only use + // one timer in scummvm (for the time being) + if (_timerManager == 0) { + _timerManager = new DefaultTimerManager(); + SDL_SetTimer(10, &timer_handler_wrapper); + } + + // Call parent implementation of this method + OSystem_SDL::init(); +} + void OSystem_WINCE3::quit() { fclose(stdout_file); fclose(stderr_file); diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 481956c19a..b4f323c9e2 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -52,6 +52,7 @@ public: void initBackend(); // Overloaded from SDL backend + void init(); void quit(); virtual Common::String getSystemLanguage() const; -- cgit v1.2.3