diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e6f05dd2..a35f44fe2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,6 +129,7 @@ Bug #7758: Water walking is not taken into account to compute path cost on the water Bug #7761: Rain and ambient loop sounds are mutually exclusive Bug #7770: Sword of the Perithia: Script execution failure + Bug #7780: Non-ASCII texture paths in NIF files don't work Feature #2566: Handle NAM9 records for manual cell references Feature #3537: Shader-based water ripples Feature #5173: Support for NiFogProperty diff --git a/apps/bulletobjecttool/main.cpp b/apps/bulletobjecttool/main.cpp index 2165f93804..504aef7e67 100644 --- a/apps/bulletobjecttool/main.cpp +++ b/apps/bulletobjecttool/main.cpp @@ -174,7 +174,7 @@ namespace constexpr double expiryDelay = 0; Resource::ImageManager imageManager(&vfs, expiryDelay); - Resource::NifFileManager nifFileManager(&vfs, &encoder); + Resource::NifFileManager nifFileManager(&vfs, &encoder.getStatelessEncoder()); Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay); Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay); diff --git a/apps/navmeshtool/main.cpp b/apps/navmeshtool/main.cpp index a9c30cf23e..9ed7fb4c2e 100644 --- a/apps/navmeshtool/main.cpp +++ b/apps/navmeshtool/main.cpp @@ -221,7 +221,7 @@ namespace NavMeshTool constexpr double expiryDelay = 0; Resource::ImageManager imageManager(&vfs, expiryDelay); - Resource::NifFileManager nifFileManager(&vfs, &encoder); + Resource::NifFileManager nifFileManager(&vfs, &encoder.getStatelessEncoder()); Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay); Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay); DetourNavigator::RecastGlobalAllocator::init(); diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index ef2e289ee2..428ffb2737 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -149,7 +149,8 @@ CSMWorld::Data::Data(ToUTF8::FromType encoding, const Files::PathContainer& data mResourcesManager.setVFS(mVFS.get()); constexpr double expiryDelay = 0; - mResourceSystem = std::make_unique(mVFS.get(), expiryDelay, &mEncoder); + mResourceSystem + = std::make_unique(mVFS.get(), expiryDelay, &mEncoder.getStatelessEncoder()); Shader::ShaderManager::DefineMap defines = mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines(); diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index c2e57208b4..5b8d725583 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -706,8 +706,8 @@ void OMW::Engine::prepareEngine() VFS::registerArchives(mVFS.get(), mFileCollections, mArchives, true); - mResourceSystem - = std::make_unique(mVFS.get(), Settings::cells().mCacheExpiryDelay, mEncoder.get()); + mResourceSystem = std::make_unique( + mVFS.get(), Settings::cells().mCacheExpiryDelay, &mEncoder.get()->getStatelessEncoder()); mResourceSystem->getSceneManager()->getShaderManager().setMaxTextureUnits(mGlMaxTextureImageUnits); mResourceSystem->getSceneManager()->setUnRefImageDataAfterApply( false); // keep to Off for now to allow better state sharing diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 7a38b0dc1a..74c3b391a1 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -24,7 +24,7 @@ namespace Nif { - Reader::Reader(NIFFile& file, const ToUTF8::Utf8Encoder* encoder) + Reader::Reader(NIFFile& file, const ToUTF8::StatelessUtf8Encoder* encoder) : mVersion(file.mVersion) , mUserVersion(file.mUserVersion) , mBethVersion(file.mBethVersion) diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 38b0712373..993e9b7eea 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -13,7 +13,7 @@ namespace ToUTF8 { - class Utf8Encoder; + class StatelessUtf8Encoder; } namespace Nif @@ -117,7 +117,7 @@ namespace Nif std::vector mStrings; bool& mUseSkinning; - const ToUTF8::Utf8Encoder* mEncoder; + const ToUTF8::StatelessUtf8Encoder* mEncoder; static std::atomic_bool sLoadUnsupportedFiles; static std::atomic_bool sWriteNifDebugLog; @@ -128,7 +128,7 @@ namespace Nif public: /// Open a NIF stream. The name is used for error messages. - Reader(NIFFile& file, const ToUTF8::Utf8Encoder* encoder); + explicit Reader(NIFFile& file, const ToUTF8::StatelessUtf8Encoder* encoder); /// Parse the file void parse(Files::IStreamPtr&& stream); diff --git a/components/nif/nifstream.cpp b/components/nif/nifstream.cpp index 93714e37f0..f960e8d972 100644 --- a/components/nif/nifstream.cpp +++ b/components/nif/nifstream.cpp @@ -61,7 +61,7 @@ namespace Nif if (end != std::string::npos) str.erase(end); if (mEncoder) - str = mEncoder->getStatelessEncoder().getUtf8(str, ToUTF8::BufferAllocationPolicy::UseGrowFactor, mBuffer); + str = mEncoder->getUtf8(str, ToUTF8::BufferAllocationPolicy::UseGrowFactor, mBuffer); return str; } diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index 958aef7254..062f7c6512 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -25,7 +25,7 @@ namespace ToUTF8 { - class Utf8Encoder; + class StatelessUtf8Encoder; } namespace Nif @@ -73,11 +73,12 @@ namespace Nif { const Reader& mReader; Files::IStreamPtr mStream; - const ToUTF8::Utf8Encoder* mEncoder; + const ToUTF8::StatelessUtf8Encoder* mEncoder; std::string mBuffer; public: - explicit NIFStream(const Reader& reader, Files::IStreamPtr&& stream, const ToUTF8::Utf8Encoder* encoder) + explicit NIFStream( + const Reader& reader, Files::IStreamPtr&& stream, const ToUTF8::StatelessUtf8Encoder* encoder) : mReader(reader) , mStream(std::move(stream)) , mEncoder(encoder) diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 6895a0238f..d60129cb86 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -207,8 +207,8 @@ namespace Resource namespace Resource { - KeyframeManager::KeyframeManager( - const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay, const ToUTF8::Utf8Encoder* encoder) + KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay, + const ToUTF8::StatelessUtf8Encoder* encoder) : ResourceManager(vfs, expiryDelay) , mSceneManager(sceneManager) , mEncoder(encoder) diff --git a/components/resource/keyframemanager.hpp b/components/resource/keyframemanager.hpp index f684e22ee7..ed8d4a04ab 100644 --- a/components/resource/keyframemanager.hpp +++ b/components/resource/keyframemanager.hpp @@ -11,7 +11,7 @@ namespace ToUTF8 { - class Utf8Encoder; + class StatelessUtf8Encoder; } namespace Resource @@ -54,7 +54,7 @@ namespace Resource { public: explicit KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay, - const ToUTF8::Utf8Encoder* encoder); + const ToUTF8::StatelessUtf8Encoder* encoder); ~KeyframeManager() = default; /// Retrieve a read-only keyframe resource by name (case-insensitive). @@ -65,7 +65,7 @@ namespace Resource private: SceneManager* mSceneManager; - const ToUTF8::Utf8Encoder* mEncoder; + const ToUTF8::StatelessUtf8Encoder* mEncoder; }; } diff --git a/components/resource/niffilemanager.cpp b/components/resource/niffilemanager.cpp index fb57bc8c85..352d367f9b 100644 --- a/components/resource/niffilemanager.cpp +++ b/components/resource/niffilemanager.cpp @@ -31,7 +31,7 @@ namespace Resource Nif::NIFFilePtr mNifFile; }; - NifFileManager::NifFileManager(const VFS::Manager* vfs, const ToUTF8::Utf8Encoder* encoder) + NifFileManager::NifFileManager(const VFS::Manager* vfs, const ToUTF8::StatelessUtf8Encoder* encoder) // NIF files aren't needed any more once the converted objects are cached in SceneManager / BulletShapeManager, // so no point in using an expiry delay. : ResourceManager(vfs, 0) diff --git a/components/resource/niffilemanager.hpp b/components/resource/niffilemanager.hpp index 2225a9fd4c..dab4b70748 100644 --- a/components/resource/niffilemanager.hpp +++ b/components/resource/niffilemanager.hpp @@ -7,7 +7,7 @@ namespace ToUTF8 { - class Utf8Encoder; + class StatelessUtf8Encoder; } namespace Resource @@ -17,10 +17,10 @@ namespace Resource /// @note May be used from any thread. class NifFileManager : public ResourceManager { - const ToUTF8::Utf8Encoder* mEncoder; + const ToUTF8::StatelessUtf8Encoder* mEncoder; public: - NifFileManager(const VFS::Manager* vfs, const ToUTF8::Utf8Encoder* encoder); + NifFileManager(const VFS::Manager* vfs, const ToUTF8::StatelessUtf8Encoder* encoder); ~NifFileManager(); /// Retrieve a NIF file from the cache, or load it from the VFS if not cached yet. diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 7d704e7d1e..65a83a60ab 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -10,7 +10,8 @@ namespace Resource { - ResourceSystem::ResourceSystem(const VFS::Manager* vfs, double expiryDelay, const ToUTF8::Utf8Encoder* encoder) + ResourceSystem::ResourceSystem( + const VFS::Manager* vfs, double expiryDelay, const ToUTF8::StatelessUtf8Encoder* encoder) : mVFS(vfs) { mNifFileManager = std::make_unique(vfs, encoder); diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index 554083852e..f7f09b9277 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -17,7 +17,7 @@ namespace osg namespace ToUTF8 { - class Utf8Encoder; + class StatelessUtf8Encoder; } namespace Resource @@ -35,7 +35,8 @@ namespace Resource class ResourceSystem { public: - explicit ResourceSystem(const VFS::Manager* vfs, double expiryDelay, const ToUTF8::Utf8Encoder* encoder); + explicit ResourceSystem( + const VFS::Manager* vfs, double expiryDelay, const ToUTF8::StatelessUtf8Encoder* encoder); ~ResourceSystem(); SceneManager* getSceneManager(); diff --git a/components/to_utf8/to_utf8.hpp b/components/to_utf8/to_utf8.hpp index 11a466e44c..80af6586c9 100644 --- a/components/to_utf8/to_utf8.hpp +++ b/components/to_utf8/to_utf8.hpp @@ -68,7 +68,7 @@ namespace ToUTF8 /// ASCII-only string. Otherwise returns a view to the input. std::string_view getLegacyEnc(std::string_view input); - StatelessUtf8Encoder getStatelessEncoder() const { return mImpl; } + const StatelessUtf8Encoder& getStatelessEncoder() const { return mImpl; } private: std::string mBuffer;