diff options
author | Alejandro Marzini | 2010-06-01 04:02:44 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-06-01 04:02:44 +0000 |
commit | 38dbbca964ac182439c2e61840783a4b7465688a (patch) | |
tree | 69baa4dc8fd6a225535c5c645c0c2084cc67af1c /backends/platform/sdl | |
parent | 0bc8f4c8b4050c54e551aabdf58b30be79b6720c (diff) | |
download | scummvm-rg350-38dbbca964ac182439c2e61840783a4b7465688a.tar.gz scummvm-rg350-38dbbca964ac182439c2e61840783a4b7465688a.tar.bz2 scummvm-rg350-38dbbca964ac182439c2e61840783a4b7465688a.zip |
Removed OSystem pointer. Added left initialization code to file subsystem.
svn-id: r49370
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/file.cpp | 34 | ||||
-rw-r--r-- | backends/platform/sdl/file.h | 5 | ||||
-rw-r--r-- | backends/platform/sdl/mutex.cpp | 6 | ||||
-rw-r--r-- | backends/platform/sdl/mutex.h | 5 | ||||
-rw-r--r-- | backends/platform/sdl/timer.cpp | 3 | ||||
-rw-r--r-- | backends/platform/sdl/timer.h | 5 |
6 files changed, 27 insertions, 31 deletions
diff --git a/backends/platform/sdl/file.cpp b/backends/platform/sdl/file.cpp index a8dd230059..4c742395df 100644 --- a/backends/platform/sdl/file.cpp +++ b/backends/platform/sdl/file.cpp @@ -68,16 +68,29 @@ SdlSubSys_File::SdlSubSys_File() _fsFactory(0), _savefile(0) { + #if defined(__amigaos4__) + _fsFactory = new AmigaOSFilesystemFactory(); + #elif defined(UNIX) + _fsFactory = new POSIXFilesystemFactory(); + #elif defined(WIN32) + _fsFactory = new WindowsFilesystemFactory(); + #elif defined(__SYMBIAN32__) + // Do nothing since its handled by the Symbian SDL inheritance + #else + #error Unknown and unsupported FS backend + #endif } SdlSubSys_File::~SdlSubSys_File() { + if (_inited) { + fileDone(); + } } -void SdlSubSys_File::fileInit(OSystem *mainSys) { +void SdlSubSys_File::fileInit() { if (_inited) { return; } - _mainSys = mainSys; // Create the savefile manager, if none exists yet (we check for this to // allow subclasses to provide their own). @@ -89,23 +102,16 @@ void SdlSubSys_File::fileInit(OSystem *mainSys) { #endif } -#if defined(__amigaos4__) - _fsFactory = new AmigaOSFilesystemFactory(); -#elif defined(UNIX) - _fsFactory = new POSIXFilesystemFactory(); -#elif defined(WIN32) - _fsFactory = new WindowsFilesystemFactory(); -#elif defined(__SYMBIAN32__) - // Do nothing since its handled by the Symbian SDL inheritance -#else - #error Unknown and unsupported FS backend -#endif - _inited = true; } void SdlSubSys_File::fileDone() { + // Event Manager requires save manager for storing + // recorded events + delete getEventManager(); delete _savefile; + + _inited = false; } bool SdlSubSys_File::hasFeature(Feature f) { diff --git a/backends/platform/sdl/file.h b/backends/platform/sdl/file.h index 4f23a06594..0e0bec7ce8 100644 --- a/backends/platform/sdl/file.h +++ b/backends/platform/sdl/file.h @@ -39,7 +39,7 @@ public: SdlSubSys_File(); ~SdlSubSys_File(); - virtual void fileInit(OSystem *mainSys); + virtual void fileInit(); virtual void fileDone(); bool hasFeature(Feature f); @@ -58,9 +58,6 @@ protected: FilesystemFactory *_fsFactory; Common::SaveFileManager *_savefile; - -private: - OSystem *_mainSys; }; diff --git a/backends/platform/sdl/mutex.cpp b/backends/platform/sdl/mutex.cpp index ce9eef6a96..28a495cbd9 100644 --- a/backends/platform/sdl/mutex.cpp +++ b/backends/platform/sdl/mutex.cpp @@ -27,7 +27,8 @@ SdlSubSys_Mutex::SdlSubSys_Mutex() : - _inited(false) { + _inited(false), + _graphicsMutex(0) { } @@ -37,11 +38,10 @@ SdlSubSys_Mutex::~SdlSubSys_Mutex() { } } -void SdlSubSys_Mutex::mutexInit(OSystem *mainSys) { +void SdlSubSys_Mutex::mutexInit() { if (_inited) { return; } - _mainSys = mainSys; _graphicsMutex = createMutex(); diff --git a/backends/platform/sdl/mutex.h b/backends/platform/sdl/mutex.h index 9479aa9ece..0f53a6067a 100644 --- a/backends/platform/sdl/mutex.h +++ b/backends/platform/sdl/mutex.h @@ -39,7 +39,7 @@ public: SdlSubSys_Mutex(); ~SdlSubSys_Mutex(); - virtual void mutexInit(OSystem *mainSys); + virtual void mutexInit(); virtual void mutexDone(); bool hasFeature(Feature f); @@ -60,9 +60,6 @@ protected: * when accessing the screen. */ MutexRef _graphicsMutex; - -private: - OSystem *_mainSys; }; diff --git a/backends/platform/sdl/timer.cpp b/backends/platform/sdl/timer.cpp index a6dfc67918..865c64826d 100644 --- a/backends/platform/sdl/timer.cpp +++ b/backends/platform/sdl/timer.cpp @@ -47,11 +47,10 @@ SdlSubSys_Timer::~SdlSubSys_Timer() { } } -void SdlSubSys_Timer::timerInit(OSystem *mainSys) { +void SdlSubSys_Timer::timerInit() { if (_inited) { return; } - _mainSys = mainSys; if (SDL_InitSubSystem(SDL_INIT_TIMER) == -1) { error("Could not initialize SDL Timer: %s", SDL_GetError()); diff --git a/backends/platform/sdl/timer.h b/backends/platform/sdl/timer.h index 1d15b5ad98..f624c5cf6e 100644 --- a/backends/platform/sdl/timer.h +++ b/backends/platform/sdl/timer.h @@ -39,7 +39,7 @@ public: SdlSubSys_Timer(); ~SdlSubSys_Timer(); - virtual void timerInit(OSystem *mainSys); + virtual void timerInit(); virtual void timerDone(); bool hasFeature(Feature f); @@ -60,9 +60,6 @@ protected: SDL_TimerID _timerID; Common::TimerManager *_timer; - -private: - OSystem *_mainSys; }; |