aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Apers2006-04-11 18:25:04 +0000
committerChris Apers2006-04-11 18:25:04 +0000
commit37ecf6bc0a516809e954545307c8a2015bdb8296 (patch)
treecbe5dd20da1b6f2c52a0eb1c291ab96d8d3a7b36
parentf61d74532b7cb6902db4f01f4e1f429469568a23 (diff)
downloadscummvm-rg350-37ecf6bc0a516809e954545307c8a2015bdb8296.tar.gz
scummvm-rg350-37ecf6bc0a516809e954545307c8a2015bdb8296.tar.bz2
scummvm-rg350-37ecf6bc0a516809e954545307c8a2015bdb8296.zip
Bad hack to make the file class work agaain with PalmOS ARM version - read the comment for more details
svn-id: r21806
-rw-r--r--common/file.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/file.cpp b/common/file.cpp
index a2a9e5b3c1..30ed40935e 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -37,9 +37,20 @@ typedef HashMap<String, int> StringIntMap;
// The following two objects could be turned into static members of class
// File. However, then we would be forced to #include hashmap in file.h
// which seems to be a high price just for a simple beautification...
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
static StringIntMap _defaultDirectories;
static FilesMap _filesMap;
+#else
+// This is a very bad hack to make these global objects work with PalmOS ARM version.
+// In fact global objects are correctly allocated but constructors/destructors are not called
+// and so, the object is not correctly initialized. See also the 2 functions at end of file.
+// This is related to how ARM apps are handled in PalmOS, there is no problem with 68k version.
+static StringIntMap *__defaultDirectories;
+static FilesMap *__filesMap;
+#define _defaultDirectories (*__defaultDirectories)
+#define _filesMap (*__filesMap)
+#endif
static FILE *fopenNoCase(const char *filename, const char *directory, const char *mode) {
FILE *file;
@@ -359,3 +370,14 @@ uint32 File::write(const void *ptr, uint32 len) {
}
} // End of namespace Common
+
+#if defined(PALMOS_ARM) || defined(PALMOS_DEBUG)
+void initGlobalHashes() {
+ Common::__defaultDirectories = new Common::StringIntMap;
+ Common::__filesMap = new Common::FilesMap;
+}
+void freeGlobalHashes() {
+ delete Common::__defaultDirectories;
+ delete Common::__filesMap;
+}
+#endif