aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2008-02-23 23:03:08 +0000
committerMax Horn2008-02-23 23:03:08 +0000
commite421a2363944ba7567311a2c2e2720151f6840b2 (patch)
tree5bb373c4003e6ed1cf2370c37fbb24b71f0f1a25 /common
parent8917835374148e22bb80aa076374253bb365e5fb (diff)
downloadscummvm-rg350-e421a2363944ba7567311a2c2e2720151f6840b2.tar.gz
scummvm-rg350-e421a2363944ba7567311a2c2e2720151f6840b2.tar.bz2
scummvm-rg350-e421a2363944ba7567311a2c2e2720151f6840b2.zip
Replaced FilesystemFactory::makeFSFactory with a new method OSystem::getFilesystemFactory()
svn-id: r30947
Diffstat (limited to 'common')
-rw-r--r--common/fs.cpp3
-rw-r--r--common/system.cpp60
-rw-r--r--common/system.h9
3 files changed, 71 insertions, 1 deletions
diff --git a/common/fs.cpp b/common/fs.cpp
index 7d9c374b4b..bd35f0de53 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -23,6 +23,7 @@
*/
#include "common/util.h"
+#include "common/system.h"
#include "backends/fs/abstract-fs.h"
#include "backends/fs/fs-factory.h"
@@ -44,7 +45,7 @@ FilesystemNode::FilesystemNode(const FilesystemNode &node) {
}
FilesystemNode::FilesystemNode(const Common::String &p) {
- FilesystemFactory *factory = FilesystemFactory::makeFSFactory();
+ FilesystemFactory *factory = g_system->getFilesystemFactory();
if (p.empty() || p == ".")
_realNode = factory->makeCurrentDirectoryFileNode();
diff --git a/common/system.cpp b/common/system.cpp
index faced65993..8137fce5df 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -24,6 +24,7 @@
*/
#include "backends/events/default/default-events.h"
+#include "backends/fs/fs-factory.h"
#include "common/config-manager.h"
#include "common/system.h"
@@ -127,3 +128,62 @@ void OSystem::getTimeAndDate(struct tm &t) const {
time_t curTime = time(0);
t = *localtime(&curTime);
}
+
+/*
+ * All the following includes choose, at compile time, which specific backend will be used
+ * during the execution of the ScummVM.
+ *
+ * TODO: Remove these gradually and instead move the getFilesystemFactory() implementatios
+ * to the respective backends.
+ */
+#if defined(__amigaos4__)
+ #include "backends/fs/amigaos4/amigaos4-fs-factory.cpp"
+#elif defined(__DC__)
+ #include "backends/fs/dc/ronincd-fs-factory.cpp"
+#elif defined(__DS__)
+ #include "backends/fs/ds/ds-fs-factory.cpp"
+#elif defined(__GP32__)
+ #include "backends/fs/gp32/gp32-fs-factory.cpp"
+#elif defined(__MORPHOS__)
+ #include "backends/fs/morphos/abox-fs-factory.cpp"
+#elif defined(PALMOS_MODE)
+ #include "backends/fs/palmos/palmos-fs-factory.cpp"
+#elif defined(__PLAYSTATION2__)
+ #include "backends/fs/ps2/ps2-fs-factory.cpp"
+#elif defined(__PSP__)
+ #include "backends/fs/psp/psp-fs-factory.cpp"
+#elif defined(__SYMBIAN32__)
+ #include "backends/fs/symbian/symbian-fs-factory.cpp"
+#elif defined(UNIX)
+ #include "backends/fs/posix/posix-fs-factory.cpp"
+#elif defined(WIN32)
+ #include "backends/fs/windows/windows-fs-factory.cpp"
+#endif
+
+FilesystemFactory *OSystem::getFilesystemFactory() {
+ #if defined(__amigaos4__)
+ return &AmigaOSFilesystemFactory::instance();
+ #elif defined(__DC__)
+ return &RoninCDFilesystemFactory::instance();
+ #elif defined(__DS__)
+ return &DSFilesystemFactory::instance();
+ #elif defined(__GP32__)
+ return &GP32FilesystemFactory::instance();
+ #elif defined(__MORPHOS__)
+ return &ABoxFilesystemFactory::instance();
+ #elif defined(PALMOS_MODE)
+ return &PalmOSFilesystemFactory::instance();
+ #elif defined(__PLAYSTATION2__)
+ return &Ps2FilesystemFactory::instance();
+ #elif defined(__PSP__)
+ return &PSPFilesystemFactory::instance();
+ #elif defined(__SYMBIAN32__)
+ return &SymbianFilesystemFactory::instance();
+ #elif defined(UNIX)
+ return &POSIXFilesystemFactory::instance();
+ #elif defined(WIN32)
+ return &WindowsFilesystemFactory::instance();
+ #else
+ #error Unknown and unsupported backend in OSystem::getFilesystemFactory
+ #endif
+} \ No newline at end of file
diff --git a/common/system.h b/common/system.h
index 44726fe05c..7989cabfbd 100644
--- a/common/system.h
+++ b/common/system.h
@@ -46,6 +46,8 @@ namespace Common {
class TimerManager;
}
+class FilesystemFactory;
+
/**
* Interface for ScummVM backends. If you want to port ScummVM to a system
* which is not currently covered by any of our backends, this is the place
@@ -900,6 +902,13 @@ public:
*/
virtual Common::SaveFileManager *getSavefileManager() = 0;
+ /**
+ * Returns the FilesystemFactory object, depending on the current architecture.
+ *
+ * @return FilesystemFactory* The specific factory for the current architecture.
+ */
+ virtual FilesystemFactory *getFilesystemFactory();
+
/**
* Return String which is used for backend-specific addition to theme