aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMax Horn2008-08-22 11:36:47 +0000
committerMax Horn2008-08-22 11:36:47 +0000
commitb727ac880d237cbe10284c2da9db25998ab6eb11 (patch)
tree25a82244455fca9b5181835f6d5fa1391b6dbba7 /backends/platform
parent74238bb53aeca5b3e22ef783689fed255264800b (diff)
downloadscummvm-rg350-b727ac880d237cbe10284c2da9db25998ab6eb11.tar.gz
scummvm-rg350-b727ac880d237cbe10284c2da9db25998ab6eb11.tar.bz2
scummvm-rg350-b727ac880d237cbe10284c2da9db25998ab6eb11.zip
Turned Windows, AmigaOS and POSIX FSFactories into plain classes; no need for them to be singletons (actually true for all other FS factories)
svn-id: r34098
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl.cpp28
-rw-r--r--backends/platform/sdl/sdl.h3
2 files changed, 18 insertions, 13 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 539b34b78b..4ba53ffb5e 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -170,6 +170,21 @@ void OSystem_SDL::initBackend() {
_timerID = SDL_AddTimer(10, &timer_handler, _timer);
}
+ if (_fsFactory == 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 backend in OSystem_SDL::getFilesystemFactory
+ #endif
+ }
+
+
// Invoke parent implementation of this method
OSystem::initBackend();
@@ -196,6 +211,7 @@ OSystem_SDL::OSystem_SDL()
_soundMutex(0), _soundCond(0), _soundThread(0),
_soundThreadIsRunning(false), _soundThreadShouldQuit(false),
#endif
+ _fsFactory(0),
_savefile(0),
_mixer(0),
_timer(0),
@@ -254,17 +270,7 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
}
FilesystemFactory *OSystem_SDL::getFilesystemFactory() {
- #if defined(__amigaos4__)
- return &AmigaOSFilesystemFactory::instance();
- #elif defined(UNIX)
- return &POSIXFilesystemFactory::instance();
- #elif defined(WIN32)
- return &WindowsFilesystemFactory::instance();
- #elif defined(__SYMBIAN32__)
- // Do nothing since its handled by the Symbian SDL inheritance
- #else
- #error Unknown and unsupported backend in OSystem_SDL::getFilesystemFactory
- #endif
+ return _fsFactory;
}
static Common::String getDefaultConfigFileName() {
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 1c1381ec5c..d07dcee679 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -400,14 +400,13 @@ protected:
void deinitThreadedMixer();
#endif
-
+ FilesystemFactory *_fsFactory;
Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
SDL_TimerID _timerID;
Common::TimerManager *_timer;
-
protected:
void addDirtyRgnAuto(const byte *buf);
void makeChecksums(const byte *buf);