Index: code/branches/resource2/cmake/LibraryConfig.cmake
===================================================================
--- code/branches/resource2/cmake/LibraryConfig.cmake	(revision 5688)
+++ code/branches/resource2/cmake/LibraryConfig.cmake	(revision 5689)
@@ -85,5 +85,5 @@
 # Performs the search and sets the variables    #
 
-FIND_PACKAGE(OGRE  1.4 EXACT REQUIRED)
+FIND_PACKAGE(OGRE  1.4       REQUIRED)
 FIND_PACKAGE(ENet  1.1       REQUIRED)
 FIND_PACKAGE(Ogg             REQUIRED)
Index: code/branches/resource2/data/particle/Example-Water.particle
===================================================================
--- code/branches/resource2/data/particle/Example-Water.particle	(revision 5688)
+++ code/branches/resource2/data/particle/Example-Water.particle	(revision 5689)
@@ -1,3 +1,3 @@
-Examples/Water/Rain
+particle_system Examples/Water/Rain
 {
     material        Examples/Droplet
Index: code/branches/resource2/data/particle/Example.particle
===================================================================
--- code/branches/resource2/data/particle/Example.particle	(revision 5688)
+++ code/branches/resource2/data/particle/Example.particle	(revision 5689)
@@ -2,5 +2,5 @@
 
 // Exudes greeny particles which float upwards
-Examples/GreenyNimbus
+particle_system Examples/GreenyNimbus
 {
     material        Examples/FlarePointSprite
@@ -49,5 +49,5 @@
 
 // A sparkly purple fountain
-Examples/PurpleFountain
+particle_system Examples/PurpleFountain
 {
     material        Examples/Flare2
@@ -89,5 +89,5 @@
 
 // A downpour
-Examples/Rain
+particle_system Examples/Rain
 {
     material        Examples/Droplet
@@ -125,5 +125,5 @@
 
 // A jet engine (of sorts)
-Examples/JetEngine1
+particle_system Examples/JetEngine1
 {
 	material 		Examples/Flare
@@ -154,5 +154,5 @@
 	
 }
-Examples/JetEngine2
+particle_system Examples/JetEngine2
 {
 	material 		Examples/Flare
@@ -185,5 +185,5 @@
 
 // Exudes aureola particles which around the model float upwards
-Examples/Aureola
+particle_system Examples/Aureola
 {
     material        Examples/Aureola
@@ -247,5 +247,5 @@
 
 
-Examples/Swarm
+particle_system Examples/Swarm
 {
 	quota	3000
@@ -342,5 +342,5 @@
 
 
-Examples/Snow
+particle_system Examples/Snow
 {
 	quota	2000
Index: code/branches/resource2/data/particle/ExplosionComp1.particle
===================================================================
--- code/branches/resource2/data/particle/ExplosionComp1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/ExplosionComp1.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/ExplosionComp1
+particle_system Orxonox/ExplosionComp1
 {
 	quota	150
Index: code/branches/resource2/data/particle/ExplosionComp2.particle
===================================================================
--- code/branches/resource2/data/particle/ExplosionComp2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/ExplosionComp2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/ExplosionComp2
+particle_system Orxonox/ExplosionComp2
 {
 	quota	1000
Index: code/branches/resource2/data/particle/ExplosionComp4.particle
===================================================================
--- code/branches/resource2/data/particle/ExplosionComp4.particle	(revision 5688)
+++ code/branches/resource2/data/particle/ExplosionComp4.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-ExplosionComp4
+particle_system ExplosionComp4
 {
 	quota	10
@@ -20,5 +20,5 @@
 }
 
-Orxonox/ExplosionComp4
+particle_system Orxonox/ExplosionComp4
 {
 	quota	500
Index: code/branches/resource2/data/particle/FireComp2.particle
===================================================================
--- code/branches/resource2/data/particle/FireComp2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/FireComp2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/FireComp2
+particle_system Orxonox/FireComp2
 {
 	quota	10000
Index: code/branches/resource2/data/particle/LaserGun.particle
===================================================================
--- code/branches/resource2/data/particle/LaserGun.particle	(revision 5688)
+++ code/branches/resource2/data/particle/LaserGun.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/LaserGun
+particle_system Orxonox/LaserGun
 {
 	quota	1000
Index: code/branches/resource2/data/particle/ThrusterFire.particle
===================================================================
--- code/branches/resource2/data/particle/ThrusterFire.particle	(revision 5688)
+++ code/branches/resource2/data/particle/ThrusterFire.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/ThrusterFire
+particle_system Orxonox/ThrusterFire
 {
 	quota	50
Index: code/branches/resource2/data/particle/bigexplosion1part1.particle
===================================================================
--- code/branches/resource2/data/particle/bigexplosion1part1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/bigexplosion1part1.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/BigExplosion1part1
+particle_system Orxonox/BigExplosion1part1
 {
 	quota	100
Index: code/branches/resource2/data/particle/bigexplosion1part2.particle
===================================================================
--- code/branches/resource2/data/particle/bigexplosion1part2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/bigexplosion1part2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/BigExplosion1part2
+particle_system Orxonox/BigExplosion1part2
 {
 	quota	50
Index: code/branches/resource2/data/particle/bigexplosion1part3.particle
===================================================================
--- code/branches/resource2/data/particle/bigexplosion1part3.particle	(revision 5688)
+++ code/branches/resource2/data/particle/bigexplosion1part3.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/BigExplosion1part3
+particle_system Orxonox/BigExplosion1part3
 {
 	quota	120
Index: code/branches/resource2/data/particle/emitted_emitter.particle
===================================================================
--- code/branches/resource2/data/particle/emitted_emitter.particle	(revision 5688)
+++ code/branches/resource2/data/particle/emitted_emitter.particle	(revision 5689)
@@ -1,4 +1,4 @@
 // Example emitted emitters
-Examples/Fireworks
+particle_system Examples/Fireworks
 {
      material Examples/Flare
Index: code/branches/resource2/data/particle/engineglow.particle
===================================================================
--- code/branches/resource2/data/particle/engineglow.particle	(revision 5688)
+++ code/branches/resource2/data/particle/engineglow.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/engineglow
+particle_system Orxonox/engineglow
 {
 	quota	200
Index: code/branches/resource2/data/particle/explosion1.particle
===================================================================
--- code/branches/resource2/data/particle/explosion1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/explosion1.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/explosion1
+particle_system Orxonox/explosion1
 {
 	quota	200
Index: code/branches/resource2/data/particle/explosion2.particle
===================================================================
--- code/branches/resource2/data/particle/explosion2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/explosion2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/explosion2
+particle_system Orxonox/explosion2
 {
 	quota	150
Index: code/branches/resource2/data/particle/explosion2b.particle
===================================================================
--- code/branches/resource2/data/particle/explosion2b.particle	(revision 5688)
+++ code/branches/resource2/data/particle/explosion2b.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/explosion2b
+particle_system Orxonox/explosion2b
 {
 	quota	150
Index: code/branches/resource2/data/particle/explosion3.particle
===================================================================
--- code/branches/resource2/data/particle/explosion3.particle	(revision 5688)
+++ code/branches/resource2/data/particle/explosion3.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/explosion3
+particle_system Orxonox/explosion3
 {
 	quota	10
Index: code/branches/resource2/data/particle/fairytwirl.particle
===================================================================
--- code/branches/resource2/data/particle/fairytwirl.particle	(revision 5688)
+++ code/branches/resource2/data/particle/fairytwirl.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/fairytwirl
+particle_system Orxonox/fairytwirl
 {
 	quota	500
Index: code/branches/resource2/data/particle/fire3.particle
===================================================================
--- code/branches/resource2/data/particle/fire3.particle	(revision 5688)
+++ code/branches/resource2/data/particle/fire3.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/fire3
+particle_system Orxonox/fire3
 {
 	quota	50
Index: code/branches/resource2/data/particle/fire4.particle
===================================================================
--- code/branches/resource2/data/particle/fire4.particle	(revision 5688)
+++ code/branches/resource2/data/particle/fire4.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/fire4
+particle_system Orxonox/fire4
 {
 	quota	25
Index: code/branches/resource2/data/particle/forcefield.particle
===================================================================
--- code/branches/resource2/data/particle/forcefield.particle	(revision 5688)
+++ code/branches/resource2/data/particle/forcefield.particle	(revision 5689)
@@ -1,3 +1,3 @@
-Orxonox/ForceFieldPurpleBig
+particle_system Orxonox/ForceFieldPurpleBig
 {
 	quota	10000
@@ -91,5 +91,5 @@
 }
 
-Orxonox/ForceFieldPurpleSmall
+particle_system Orxonox/ForceFieldPurpleSmall
 {
 	quota	10000
@@ -183,5 +183,5 @@
 }	
 
-Orxonox/ForceFieldGreenBig
+particle_system Orxonox/ForceFieldGreenBig
 {
 	quota	10000
@@ -275,5 +275,5 @@
 }
 
-Orxonox/ForceFieldGreenSmall
+particle_system Orxonox/ForceFieldGreenSmall
 {
 	quota	10000
@@ -370,5 +370,5 @@
 
 			
-Orxonox/ForceFieldBlueBig
+particle_system Orxonox/ForceFieldBlueBig
 {
 	quota	10000
@@ -462,5 +462,5 @@
 }
 
-Orxonox/ForceFieldBlueSmall
+particle_system Orxonox/ForceFieldBlueSmall
 {
 	quota	10000
Index: code/branches/resource2/data/particle/ray1.particle
===================================================================
--- code/branches/resource2/data/particle/ray1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/ray1.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/ray1
+particle_system Orxonox/ray1
 {
 	quota	1000
Index: code/branches/resource2/data/particle/ray2.particle
===================================================================
--- code/branches/resource2/data/particle/ray2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/ray2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/ray2
+particle_system Orxonox/ray2
 {
 	quota	1200
Index: code/branches/resource2/data/particle/repairGold.particle
===================================================================
--- code/branches/resource2/data/particle/repairGold.particle	(revision 5688)
+++ code/branches/resource2/data/particle/repairGold.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/repairGold
+particle_system Orxonox/repairGold
 {
 	quota	200
Index: code/branches/resource2/data/particle/repairSilver.particle
===================================================================
--- code/branches/resource2/data/particle/repairSilver.particle	(revision 5688)
+++ code/branches/resource2/data/particle/repairSilver.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/repairSilver
+particle_system Orxonox/repairSilver
 {
 	quota	500
Index: code/branches/resource2/data/particle/shot1.particle
===================================================================
--- code/branches/resource2/data/particle/shot1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/shot1.particle	(revision 5689)
@@ -1,3 +1,3 @@
-Orxonox/shot1
+particle_system Orxonox/shot1
 {
 	quota	5000
Index: code/branches/resource2/data/particle/shot2.particle
===================================================================
--- code/branches/resource2/data/particle/shot2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/shot2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/shot2
+particle_system Orxonox/shot2
 {
 	quota	25
Index: code/branches/resource2/data/particle/shot2_small.particle
===================================================================
--- code/branches/resource2/data/particle/shot2_small.particle	(revision 5688)
+++ code/branches/resource2/data/particle/shot2_small.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/shot2_small
+particle_system Orxonox/shot2_small
 {
 	quota	25
Index: code/branches/resource2/data/particle/shot3_small.particle
===================================================================
--- code/branches/resource2/data/particle/shot3_small.particle	(revision 5688)
+++ code/branches/resource2/data/particle/shot3_small.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/shot3_small
+particle_system Orxonox/shot3_small
 {
 	quota	25
Index: code/branches/resource2/data/particle/shotTest.particle
===================================================================
--- code/branches/resource2/data/particle/shotTest.particle	(revision 5688)
+++ code/branches/resource2/data/particle/shotTest.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/shotTest
+particle_system Orxonox/shotTest
 {
 	quota	3000
Index: code/branches/resource2/data/particle/smoke1.particle
===================================================================
--- code/branches/resource2/data/particle/smoke1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke1.particle	(revision 5689)
@@ -2,5 +2,5 @@
 
 // smoke
-Examples/Smoke
+particle_system Examples/Smoke
 {
     	material        	Examples/Smoke
Index: code/branches/resource2/data/particle/smoke2.particle
===================================================================
--- code/branches/resource2/data/particle/smoke2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke2.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/smoke2
+particle_system Orxonox/smoke2
 {
 	quota	1000
Index: code/branches/resource2/data/particle/smoke3.particle
===================================================================
--- code/branches/resource2/data/particle/smoke3.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke3.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/smoke3
+particle_system Orxonox/smoke3
 {
 	quota	10
Index: code/branches/resource2/data/particle/smoke4.particle
===================================================================
--- code/branches/resource2/data/particle/smoke4.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke4.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/smoke4
+particle_system Orxonox/smoke4
 {
 	quota	10
Index: code/branches/resource2/data/particle/smoke5.particle
===================================================================
--- code/branches/resource2/data/particle/smoke5.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke5.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/smoke5
+particle_system Orxonox/smoke5
 {
 	quota	80
Index: code/branches/resource2/data/particle/smoke6.particle
===================================================================
--- code/branches/resource2/data/particle/smoke6.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke6.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/smoke6
+particle_system Orxonox/smoke6
 {
 	quota	50
Index: code/branches/resource2/data/particle/smoke7.particle
===================================================================
--- code/branches/resource2/data/particle/smoke7.particle	(revision 5688)
+++ code/branches/resource2/data/particle/smoke7.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/smoke7
+particle_system Orxonox/smoke7
 {
 	quota	25
Index: code/branches/resource2/data/particle/sparks.particle
===================================================================
--- code/branches/resource2/data/particle/sparks.particle	(revision 5688)
+++ code/branches/resource2/data/particle/sparks.particle	(revision 5689)
@@ -1,4 +1,4 @@
 
-Orxonox/sparks
+particle_system Orxonox/sparks
 {
 	quota	100
Index: code/branches/resource2/data/particle/thruster1.particle
===================================================================
--- code/branches/resource2/data/particle/thruster1.particle	(revision 5688)
+++ code/branches/resource2/data/particle/thruster1.particle	(revision 5689)
@@ -1,3 +1,3 @@
-Orxonox/thruster1
+particle_system Orxonox/thruster1
 {
 	quota	100
Index: code/branches/resource2/data/particle/thruster2.particle
===================================================================
--- code/branches/resource2/data/particle/thruster2.particle	(revision 5688)
+++ code/branches/resource2/data/particle/thruster2.particle	(revision 5689)
@@ -1,3 +1,3 @@
-Orxonox/thruster2
+particle_system Orxonox/thruster2
 {
 	quota	150
Index: code/branches/resource2/data/particle/thruster3.particle
===================================================================
--- code/branches/resource2/data/particle/thruster3.particle	(revision 5688)
+++ code/branches/resource2/data/particle/thruster3.particle	(revision 5689)
@@ -1,3 +1,3 @@
-Orxonox/thruster3
+particle_system Orxonox/thruster3
 {
 	quota	100
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__ */
