Merge branch 'fastandloose' into 'master'

Drop support for --fs-strict

Closes #7394

See merge request OpenMW/openmw!3093
This commit is contained in:
psi29a 2023-07-02 19:24:14 +00:00
commit 6601b0cb15
47 changed files with 161 additions and 258 deletions

View file

@ -83,9 +83,6 @@ namespace
addOption("content", bpo::value<StringsVector>()->default_value(StringsVector(), "")->multitoken()->composing(),
"content file(s): esm/esp, or omwgame/omwaddon/omwscripts");
addOption("fs-strict", bpo::value<bool>()->implicit_value(true)->default_value(false),
"strict file system handling (no case folding)");
addOption("encoding", bpo::value<std::string>()->default_value("win1252"),
"Character encoding used in OpenMW game messages:\n"
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, "
@ -148,18 +145,17 @@ namespace
config.filterOutNonExistingPaths(dataDirs);
const auto fsStrict = variables["fs-strict"].as<bool>();
const auto resDir = variables["resources"].as<Files::MaybeQuotedPath>();
const auto v = Version::getOpenmwVersion(resDir);
Log(Debug::Info) << v.describe();
dataDirs.insert(dataDirs.begin(), resDir / "vfs");
const auto fileCollections = Files::Collections(dataDirs, !fsStrict);
const auto fileCollections = Files::Collections(dataDirs);
const auto archives = variables["fallback-archive"].as<StringsVector>();
const auto contentFiles = variables["content"].as<StringsVector>();
Fallback::Map::init(variables["fallback"].as<Fallback::FallbackMap>().mMap);
VFS::Manager vfs(fsStrict);
VFS::Manager vfs;
VFS::registerArchives(&vfs, fileCollections, archives, true);

View file

@ -96,9 +96,6 @@ namespace NavMeshTool
bpo::value<StringsVector>()->default_value(StringsVector(), "")->multitoken()->composing(),
"content file(s): esm/esp, or omwgame/omwaddon/omwscripts");
addOption("fs-strict", bpo::value<bool>()->implicit_value(true)->default_value(false),
"strict file system handling (no case folding)");
addOption("encoding", bpo::value<std::string>()->default_value("win1252"),
"Character encoding used in OpenMW game messages:\n"
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, "
@ -167,12 +164,11 @@ namespace NavMeshTool
config.filterOutNonExistingPaths(dataDirs);
const auto fsStrict = variables["fs-strict"].as<bool>();
const auto resDir = variables["resources"].as<Files::MaybeQuotedPath>();
Version::Version v = Version::getOpenmwVersion(resDir);
Log(Debug::Info) << v.describe();
dataDirs.insert(dataDirs.begin(), resDir / "vfs");
const auto fileCollections = Files::Collections(dataDirs, !fsStrict);
const auto fileCollections = Files::Collections(dataDirs);
const auto archives = variables["fallback-archive"].as<StringsVector>();
const auto contentFiles = variables["content"].as<StringsVector>();
const std::size_t threadsNumber = variables["threads"].as<std::size_t>();
@ -194,7 +190,7 @@ namespace NavMeshTool
Fallback::Map::init(variables["fallback"].as<Fallback::FallbackMap>().mMap);
VFS::Manager vfs(fsStrict);
VFS::Manager vfs;
VFS::registerArchives(&vfs, fileCollections, archives, true);

View file

@ -79,7 +79,7 @@ void readVFS(std::unique_ptr<VFS::Archive>&& anArchive, const std::filesystem::p
if (anArchive == nullptr)
return;
VFS::Manager myManager(true);
VFS::Manager myManager;
myManager.addArchive(std::move(anArchive));
myManager.buildIndex();
@ -176,7 +176,7 @@ int main(int argc, char** argv)
std::unique_ptr<VFS::Manager> vfs;
if (!archives.empty())
{
vfs = std::make_unique<VFS::Manager>(true);
vfs = std::make_unique<VFS::Manager>();
for (const std::filesystem::path& path : archives)
if (auto archive = makeArchive(path))
vfs->addArchive(std::move(archive));

View file

@ -62,7 +62,7 @@ CS::Editor::Editor(int argc, char** argv)
NifOsg::Loader::setShowMarkers(true);
mDocumentManager.setFileData(mFsStrict, config.first, config.second);
mDocumentManager.setFileData(config.first, config.second);
mNewGame.setLocalData(mLocal);
mFileDialog.setLocalData(mLocal);
@ -118,7 +118,6 @@ boost::program_options::variables_map CS::Editor::readConfiguration()
addOption("data-local",
boost::program_options::value<Files::MaybeQuotedPathContainer::value_type>()->default_value(
Files::MaybeQuotedPathContainer::value_type(), ""));
addOption("fs-strict", boost::program_options::value<bool>()->implicit_value(true)->default_value(false));
addOption("encoding", boost::program_options::value<std::string>()->default_value("win1252"));
addOption("resources",
boost::program_options::value<Files::MaybeQuotedPath>()->default_value(Files::MaybeQuotedPath(), "resources"));
@ -165,8 +164,6 @@ std::pair<Files::PathContainer, std::vector<std::string>> CS::Editor::readConfig
if (variables["script-blacklist-use"].as<bool>())
mDocumentManager.setBlacklistedScripts(variables["script-blacklist"].as<std::vector<std::string>>());
mFsStrict = variables["fs-strict"].as<bool>();
Files::PathContainer dataDirs, dataLocal;
if (!variables["data"].empty())
{

View file

@ -60,7 +60,6 @@ namespace CS
std::filesystem::path mPid;
QLockFile mLockFile;
std::ofstream mPidFile;
bool mFsStrict;
CSVTools::Merge mMerge;
CSVDoc::ViewManager* mViewManager;
std::filesystem::path mFileToLoad;

View file

@ -296,12 +296,12 @@ void CSMDoc::Document::createBase()
CSMDoc::Document::Document(const Files::ConfigurationManager& configuration, std::vector<std::filesystem::path> files,
bool new_, const std::filesystem::path& savePath, const std::filesystem::path& resDir, ToUTF8::FromType encoding,
const std::vector<std::string>& blacklistedScripts, bool fsStrict, const Files::PathContainer& dataPaths,
const std::vector<std::string>& blacklistedScripts, const Files::PathContainer& dataPaths,
const std::vector<std::string>& archives)
: mSavePath(savePath)
, mContentFiles(std::move(files))
, mNew(new_)
, mData(encoding, fsStrict, dataPaths, archives, resDir)
, mData(encoding, dataPaths, archives, resDir)
, mTools(*this, encoding)
, mProjectPath((configuration.getUserDataPath() / "projects") / (savePath.filename().u8string() + u8".project"))
, mSavingOperation(*this, mProjectPath, encoding)

View file

@ -95,7 +95,7 @@ namespace CSMDoc
public:
Document(const Files::ConfigurationManager& configuration, std::vector<std::filesystem::path> files, bool new_,
const std::filesystem::path& savePath, const std::filesystem::path& resDir, ToUTF8::FromType encoding,
const std::vector<std::string>& blacklistedScripts, bool fsStrict, const Files::PathContainer& dataPaths,
const std::vector<std::string>& blacklistedScripts, const Files::PathContainer& dataPaths,
const std::vector<std::string>& archives);
~Document() override = default;

View file

@ -17,7 +17,6 @@
CSMDoc::DocumentManager::DocumentManager(const Files::ConfigurationManager& configuration)
: mConfiguration(configuration)
, mEncoding(ToUTF8::WINDOWS_1252)
, mFsStrict(false)
{
std::filesystem::path projectPath = configuration.getUserDataPath() / "projects";
@ -62,8 +61,8 @@ void CSMDoc::DocumentManager::addDocument(
CSMDoc::Document* CSMDoc::DocumentManager::makeDocument(
const std::vector<std::filesystem::path>& files, const std::filesystem::path& savePath, bool new_)
{
return new Document(mConfiguration, files, new_, savePath, mResDir, mEncoding, mBlacklistedScripts, mFsStrict,
mDataPaths, mArchives);
return new Document(
mConfiguration, files, new_, savePath, mResDir, mEncoding, mBlacklistedScripts, mDataPaths, mArchives);
}
void CSMDoc::DocumentManager::insertDocument(CSMDoc::Document* document)
@ -123,9 +122,8 @@ void CSMDoc::DocumentManager::documentNotLoaded(Document* document, const std::s
}
void CSMDoc::DocumentManager::setFileData(
bool strict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives)
const Files::PathContainer& dataPaths, const std::vector<std::string>& archives)
{
mFsStrict = strict;
mDataPaths = dataPaths;
mArchives = archives;
}

View file

@ -35,7 +35,6 @@ namespace CSMDoc
std::filesystem::path mResDir;
bool mFsStrict;
Files::PathContainer mDataPaths;
std::vector<std::string> mArchives;
@ -68,7 +67,7 @@ namespace CSMDoc
void setBlacklistedScripts(const std::vector<std::string>& scriptIds);
/// Sets the file data that gets passed to newly created documents.
void setFileData(bool strict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives);
void setFileData(const Files::PathContainer& dataPaths, const std::vector<std::string>& archives);
bool isEmpty();

View file

@ -132,7 +132,7 @@ int CSMWorld::Data::count(RecordBase::State state, const CollectionBase& collect
return number;
}
CSMWorld::Data::Data(ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths,
CSMWorld::Data::Data(ToUTF8::FromType encoding, const Files::PathContainer& dataPaths,
const std::vector<std::string>& archives, const std::filesystem::path& resDir)
: mEncoder(encoding)
, mPathgrids(mCells)
@ -140,12 +140,11 @@ CSMWorld::Data::Data(ToUTF8::FromType encoding, bool fsStrict, const Files::Path
, mReader(nullptr)
, mDialogue(nullptr)
, mReaderIndex(1)
, mFsStrict(fsStrict)
, mDataPaths(dataPaths)
, mArchives(archives)
{
mVFS = std::make_unique<VFS::Manager>(mFsStrict);
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true);
mVFS = std::make_unique<VFS::Manager>();
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths), mArchives, true);
mResourcesManager.setVFS(mVFS.get());
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get());
@ -1444,7 +1443,7 @@ std::vector<ESM::RefId> CSMWorld::Data::getIds(bool listDeleted) const
void CSMWorld::Data::assetsChanged()
{
mVFS.get()->reset();
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true);
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths), mArchives, true);
const UniversalId assetTableIds[] = { UniversalId::Type_Meshes, UniversalId::Type_Icons, UniversalId::Type_Musics,
UniversalId::Type_SoundsRes, UniversalId::Type_Textures, UniversalId::Type_Videos };

View file

@ -127,7 +127,6 @@ namespace CSMWorld
std::map<ESM::RefId, std::map<unsigned int, unsigned int>> mRefLoadCache;
int mReaderIndex;
bool mFsStrict;
Files::PathContainer mDataPaths;
std::vector<std::string> mArchives;
std::unique_ptr<VFS::Manager> mVFS;
@ -153,8 +152,8 @@ namespace CSMWorld
void loadFallbackEntries();
public:
Data(ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths,
const std::vector<std::string>& archives, const std::filesystem::path& resDir);
Data(ToUTF8::FromType encoding, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives,
const std::filesystem::path& resDir);
~Data() override;

View file

@ -345,7 +345,6 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mActivationDistanceOverride(-1)
, mGrab(true)
, mRandomSeed(0)
, mFSStrict(false)
, mScriptBlacklistUse(true)
, mNewGame(false)
, mCfgMgr(configurationManager)
@ -404,18 +403,13 @@ OMW::Engine::~Engine()
SDL_Quit();
}
void OMW::Engine::enableFSStrict(bool fsStrict)
{
mFSStrict = fsStrict;
}
// Set data dir
void OMW::Engine::setDataDirs(const Files::PathContainer& dataDirs)
{
mDataDirs = dataDirs;
mDataDirs.insert(mDataDirs.begin(), mResDir / "vfs");
mFileCollections = Files::Collections(mDataDirs, !mFSStrict);
mFileCollections = Files::Collections(mDataDirs);
}
// Add BSA archive
@ -643,7 +637,7 @@ void OMW::Engine::prepareEngine()
createWindow();
mVFS = std::make_unique<VFS::Manager>(mFSStrict);
mVFS = std::make_unique<VFS::Manager>();
VFS::registerArchives(mVFS.get(), mFileCollections, mArchives, true);

View file

@ -177,7 +177,6 @@ namespace OMW
std::unique_ptr<Compiler::Context> mScriptContext;
Files::Collections mFileCollections;
bool mFSStrict;
Translation::Storage mTranslationDataStorage;
std::vector<ESM::RefId> mScriptBlacklist;
bool mScriptBlacklistUse;
@ -201,12 +200,6 @@ namespace OMW
Engine(Files::ConfigurationManager& configurationManager);
virtual ~Engine();
/// Enable strict filesystem mode (do not fold case)
///
/// \attention The strict mode must be specified before any path-related settings
/// are given to the engine.
void enableFSStrict(bool fsStrict);
/// Set data dirs
void setDataDirs(const Files::PathContainer& dataDirs);

View file

@ -91,9 +91,6 @@ bool parseOptions(int argc, char** argv, OMW::Engine& engine, Files::Configurati
Log(Debug::Info) << ToUTF8::encodingUsingMessage(encoding);
engine.setEncoding(ToUTF8::calculateEncoding(encoding));
// directory settings
engine.enableFSStrict(variables["fs-strict"].as<bool>());
Files::PathContainer dataDirs(asPathContainer(variables["data"].as<Files::MaybeQuotedPathContainer>()));
Files::PathContainer::value_type local(variables["data-local"]

View file

@ -48,7 +48,6 @@ namespace MWLua
LuaManager::LuaManager(const VFS::Manager* vfs, const std::filesystem::path& libsDir)
: mLua(vfs, &mConfiguration, createLuaStateSettings())
, mUiResourceManager(vfs)
{
Log(Debug::Info) << "Lua version: " << LuaUtil::getLuaVersion();
mLua.addInternalLibSearchPath(libsDir);

View file

@ -7,7 +7,7 @@
#include <components/debug/debuglog.hpp>
#include <components/esm3/loadsoun.hpp>
#include <components/settings/settings.hpp>
#include <components/vfs/manager.hpp>
#include <components/vfs/pathutil.hpp>
#include <algorithm>
#include <cmath>
@ -35,9 +35,8 @@ namespace MWSound
}
}
SoundBufferPool::SoundBufferPool(const VFS::Manager& vfs, Sound_Output& output)
: mVfs(&vfs)
, mOutput(&output)
SoundBufferPool::SoundBufferPool(Sound_Output& output)
: mOutput(&output)
, mBufferCacheMax(std::max(Settings::Manager::getInt("buffer cache max", "Sound"), 1) * 1024 * 1024)
, mBufferCacheMin(
std::min(static_cast<std::size_t>(std::max(Settings::Manager::getInt("buffer cache min", "Sound"), 1))
@ -135,7 +134,7 @@ namespace MWSound
max = std::max(min, max);
Sound_Buffer& sfx = mSoundBuffers.emplace_back("Sound/" + sound.mSound, volume, min, max);
sfx.mResourceName = mVfs->normalizeFilename(sfx.mResourceName);
VFS::Path::normalizeFilenameInPlace(sfx.mResourceName);
mBufferNameMap.emplace(soundId, &sfx);
return &sfx;

View file

@ -59,7 +59,7 @@ namespace MWSound
class SoundBufferPool
{
public:
SoundBufferPool(const VFS::Manager& vfs, Sound_Output& output);
SoundBufferPool(Sound_Output& output);
SoundBufferPool(const SoundBufferPool&) = delete;
@ -92,7 +92,6 @@ namespace MWSound
void clear();
private:
const VFS::Manager* const mVfs;
Sound_Output* mOutput;
std::deque<Sound_Buffer> mSoundBuffers;
std::unordered_map<ESM::RefId, Sound_Buffer*> mBufferNameMap;

View file

@ -81,7 +81,7 @@ namespace MWSound
: mVFS(vfs)
, mOutput(std::make_unique<OpenAL_Output>(*this))
, mWaterSoundUpdater(makeWaterSoundUpdaterSettings())
, mSoundBuffers(*vfs, *mOutput)
, mSoundBuffers(*mOutput)
, mListenerUnderwater(false)
, mListenerPos(0, 0, 0)
, mListenerDir(1, 0, 0)
@ -357,7 +357,7 @@ namespace MWSound
if (!mOutput->isInitialized())
return;
DecoderPtr decoder = loadVoice(mVFS->normalizeFilename("Sound/" + filename));
DecoderPtr decoder = loadVoice("Sound/" + filename);
if (!decoder)
return;
@ -389,7 +389,7 @@ namespace MWSound
if (!mOutput->isInitialized())
return;
DecoderPtr decoder = loadVoice(mVFS->normalizeFilename("Sound/" + filename));
DecoderPtr decoder = loadVoice("Sound/" + filename);
if (!decoder)
return;

View file

@ -85,9 +85,6 @@ namespace OpenMW
addOption("new-game", bpo::value<bool>()->implicit_value(true)->default_value(false),
"run new game sequence (ignored if skip-menu=0)");
addOption("fs-strict", bpo::value<bool>()->implicit_value(true)->default_value(false),
"strict file system handling (no case folding)");
addOption("encoding", bpo::value<std::string>()->default_value("win1252"),
"Character encoding used in OpenMW game messages:\n"
"\n\twin1250 - Central and Eastern European such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, "

View file

@ -40,7 +40,7 @@ namespace
static constexpr std::size_t sInitialOffset = 324;
static constexpr std::size_t sSkip = 100;
const Files::PathContainer mDataDirs{ { std::filesystem::path{ OPENMW_DATA_DIR } } };
const Files::Collections mFileCollections{ mDataDirs, true };
const Files::Collections mFileCollections{ mDataDirs };
const std::string mContentFile = "template.omwgame";
const std::filesystem::path mContentFilePath = mFileCollections.getCollection(".omwgame").getPath(mContentFile);
};

View file

@ -26,7 +26,7 @@ namespace
struct EsmLoaderTest : Test
{
const Files::PathContainer mDataDirs{ { std::filesystem::path{ OPENMW_DATA_DIR } } };
const Files::Collections mFileCollections{ mDataDirs, true };
const Files::Collections mFileCollections{ mDataDirs };
const std::vector<std::string> mContentFiles{ { "template.omwgame" } };
};

View file

@ -27,7 +27,7 @@ namespace
{
std::unique_ptr<VFS::Manager> mVFS = TestingOpenMW::createTestVFS({});
EXPECT_EQ(correctSoundPath("sound\\foo.wav", mVFS.get()), "sound/foo.mp3");
EXPECT_EQ(correctSoundPath("SOUND\\foo.WAV", mVFS.get()), "SOUND/foo.mp3");
EXPECT_EQ(correctSoundPath("SOUND\\foo.WAV", mVFS.get()), "sound/foo.mp3");
}
namespace

View file

@ -114,7 +114,7 @@ protected:
if (!dataLocal.empty())
dataDirs.insert(dataDirs.end(), dataLocal.begin(), dataLocal.end());
Files::Collections collections(dataDirs, true);
Files::Collections collections(dataDirs);
std::vector<std::string> contentFiles = variables["content"].as<std::vector<std::string>>();
for (auto& contentFile : contentFiles)

View file

@ -27,7 +27,7 @@ namespace
struct BaseNifOsgLoaderTest
{
VFS::Manager mVfs{ false };
VFS::Manager mVfs;
Resource::ImageManager mImageManager{ &mVfs };
const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
osg::ref_ptr<osgDB::Options> mOptions = new osgDB::Options;

View file

@ -7,6 +7,7 @@
#include <components/misc/strings/conversion.hpp>
#include <components/vfs/archive.hpp>
#include <components/vfs/manager.hpp>
#include <components/vfs/pathutil.hpp>
namespace TestingOpenMW
{
@ -49,29 +50,27 @@ namespace TestingOpenMW
struct VFSTestData : public VFS::Archive
{
std::map<std::string, VFS::File*> mFiles;
std::map<std::string, VFS::File*, VFS::Path::PathLess> mFiles;
VFSTestData(std::map<std::string, VFS::File*> files)
VFSTestData(std::map<std::string, VFS::File*, VFS::Path::PathLess> files)
: mFiles(std::move(files))
{
}
void listResources(std::map<std::string, VFS::File*>& out, char (*normalize_function)(char)) override
void listResources(std::map<std::string, VFS::File*>& out) override
{
out = mFiles;
for (const auto& [key, value] : mFiles)
out.emplace(VFS::Path::normalizeFilename(key), value);
}
bool contains(const std::string& file, char (*normalize_function)(char)) const override
{
return mFiles.count(file) != 0;
}
bool contains(const std::string& file) const override { return mFiles.count(file) != 0; }
std::string getDescription() const override { return "TestData"; }
};
inline std::unique_ptr<VFS::Manager> createTestVFS(std::map<std::string, VFS::File*> files)
inline std::unique_ptr<VFS::Manager> createTestVFS(std::map<std::string, VFS::File*, VFS::Path::PathLess> files)
{
auto vfs = std::make_unique<VFS::Manager>(true);
auto vfs = std::make_unique<VFS::Manager>();
vfs->addArchive(std::make_unique<VFSTestData>(std::move(files)));
vfs->buildIndex();
return vfs;