Index: code/branches/resource2/src/core/CMakeLists.txt
===================================================================
--- code/branches/resource2/src/core/CMakeLists.txt	(revision 5688)
+++ code/branches/resource2/src/core/CMakeLists.txt	(revision 5689)
@@ -31,4 +31,5 @@
   Language.cc
   LuaState.cc
+  MemoryArchive.cc
   ObjectListBase.cc
   OrxonoxClass.cc
Index: code/branches/resource2/src/core/CorePrereqs.h
===================================================================
--- code/branches/resource2/src/core/CorePrereqs.h	(revision 5688)
+++ code/branches/resource2/src/core/CorePrereqs.h	(revision 5689)
@@ -134,4 +134,6 @@
     class Loader;
     class LuaState;
+    class MemoryArchive;
+    class MemoryArchiveFactory;
     class MetaObjectList;
     class MetaObjectListElement;
Index: code/branches/resource2/src/core/GraphicsManager.cc
===================================================================
--- code/branches/resource2/src/core/GraphicsManager.cc	(revision 5688)
+++ code/branches/resource2/src/core/GraphicsManager.cc	(revision 5689)
@@ -28,19 +28,16 @@
  */
 
-/**
-@file
-@brief
-    Implementation of an partial interface to Ogre.
-*/
-
 #include "GraphicsManager.h"
 
 #include <fstream>
+#include <sstream>
 #include <boost/filesystem.hpp>
-
+#include <boost/shared_array.hpp>
+
+#include <OgreArchiveFactory.h>
+#include <OgreArchiveManager.h>
 #include <OgreFrameListener.h>
 #include <OgreRoot.h>
 #include <OgreLogManager.h>
-#include <OgreException.h>
 #include <OgreRenderWindow.h>
 #include <OgreRenderSystem.h>
@@ -62,4 +59,5 @@
 #include "GameMode.h"
 #include "Loader.h"
+#include "MemoryArchive.h"
 #include "WindowEventListener.h"
 #include "XMLFile.h"
@@ -88,4 +86,7 @@
     GraphicsManager::GraphicsManager(bool bLoadRenderer)
         : ogreWindowEventListener_(new OgreWindowEventListener())
+#if OGRE_VERSION < 0x010600
+        , memoryArchiveFactory_(new MemoryArchiveFactory())
+#endif
         , renderWindow_(0)
         , viewport_(0)
@@ -165,4 +166,52 @@
 
         this->loadRenderer();
+
+#if OGRE_VERSION < 0x010600
+        // WORKAROUND: There is an incompatibility for particle scripts when trying
+        // to support both Ogre 1.4 and 1.6. The hacky solution is to create
+        // scripts for the 1.6 version and then remove the inserted "particle_system"
+        // keyword. But we need to supply these new scripts as well, which is why
+        // there is an extra Ogre::Archive dealing with in the memory.
+        using namespace Ogre;
+        ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());
+        const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();
+        // Travers all groups
+        for (StringVector::const_iterator itGroup = groups.begin(); itGroup != groups.end(); ++itGroup)
+        {
+            FileInfoListPtr files = ResourceGroupManager::getSingleton().findResourceFileInfo(*itGroup, "*.particle");
+            for (FileInfoList::const_iterator itFile = files->begin(); itFile != files->end(); ++itFile)
+            {
+                // open file
+                Ogre::DataStreamPtr input = ResourceGroupManager::getSingleton().openResource(itFile->filename, *itGroup, false);
+                std::stringstream output;
+                // Parse file and replace "particle_system" with nothing
+                while (!input->eof())
+                {
+                    std::string line = input->getLine();
+                    size_t pos = line.find("particle_system");
+                    if (pos != std::string::npos)
+                    {
+                        // 15 is the length of "particle_system"
+                        line.replace(pos, 15, "");
+                    }
+                    output << line << std::endl;
+                }
+                // Add file to the memory archive
+                shared_array<char> data(new char[output.str().size()]);
+                // Debug optimisations
+                const std::string outputStr = output.str();
+                char* rawData = data.get();
+                for (unsigned i = 0; i < outputStr.size(); ++i)
+                    rawData[i] = outputStr[i];
+                MemoryArchive::addFile("particle_scripts_ogre_1.4_" + *itGroup, itFile->filename, data, output.str().size());
+            }
+            if (!files->empty())
+            {
+                // Declare the files, but using a new group
+                ResourceGroupManager::getSingleton().addResourceLocation("particle_scripts_ogre_1.4_" + *itGroup,
+                    "Memory", "particle_scripts_ogre_1.4_" + *itGroup);
+            }
+        }
+#endif
 
         // Initialise all resources (do this AFTER the renderer has been loaded!)
Index: code/branches/resource2/src/core/GraphicsManager.h
===================================================================
--- code/branches/resource2/src/core/GraphicsManager.h	(revision 5688)
+++ code/branches/resource2/src/core/GraphicsManager.h	(revision 5689)
@@ -91,4 +91,7 @@
 
         scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
+#if OGRE_VERSION < 0x010600
+        scoped_ptr<MemoryArchiveFactory>    memoryArchiveFactory_;    //!< Stores the modified particle scripts
+#endif
         scoped_ptr<Ogre::LogManager>        ogreLogger_;
         scoped_ptr<Ogre::Root>              ogreRoot_;                //!< Ogre's root
Index: code/branches/resource2/src/core/MemoryArchive.cc
===================================================================
--- code/branches/resource2/src/core/MemoryArchive.cc	(revision 5689)
+++ code/branches/resource2/src/core/MemoryArchive.cc	(revision 5689)
@@ -0,0 +1,133 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "MemoryArchive.h"
+
+#if OGRE_VERSION < 0x010600
+
+#include <OgreException.h>
+#include <boost/filesystem.hpp>
+
+namespace orxonox
+{
+    using namespace Ogre;
+
+    MemoryArchive::ArchiveMap MemoryArchive::archives_s;
+
+    void MemoryArchive::load()
+    {
+        if (archives_s.find(this->getName()) == archives_s.end())
+            OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR, this->getName() + " - MemoryArchive not found.", "MemoryArchive");
+    }
+
+    DataStreamPtr MemoryArchive::open(const String& filename) const
+    {
+        const FileMap& files = archives_s[this->getName()];
+        FileMap::const_iterator itFile = files.find(filename);
+        if (itFile == files.end())
+            return DataStreamPtr();
+        else
+            return MemoryDataStreamPtr(new MemoryDataStream(itFile->second.first.get(), itFile->second.second));
+    }
+
+    void MemoryArchive::findFiles(const String& pattern, bool bRecursive, 
+        bool bDirs, StringVector* simpleList, FileInfoList* detailList)
+    {
+        const FileMap& files = archives_s[this->getName()];
+
+        for (FileMap::const_iterator it = files.begin(); it != files.end(); ++it)
+        {
+            boost::filesystem::path file = it->first;
+            // Check pattern
+            if (!StringUtil::match(file.string(), pattern, true))
+                continue;
+            if (bDirs)
+                file = file.parent_path();
+            if (file.empty())
+                continue;
+            if (file.has_parent_path() && !bRecursive)
+                continue;
+            if (simpleList)
+                simpleList->push_back(file.string());
+            if (detailList)
+            {
+                FileInfo fi;
+                fi.archive = this;
+                fi.filename = file.string();
+                fi.basename = file.filename();
+                fi.path = file.parent_path().string();
+                fi.compressedSize = it->second.second;
+                fi.uncompressedSize = it->second.second;
+                detailList->push_back(fi);
+            }
+        }
+    }
+    StringVectorPtr MemoryArchive::list(bool recursive, bool dirs)
+    {
+        StringVectorPtr ret(new StringVector());
+        findFiles("*", recursive, dirs, ret.getPointer(), 0);
+        return ret;
+    }
+
+    FileInfoListPtr MemoryArchive::listFileInfo(bool recursive, bool dirs)
+    {
+        FileInfoListPtr ret(new FileInfoList());
+        findFiles("*", recursive, dirs, 0, ret.getPointer());
+        return ret;
+    }
+
+    StringVectorPtr MemoryArchive::find(const String& pattern,
+                                            bool recursive, bool dirs)
+    {
+        StringVectorPtr ret(new StringVector());
+        findFiles(pattern, recursive, dirs, ret.getPointer(), 0);
+        return ret;
+    }
+
+    FileInfoListPtr MemoryArchive::findFileInfo(const String& pattern, 
+        bool recursive, bool dirs)
+    {
+        FileInfoListPtr ret(new FileInfoList());
+        findFiles(pattern, recursive, dirs, 0, ret.getPointer());
+        return ret;
+    }
+
+    bool MemoryArchive::exists(const String& filename)
+	{
+        const FileMap& files = archives_s[this->getName()];
+        return files.find(filename) != files.end();
+	}
+
+    const Ogre::String& MemoryArchiveFactory::getType(void) const
+    {
+        static std::string result("Memory");
+        return result;
+    }
+}
+
+#endif /* OGRE_VERSION < 0x010600 */
Index: code/branches/resource2/src/core/MemoryArchive.h
===================================================================
--- code/branches/resource2/src/core/MemoryArchive.h	(revision 5689)
+++ code/branches/resource2/src/core/MemoryArchive.h	(revision 5689)
@@ -0,0 +1,101 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _MemoryArchive_H__
+#define _MemoryArchive_H__
+
+#include "CorePrereqs.h"
+#include <OgrePrerequisites.h>
+
+#if OGRE_VERSION < 0x010600
+
+#include <map>
+#include <OgreArchive.h>
+#include <OgreArchiveFactory.h>
+#include <boost/shared_array.hpp>
+
+namespace orxonox
+{
+    /**
+    @brief
+        Provides a simple mechanism of 'memory mapped IO', but compatible for Ogre 1.4
+
+        Files are stored as shared_array<char> in a static map with the archive names
+        (imaging the different archives as resource locations). This map then contains
+        yet another map with the actual files.
+        If you want to know why we make such a fuss, contact GraphicsManager::upgradeToGraphics()
+        for more information.
+    */
+    class MemoryArchive : public Ogre::Archive
+    {
+    public:
+        MemoryArchive(const Ogre::String& name, const Ogre::String& archiveType) : Ogre::Archive(name, archiveType) { }
+        ~MemoryArchive() { }
+
+        bool isCaseSensitive(void) const { return true; }
+
+        void load();
+        void unload() { }
+
+        Ogre::DataStreamPtr open(const Ogre::String& filename) const;
+
+        Ogre::StringVectorPtr list(bool recursive = true, bool dirs = false);
+        Ogre::FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+
+        Ogre::StringVectorPtr find(const Ogre::String& pattern, bool recursive = true,
+            bool dirs = false);
+        Ogre::FileInfoListPtr findFileInfo(const Ogre::String& pattern, bool recursive = true,
+            bool dirs = false);
+
+        bool exists(const Ogre::String& filename);
+
+        static void addFile(const std::string& archiveName, const std::string& filename, shared_array<char> content, size_t size)
+            { archives_s[archiveName][filename] = std::make_pair(content, size); }
+
+    private:
+        void findFiles(const Ogre::String& pattern, bool bRecursive, 
+            bool bDirs, Ogre::StringVector* simpleList, Ogre::FileInfoList* detailList);
+
+        typedef std::map<std::string, std::pair<shared_array<char>, size_t> > FileMap;
+        typedef std::map<std::string, FileMap> ArchiveMap;
+        static ArchiveMap archives_s;
+    };
+
+    //! Specialisation of ArchiveFactory for MemoryArchive.
+    class _CoreExport MemoryArchiveFactory : public Ogre::ArchiveFactory
+    {
+    public:
+        const Ogre::String& getType(void) const;
+        Ogre::Archive* createInstance(const Ogre::String& name) { return new MemoryArchive(name, "Memory"); }
+        void destroyInstance(Ogre::Archive* arch)               { delete arch; }
+    };
+}
+
+#endif /* OGRE_VERSION < 0x010600 */
+
+#endif /* _MemoryArchive_H__ */
