Skip to content

Commit

Permalink
Drop support for --fs-strict
Browse files Browse the repository at this point in the history
  • Loading branch information
Assumeru committed Jun 8, 2023
1 parent 75c371d commit eeda48e
Show file tree
Hide file tree
Showing 46 changed files with 147 additions and 255 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
Task #7113: Move from std::atoi to std::from_char
Task #7117: Replace boost::scoped_array with std::vector
Task #7151: Do not use std::strerror to get errno error message
Task #7394: Drop support for --fs-strict

0.48.0
------
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ Command line options
--skip-menu [=arg(=1)] (=0) skip main menu on game startup
--new-game [=arg(=1)] (=0) run new game sequence (ignored if
skip-menu=0)
--fs-strict [=arg(=1)] (=0) strict file system handling (no case
folding)
--encoding arg (=win1252) Character encoding used in OpenMW game
messages:

Expand Down
8 changes: 2 additions & 6 deletions apps/bulletobjecttool/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 2 additions & 6 deletions apps/navmeshtool/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down Expand Up @@ -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>();
Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions apps/niftest/niftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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));
Expand Down
5 changes: 1 addition & 4 deletions apps/opencs/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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())
{
Expand Down
1 change: 0 additions & 1 deletion apps/opencs/editor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions apps/opencs/model/doc/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/model/doc/document.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions apps/opencs/model/doc/documentmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
3 changes: 1 addition & 2 deletions apps/opencs/model/doc/documentmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace CSMDoc

std::filesystem::path mResDir;

bool mFsStrict;
Files::PathContainer mDataPaths;
std::vector<std::string> mArchives;

Expand Down Expand Up @@ -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();

Expand Down
9 changes: 4 additions & 5 deletions apps/opencs/model/world/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,19 @@ 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)
, mRefs(mCells)
, 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());
Expand Down Expand Up @@ -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 };
Expand Down
5 changes: 2 additions & 3 deletions apps/opencs/model/world/data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
10 changes: 2 additions & 8 deletions apps/openmw/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mActivationDistanceOverride(-1)
, mGrab(true)
, mRandomSeed(0)
, mFSStrict(false)
, mScriptBlacklistUse(true)
, mNewGame(false)
, mCfgMgr(configurationManager)
Expand Down Expand Up @@ -418,18 +417,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
Expand Down Expand Up @@ -658,7 +652,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);

Expand Down
7 changes: 0 additions & 7 deletions apps/openmw/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down
3 changes: 0 additions & 3 deletions apps/openmw/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 0 additions & 1 deletion apps/openmw/mwlua/luamanagerimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions apps/openmw/mwsound/sound_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions apps/openmw/mwsound/sound_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit eeda48e

Please sign in to comment.