mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 10:10:23 +00:00
Introducing Dir Archive
This commit is contained in:
parent
51b74c2f05
commit
b92955763a
@ -297,6 +297,10 @@ void OMW::Engine::loadBSA()
|
|||||||
addBSA (iter->second.string());
|
addBSA (iter->second.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string m = mDataDir.string();
|
||||||
|
std::cout << "Data dir" << m << "\n";
|
||||||
|
addDir(m);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resources directory
|
// add resources directory
|
||||||
@ -394,8 +398,8 @@ void OMW::Engine::go()
|
|||||||
|
|
||||||
mOgre.configure(!isFile(ogreCfg.c_str()), cfgUserDir, plugCfg, false);
|
mOgre.configure(!isFile(ogreCfg.c_str()), cfgUserDir, plugCfg, false);
|
||||||
|
|
||||||
addResourcesDirectory (mDataDir / "Meshes");
|
//addResourcesDirectory (mDataDir / "Meshes");
|
||||||
addResourcesDirectory (mDataDir / "Textures");
|
//addResourcesDirectory (mDataDir / "Textures");
|
||||||
|
|
||||||
// This has to be added BEFORE MyGUI is initialized, as it needs
|
// This has to be added BEFORE MyGUI is initialized, as it needs
|
||||||
// to find core.xml here.
|
// to find core.xml here.
|
||||||
|
@ -118,7 +118,7 @@ namespace MWClass
|
|||||||
Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
|
Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
|
||||||
|
|
||||||
if (groin){
|
if (groin){
|
||||||
cellRender.insertMesh("bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF
|
//cellRender.insertMesh("Meshes/bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF
|
||||||
//bald_MJ_hat.NIF
|
//bald_MJ_hat.NIF
|
||||||
cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, kOgrePi, npcName + "groin", addresses, numbers);
|
cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, kOgrePi, npcName + "groin", addresses, numbers);
|
||||||
addresses2[numbers] = npcName + "groin";
|
addresses2[numbers] = npcName + "groin";
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "bsa_archive.hpp"
|
#include "bsa_archive.hpp"
|
||||||
|
|
||||||
|
#include <OgreFileSystem.h>
|
||||||
#include <OgreArchive.h>
|
#include <OgreArchive.h>
|
||||||
#include <OgreArchiveFactory.h>
|
#include <OgreArchiveFactory.h>
|
||||||
#include <OgreArchiveManager.h>
|
#include <OgreArchiveManager.h>
|
||||||
@ -33,6 +34,29 @@ using namespace Ogre;
|
|||||||
using namespace Mangle::Stream;
|
using namespace Mangle::Stream;
|
||||||
|
|
||||||
/// An OGRE Archive wrapping a BSAFile archive
|
/// An OGRE Archive wrapping a BSAFile archive
|
||||||
|
class DirArchive: public Ogre::FileSystemArchive
|
||||||
|
{
|
||||||
|
//FileSystemArchive* arc;
|
||||||
|
public:
|
||||||
|
|
||||||
|
DirArchive(const String& name)
|
||||||
|
: FileSystemArchive(name, "Dir")
|
||||||
|
{ mType = "Dir";}
|
||||||
|
|
||||||
|
bool isCaseSensitive() const { return false; }
|
||||||
|
|
||||||
|
// The archive is loaded in the constructor, and never unloaded.
|
||||||
|
void load() {}
|
||||||
|
void unload() {}
|
||||||
|
|
||||||
|
DataStreamPtr open(const String& filename, bool readonly = true) const
|
||||||
|
{
|
||||||
|
std::string copy = filename;
|
||||||
|
return FileSystemArchive::open(copy, readonly);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class BSAArchive : public Archive
|
class BSAArchive : public Archive
|
||||||
{
|
{
|
||||||
BSAFile arc;
|
BSAFile arc;
|
||||||
@ -145,8 +169,26 @@ public:
|
|||||||
void destroyInstance( Archive* arch) { delete arch; }
|
void destroyInstance( Archive* arch) { delete arch; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DirArchiveFactory : public FileSystemArchiveFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const String& getType() const
|
||||||
|
{
|
||||||
|
static String name = "Dir";
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
Archive *createInstance( const String& name )
|
||||||
|
{
|
||||||
|
return new DirArchive(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroyInstance( Archive* arch) { delete arch; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static bool init = false;
|
static bool init = false;
|
||||||
|
static bool init2 = false;
|
||||||
static void insertBSAFactory()
|
static void insertBSAFactory()
|
||||||
{
|
{
|
||||||
if(!init)
|
if(!init)
|
||||||
@ -156,6 +198,15 @@ static void insertBSAFactory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void insertDirFactory()
|
||||||
|
{
|
||||||
|
if(!init2)
|
||||||
|
{
|
||||||
|
ArchiveManager::getSingleton().addArchiveFactory( new DirArchiveFactory );
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The function below is the only publicly exposed part of this file
|
// The function below is the only publicly exposed part of this file
|
||||||
|
|
||||||
void addBSA(const std::string& name, const std::string& group)
|
void addBSA(const std::string& name, const std::string& group)
|
||||||
@ -166,6 +217,7 @@ void addBSA(const std::string& name, const std::string& group)
|
|||||||
}
|
}
|
||||||
void addDir(const std::string& name, const std::string& group)
|
void addDir(const std::string& name, const std::string& group)
|
||||||
{
|
{
|
||||||
|
insertDirFactory();
|
||||||
ResourceGroupManager::getSingleton().
|
ResourceGroupManager::getSingleton().
|
||||||
addResourceLocation(name, "FileSystem", group);
|
addResourceLocation(name, "Dir", group);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user