From 2d6675db0b3480b549acab5ff2d1d891971cc505 Mon Sep 17 00:00:00 2001 From: Almamu Date: Thu, 11 Sep 2025 17:10:23 +0200 Subject: [PATCH] refactor: overhaul the filesystem layer --- CMakeLists.txt | 35 +++-- .../Application/CWallpaperApplication.cpp | 61 ++++---- .../Application/CWallpaperApplication.h | 2 - .../Assets/CAssetLoadException.h | 1 + .../Assets/CCombinedContainer.cpp | 57 -------- .../Assets/CCombinedContainer.h | 37 ----- src/WallpaperEngine/Assets/CContainer.cpp | 88 ------------ src/WallpaperEngine/Assets/CContainer.h | 93 ------------ src/WallpaperEngine/Assets/CDirectory.cpp | 85 ----------- src/WallpaperEngine/Assets/CDirectory.h | 26 ---- src/WallpaperEngine/Assets/CFileEntry.h | 22 --- src/WallpaperEngine/Assets/CPackage.cpp | 135 ------------------ src/WallpaperEngine/Assets/CPackage.h | 68 --------- .../Assets/CPackageLoadException.cpp | 10 -- .../Assets/CPackageLoadException.h | 15 -- .../Assets/CVirtualContainer.cpp | 42 ------ .../Assets/CVirtualContainer.h | 57 -------- src/WallpaperEngine/Audio/CAudioStream.cpp | 31 ++-- src/WallpaperEngine/Audio/CAudioStream.h | 20 +-- src/WallpaperEngine/Data/Assets/Package.h | 23 +++ src/WallpaperEngine/Data/Assets/Types.h | 5 + src/WallpaperEngine/Data/Model/Effect.h | 1 + src/WallpaperEngine/Data/Model/Project.h | 2 +- src/WallpaperEngine/Data/Model/Types.h | 13 +- .../Data/Parsers/EffectParser.cpp | 5 +- .../Data/Parsers/MaterialParser.cpp | 3 +- .../Data/Parsers/ModelParser.cpp | 5 +- .../Data/Parsers/PackageParser.cpp | 48 +++++++ .../Data/Parsers/PackageParser.h | 17 +++ .../Data/Parsers/ProjectParser.cpp | 1 + .../Data/Parsers/TextureParser.cpp | 8 +- .../Data/Parsers/WallpaperParser.cpp | 3 +- .../Data/Utils/BinaryReader.cpp | 37 +++-- src/WallpaperEngine/Data/Utils/BinaryReader.h | 25 ++-- src/WallpaperEngine/Data/Utils/MemoryStream.h | 16 ++- .../FileSystem/Adapters/Directory.cpp | 87 +++++++++++ .../FileSystem/Adapters/Directory.h | 25 ++++ .../FileSystem/Adapters/Package.cpp | 64 +++++++++ .../FileSystem/Adapters/Package.h | 29 ++++ .../FileSystem/Adapters/Types.h | 28 ++++ .../FileSystem/Adapters/Virtual.cpp | 59 ++++++++ .../FileSystem/Adapters/Virtual.h | 32 +++++ src/WallpaperEngine/FileSystem/Container.cpp | 126 ++++++++++++++++ src/WallpaperEngine/FileSystem/Container.h | 70 +++++++++ src/WallpaperEngine/Render/CObject.cpp | 2 +- src/WallpaperEngine/Render/CObject.h | 2 +- src/WallpaperEngine/Render/CTextureCache.cpp | 16 ++- src/WallpaperEngine/Render/CWallpaper.cpp | 2 +- src/WallpaperEngine/Render/CWallpaper.h | 4 +- src/WallpaperEngine/Render/Objects/CSound.cpp | 8 +- src/WallpaperEngine/Render/Objects/CSound.h | 1 - .../Render/Shaders/CShader.cpp | 49 ++++++- src/WallpaperEngine/Render/Shaders/CShader.h | 3 +- .../Render/Shaders/CShaderUnit.cpp | 9 +- .../Render/Shaders/CShaderUnit.h | 7 +- .../Render/Wallpapers/CVideo.cpp | 2 +- .../WebBrowser/CEF/CWPSchemeHandler.cpp | 25 ++-- .../WebBrowser/CEF/CWPSchemeHandler.h | 17 +-- 58 files changed, 859 insertions(+), 905 deletions(-) delete mode 100644 src/WallpaperEngine/Assets/CCombinedContainer.cpp delete mode 100644 src/WallpaperEngine/Assets/CCombinedContainer.h delete mode 100644 src/WallpaperEngine/Assets/CContainer.cpp delete mode 100644 src/WallpaperEngine/Assets/CContainer.h delete mode 100644 src/WallpaperEngine/Assets/CDirectory.cpp delete mode 100644 src/WallpaperEngine/Assets/CDirectory.h delete mode 100644 src/WallpaperEngine/Assets/CFileEntry.h delete mode 100644 src/WallpaperEngine/Assets/CPackage.cpp delete mode 100644 src/WallpaperEngine/Assets/CPackage.h delete mode 100644 src/WallpaperEngine/Assets/CPackageLoadException.cpp delete mode 100644 src/WallpaperEngine/Assets/CPackageLoadException.h delete mode 100644 src/WallpaperEngine/Assets/CVirtualContainer.cpp delete mode 100644 src/WallpaperEngine/Assets/CVirtualContainer.h create mode 100644 src/WallpaperEngine/Data/Assets/Package.h create mode 100644 src/WallpaperEngine/Data/Parsers/PackageParser.cpp create mode 100644 src/WallpaperEngine/Data/Parsers/PackageParser.h create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Directory.cpp create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Directory.h create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Package.cpp create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Package.h create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Types.h create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp create mode 100644 src/WallpaperEngine/FileSystem/Adapters/Virtual.h create mode 100644 src/WallpaperEngine/FileSystem/Container.cpp create mode 100644 src/WallpaperEngine/FileSystem/Container.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fefd5c..c1b7755 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,23 +267,21 @@ add_executable( src/WallpaperEngine/Application/CWallpaperApplication.cpp src/WallpaperEngine/Application/CWallpaperApplication.h - src/WallpaperEngine/Assets/CPackageLoadException.cpp - src/WallpaperEngine/Assets/CPackageLoadException.h - src/WallpaperEngine/Assets/CAssetLoadException.cpp - src/WallpaperEngine/Assets/CAssetLoadException.h - src/WallpaperEngine/Assets/CContainer.h - src/WallpaperEngine/Assets/CContainer.cpp - src/WallpaperEngine/Assets/CVirtualContainer.h - src/WallpaperEngine/Assets/CVirtualContainer.cpp - src/WallpaperEngine/Assets/CCombinedContainer.h - src/WallpaperEngine/Assets/CCombinedContainer.cpp - src/WallpaperEngine/Assets/CDirectory.h - src/WallpaperEngine/Assets/CDirectory.cpp - src/WallpaperEngine/Assets/CPackage.h - src/WallpaperEngine/Assets/CPackage.cpp src/WallpaperEngine/Assets/ITexture.h src/WallpaperEngine/Assets/CTexture.h src/WallpaperEngine/Assets/CTexture.cpp + src/WallpaperEngine/Assets/CAssetLoadException.cpp + src/WallpaperEngine/Assets/CAssetLoadException.h + + src/WallpaperEngine/FileSystem/Container.h + src/WallpaperEngine/FileSystem/Container.cpp + src/WallpaperEngine/FileSystem/Adapters/Types.h + src/WallpaperEngine/FileSystem/Adapters/Directory.cpp + src/WallpaperEngine/FileSystem/Adapters/Directory.h + src/WallpaperEngine/FileSystem/Adapters/Package.cpp + src/WallpaperEngine/FileSystem/Adapters/Package.h + src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp + src/WallpaperEngine/FileSystem/Adapters/Virtual.h src/WallpaperEngine/Audio/Drivers/Recorders/CPulseAudioPlaybackRecorder.cpp src/WallpaperEngine/Audio/Drivers/Recorders/CPulseAudioPlaybackRecorder.h @@ -404,6 +402,7 @@ add_executable( src/WallpaperEngine/Data/Assets/Types.h src/WallpaperEngine/Data/Assets/Texture.h + src/WallpaperEngine/Data/Assets/Package.h src/WallpaperEngine/Data/Model/Types.h src/WallpaperEngine/Data/Model/Project.h src/WallpaperEngine/Data/Model/Wallpaper.h @@ -437,6 +436,8 @@ add_executable( src/WallpaperEngine/Data/Parsers/ModelParser.h src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h + src/WallpaperEngine/Data/Parsers/PackageParser.cpp + src/WallpaperEngine/Data/Parsers/PackageParser.h src/WallpaperEngine/Data/Parsers/PropertyParser.cpp src/WallpaperEngine/Data/Parsers/PropertyParser.h src/WallpaperEngine/Data/Parsers/TextureParser.cpp @@ -450,7 +451,11 @@ add_executable( ${WAYLAND_SOURCES} ${X11_SOURCES} - ${DEMOMODE_SOURCES}) + ${DEMOMODE_SOURCES} + src/WallpaperEngine/FileSystem/Adapters/Package.h + src/WallpaperEngine/FileSystem/Adapters/Package.cpp + src/WallpaperEngine/FileSystem/Adapters/Virtual.h + src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp) target_link_libraries (linux-wallpaperengine PUBLIC ${OPENGL_LIBRARIES} diff --git a/src/WallpaperEngine/Application/CWallpaperApplication.cpp b/src/WallpaperEngine/Application/CWallpaperApplication.cpp index 74722ba..190168d 100644 --- a/src/WallpaperEngine/Application/CWallpaperApplication.cpp +++ b/src/WallpaperEngine/Application/CWallpaperApplication.cpp @@ -3,9 +3,8 @@ #include "Steam/FileSystem/FileSystem.h" #include "WallpaperEngine/Application/CApplicationState.h" #include "WallpaperEngine/Assets/CAssetLoadException.h" -#include "WallpaperEngine/Assets/CDirectory.h" -#include "WallpaperEngine/Assets/CVirtualContainer.h" #include "WallpaperEngine/Audio/Drivers/Detectors/CPulseAudioPlayingDetector.h" +#include "WallpaperEngine/FileSystem/Container.h" #include "WallpaperEngine/Logging/CLog.h" #include "WallpaperEngine/Render/CRenderContext.h" #include "WallpaperEngine/Render/Drivers/CVideoFactories.h" @@ -32,6 +31,7 @@ float g_Daytime; using namespace WallpaperEngine::Application; using namespace WallpaperEngine::Data::Model; +using namespace WallpaperEngine::FileSystem; CWallpaperApplication::CWallpaperApplication (CApplicationContext& context) : m_context (context) { @@ -41,21 +41,30 @@ CWallpaperApplication::CWallpaperApplication (CApplicationContext& context) : } ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) const { - auto container = std::make_unique (); - const std::filesystem::path basepath = bg; + auto container = std::make_unique (); - container->add (std::make_unique (basepath)); - container->addPkg (basepath / "scene.pkg"); - container->addPkg (basepath / "gifscene.pkg"); + std::filesystem::path path (bg); + + container->mount (path, "/"); + try { + container->mount (path / "scene.pkg", "/"); + } catch (std::runtime_error&) { + + } try { - container->add (std::make_unique (this->m_context.settings.general.assets)); - } catch (CAssetLoadException&) { + container->mount (path / "gifscene.pkg", "/"); + } catch (std::runtime_error&) { + + } + + try { + container->mount (this->m_context.settings.general.assets, "/"); + } catch (std::runtime_error&) { sLog.exception ("Cannot find a valid assets folder, resolved to ", this->m_context.settings.general.assets); } - // TODO: move this somewhere else? - auto virtualContainer = std::make_unique (); + auto& vfs = container->getVFS (); // // Had to get a little creative with the effects to achieve the same bloom effect without any custom code @@ -66,21 +75,21 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) // add the effect file for screen bloom // add some model for the image element even if it's going to waste rendering cycles - virtualContainer->add ( + vfs.add ( "effects/wpenginelinux/bloomeffect.json", { {"name", "camerabloom_wpengine_linux"}, {"group", "wpengine_linux_camera"}, - {"dependencies", json::array ()}, + {"dependencies", JSON::array ()}, {"passes", - json::array ( + JSON::array ( { { {"material", "materials/util/downsample_quarter_bloom.json"}, {"target", "_rt_4FrameBuffer"}, { "bind", - json::array ( + JSON::array ( { { {"name", "_rt_FullFrameBuffer"}, @@ -95,7 +104,7 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) {"target", "_rt_8FrameBuffer"}, { "bind", - json::array ( + JSON::array ( { { {"name", "_rt_4FrameBuffer"}, @@ -110,7 +119,7 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) {"target", "_rt_Bloom"}, { "bind", - json::array ( + JSON::array ( { { {"name", "_rt_8FrameBuffer"}, @@ -125,7 +134,7 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) {"target", "_rt_FullFrameBuffer"}, { "bind", - json::array ( + JSON::array ( { { {"name", "_rt_imageLayerComposite_-1_a"}, @@ -145,17 +154,17 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) } ); - virtualContainer->add ( + vfs.add ( "models/wpenginelinux.json", { {"material","materials/wpenginelinux.json"} } ); - virtualContainer->add( + vfs.add( "materials/wpenginelinux.json", { - {"passes", json::array ( + {"passes", JSON::array ( { { {"blending", "normal"}, @@ -163,13 +172,13 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) {"depthtest", "disabled"}, {"depthwrite", "disabled"}, {"shader", "genericimage2"}, - {"textures", json::array ({"_rt_FullFrameBuffer"})} + {"textures", JSON::array ({"_rt_FullFrameBuffer"})} } } )}} ); - virtualContainer->add( + vfs.add( "shaders/commands/copy.frag", "uniform sampler2D g_Texture0;\n" "in vec2 v_TexCoord;\n" @@ -177,7 +186,7 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) "out_FragColor = texture (g_Texture0, v_TexCoord);\n" "}" ); - virtualContainer->add( + vfs.add( "shaders/commands/copy.vert", "in vec3 a_Position;\n" "in vec2 a_TexCoord;\n" @@ -188,8 +197,6 @@ ContainerUniquePtr CWallpaperApplication::setupContainer (const std::string& bg) "}" ); - container->add (std::move(virtualContainer)); - return container; } @@ -212,7 +219,7 @@ void CWallpaperApplication::loadBackgrounds () { ProjectUniquePtr CWallpaperApplication::loadBackground (const std::string& bg) { auto container = this->setupContainer (bg); - auto json = WallpaperEngine::Data::JSON::JSON::parse (container->readFileAsString ("project.json")); + auto json = WallpaperEngine::Data::JSON::JSON::parse (container->readString ("project.json")); return WallpaperEngine::Data::Parsers::ProjectParser::parse (json, std::move(container)); } diff --git a/src/WallpaperEngine/Application/CWallpaperApplication.h b/src/WallpaperEngine/Application/CWallpaperApplication.h index 5ef96f0..b2400f3 100644 --- a/src/WallpaperEngine/Application/CWallpaperApplication.h +++ b/src/WallpaperEngine/Application/CWallpaperApplication.h @@ -2,8 +2,6 @@ #include "WallpaperEngine/Application/CApplicationContext.h" -#include "WallpaperEngine/Assets/CCombinedContainer.h" - #include "WallpaperEngine/Render/CRenderContext.h" #include "WallpaperEngine/Render/CWallpaper.h" #include "WallpaperEngine/Render/Drivers/CGLFWOpenGLDriver.h" diff --git a/src/WallpaperEngine/Assets/CAssetLoadException.h b/src/WallpaperEngine/Assets/CAssetLoadException.h index 829ceed..609fef3 100644 --- a/src/WallpaperEngine/Assets/CAssetLoadException.h +++ b/src/WallpaperEngine/Assets/CAssetLoadException.h @@ -3,6 +3,7 @@ #include #include +// TODO: REWRITE THIS ONE TO MAKE MORE SENSE, IT REALLY MEANS "FILE-RELATED EXCEPTION" namespace WallpaperEngine::Assets { class CAssetLoadException final : public std::exception { public: diff --git a/src/WallpaperEngine/Assets/CCombinedContainer.cpp b/src/WallpaperEngine/Assets/CCombinedContainer.cpp deleted file mode 100644 index c34104b..0000000 --- a/src/WallpaperEngine/Assets/CCombinedContainer.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "CCombinedContainer.h" -#include "CAssetLoadException.h" -#include "CPackage.h" -#include "CPackageLoadException.h" -#include "WallpaperEngine/Logging/CLog.h" - -using namespace WallpaperEngine::Assets; - -CCombinedContainer::CCombinedContainer () : CContainer () {} - -void CCombinedContainer::add (std::unique_ptr container) { - this->m_containers.emplace_back (std::move(container)); -} - -void CCombinedContainer::addPkg (const std::filesystem::path& path) { - try { - // add the package to the list - this->add (std::make_unique (path)); - sLog.out ("Detected ", path.filename (), " file at ", path, ". Adding to list of searchable paths"); - } catch (CPackageLoadException&) { - // ignore this error, the package file was not found - sLog.out ("No ", path.filename (), " file found at ", path, ". Defaulting to normal folder storage"); - } catch (std::runtime_error& ex) { - // the package was found but there was an error loading it (wrong header or something) - sLog.exception ("Failed to load ", path.filename(), " file: ", ex.what ()); - } -} - -std::filesystem::path CCombinedContainer::resolveRealFile (const std::filesystem::path& filename) const { - for (const auto& cur : this->m_containers) { - try { - // try to read the file on the current container, if the file doesn't exists - // an exception will be thrown - return cur->resolveRealFile (filename); - } catch (CAssetLoadException&) { - // not found in this container, next try - } - } - - // no container was able to load the file, abort! - throw CAssetLoadException (filename, "Cannot resolve file in any of the containers"); -} - -std::shared_ptr CCombinedContainer::readFile (const std::filesystem::path& filename, uint32_t* length) const { - for (const auto& cur : this->m_containers) { - try { - // try to read the file on the current container, if the file doesn't exists - // an exception will be thrown - return cur->readFile (filename, length); - } catch (CAssetLoadException& e) { - // not found in this container, next try - } - } - - // no container was able to load the file, abort! - throw CAssetLoadException (filename, "Cannot find file in any of the containers"); -} \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CCombinedContainer.h b/src/WallpaperEngine/Assets/CCombinedContainer.h deleted file mode 100644 index 7d15bb7..0000000 --- a/src/WallpaperEngine/Assets/CCombinedContainer.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include "CContainer.h" - -#include -#include -#include - -namespace WallpaperEngine::Assets { -/** - * A meta-container that allows backgrounds to have files spread across different containers - */ -class CCombinedContainer final : public CContainer { - public: - CCombinedContainer (); - - /** - * Adds a container to the list - * - * @param container - */ - void add (std::unique_ptr container); - /** - * Adds the given package to the list - * - * @param path - */ - void addPkg (const std::filesystem::path& path); - - [[nodiscard]] std::filesystem::path resolveRealFile (const std::filesystem::path& filename) const override; - [[nodiscard]] std::shared_ptr readFile (const std::filesystem::path& filename, uint32_t* length) const override; - - private: - /** The list of containers to search files off from */ - std::vector> m_containers {}; -}; -}; // namespace WallpaperEngine::Assets \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CContainer.cpp b/src/WallpaperEngine/Assets/CContainer.cpp deleted file mode 100644 index 93851be..0000000 --- a/src/WallpaperEngine/Assets/CContainer.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "CContainer.h" -#include "CAssetLoadException.h" -#include "CTexture.h" -#include "WallpaperEngine/Data/Utils/BinaryReader.h" -#include "WallpaperEngine/Data/Utils/MemoryStream.h" -#include "WallpaperEngine/Data/Parsers/TextureParser.h" -#include "WallpaperEngine/Logging/CLog.h" - -#include -#include -#include - -using namespace WallpaperEngine::Assets; -using namespace WallpaperEngine::Data::Utils; -using namespace WallpaperEngine::Data::Parsers; - -std::filesystem::path CContainer::resolveRealFile (const std::filesystem::path& filename) const { - throw CAssetLoadException (filename, "Cannot resolve physical file in this container"); -} - -std::shared_ptr CContainer::readTexture (const std::filesystem::path& filename) const { - // get the texture's filename (usually .tex) - std::filesystem::path texture = "materials" / std::filesystem::path (filename.string ().append (".tex")); - - uint32_t length = 0; - const auto textureContents = this->readFile (texture, &length); - // TODO: MAKE PROPER USE OF I/OSTREAMS IN THE CLASS INSTEAD OF INSTANTIATING THINGS HERE... - auto buffer = MemoryStream (reinterpret_cast (const_cast (&textureContents.get () [0])), length); - auto istream = std::istream (&buffer); - auto binaryReader = BinaryReader (istream); - const auto result = std::make_shared (TextureParser::parse (binaryReader)); - -#if !NDEBUG - glObjectLabel (GL_TEXTURE, result->getTextureID (0), -1, texture.c_str ()); -#endif /* NDEBUG */ - - return result; -} - -std::string CContainer::readShader (const std::filesystem::path& filename) const { - std::filesystem::path shader = filename; - auto it = shader.begin (); - - // detect workshop shaders and check if there's a - if (*it++ == "workshop") { - const std::filesystem::path workshopId = *it++; - - if (++it != shader.end ()) { - const std::filesystem::path& shaderfile = *it; - - try { - shader = std::filesystem::path ("zcompat") / "scene" / "shaders" / workshopId / shaderfile; - // replace the old path with the new one - std::string contents = this->readFileAsString (shader); - - sLog.out ("Replaced ", filename, " with compat ", shader); - - return contents; - } catch (CAssetLoadException&) {} - } - } - - return this->readFileAsString ("shaders" / filename); -} - -std::string CContainer::readVertexShader (const std::filesystem::path& filename) const { - std::filesystem::path shader = filename; - shader.replace_extension (".vert"); - return this->readShader (shader); -} - -std::string CContainer::readFragmentShader (const std::filesystem::path& filename) const { - std::filesystem::path shader = filename; - shader.replace_extension (".frag"); - return this->readShader (shader); -} - -std::string CContainer::readIncludeShader (const std::filesystem::path& filename) const { - return this->readFileAsString ("shaders" / filename); -} - -std::string CContainer::readFileAsString (const std::filesystem::path& filename) const { - uint32_t length = 0; - - return { - reinterpret_cast (this->readFile (filename, &length).get ()), length - }; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CContainer.h b/src/WallpaperEngine/Assets/CContainer.h deleted file mode 100644 index dffb8da..0000000 --- a/src/WallpaperEngine/Assets/CContainer.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Assets/ITexture.h" - -#include -#include - -namespace WallpaperEngine::Assets { -class ITexture; - -/** - * File container, provides access to files for backgrounds - */ -class CContainer { - public: - virtual ~CContainer () = default; - - /** - * Resolves the full path to the specified file in the filesystem - * - * @param filename - * @return - */ - [[nodiscard]] virtual std::filesystem::path resolveRealFile (const std::filesystem::path& filename) const; - - /** - * Reads the given file from the container and returns it's data - * Additionally sets a length parameter to return back the file's length - * - * The returned string must be deleted[] by the caller - * - * @param filename The file to read - * @param length The file's length after it's been read, null for not getting anything back - * - * @return - */ - [[nodiscard]] virtual std::shared_ptr readFile (const std::filesystem::path& filename, uint32_t* length) const = 0; - - /** - * Wrapper for readFile, appends the texture extension at the end of the filename - * - * @param filename The texture name (without the .tex) - * - * @return - */ - [[nodiscard]] std::shared_ptr readTexture (const std::filesystem::path& filename) const; - - /** - * Wrapper for readFile, checks for compat versions of the given shader file - * - * @param filename - * - * @return The shader code as an string to be used - */ - [[nodiscard]] std::string readShader (const std::filesystem::path& filename) const; - - /** - * Wrapper for readFile, appends the .vert extension at the end and opens the given shader file - * - * @param filename - * - * @return The shader code as an string to be used - */ - [[nodiscard]] std::string readVertexShader (const std::filesystem::path& filename) const; - - /** - * Wrapper for readFile, appends the .frag extension at the end and opens the given shader file - * - * @param filename - * - * @return The shader code as an string to be used - */ - [[nodiscard]] std::string readFragmentShader (const std::filesystem::path& filename) const; - - /** - * Wrapper for readFile, appends the .h extension at the end and opens the given shader file - * - * @param filename - * - * @return The shader code as an string to be used - */ - [[nodiscard]] std::string readIncludeShader (const std::filesystem::path& filename) const; - - /** - * Reads a file as string - * - * @param filename - * - * @return The file's contents as string - */ - [[nodiscard]] std::string readFileAsString (const std::filesystem::path& filename) const; -}; -} // namespace WallpaperEngine::Assets \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CDirectory.cpp b/src/WallpaperEngine/Assets/CDirectory.cpp deleted file mode 100644 index 2d32768..0000000 --- a/src/WallpaperEngine/Assets/CDirectory.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "CAssetLoadException.h" -#include "CDirectory.h" - -using namespace WallpaperEngine::Assets; - -CDirectory::CDirectory (const std::filesystem::path& basepath) { - try { - // resolve the path to it's real location - std::filesystem::path finalpath = std::filesystem::canonical(basepath); - std::filesystem::file_status status = std::filesystem::status (finalpath); - - if (!std::filesystem::exists (finalpath)) { - throw CAssetLoadException (basepath, "Cannot find directory"); - } - - if (!std::filesystem::is_directory(status)) { - throw CAssetLoadException (basepath, "Expected directory but found a file"); - } - - this->m_basepath = finalpath; - } catch (std::bad_alloc&) { - throw CAssetLoadException (basepath, "Cannot allocate memory"); - } catch (std::filesystem::filesystem_error& e) { - throw CAssetLoadException (basepath, e.what ()); - } -} - -std::filesystem::path CDirectory::resolveRealFile (const std::filesystem::path& filename) const { - try { - std::filesystem::path final = std::filesystem::canonical (this->m_basepath / filename); - - // first validate the path, so the message doesn't reflect if the file exists or not unless it's under the actual directory - if (final.string ().find (this->m_basepath.string ()) != 0) { - throw CAssetLoadException (filename, "File is not a child of the given directory"); - } - - std::filesystem::file_status status = std::filesystem::status (final); - - if (!std::filesystem::exists (final)) { - throw CAssetLoadException (filename, "Cannot find file"); - } - - if (!std::filesystem::is_regular_file (status)) { - throw CAssetLoadException (filename, "Expected file but found a directory"); - } - - return final; - } catch (std::filesystem::filesystem_error& e) { - throw CAssetLoadException (filename, e.what ()); - } -} - -std::shared_ptr CDirectory::readFile (const std::filesystem::path& filename, uint32_t* length) const { - std::filesystem::path final = this->resolveRealFile (filename); - - FILE* fp = fopen (final.c_str (), "rb"); - - if (fp == nullptr) { - throw CAssetLoadException (filename, "Cannot open file for reading"); - } - - try { - // go to the end, get the position and return to the beginning - fseek (fp, 0, SEEK_END); - const long size = ftell (fp); - fseek (fp, 0, SEEK_SET); - - // now read the whole file - std::shared_ptr contents = std::shared_ptr(new uint8_t [size]); - - if (fread (contents.get(), size, 1, fp) != 1) { - throw CAssetLoadException (filename, "Unexpected error when reading the file"); - } - - if (length != nullptr) { - *length = size; - } - - fclose (fp); - return contents; - } catch (std::filesystem::filesystem_error& e) { - fclose (fp); - throw CAssetLoadException (filename, e.what ()); - } -} \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CDirectory.h b/src/WallpaperEngine/Assets/CDirectory.h deleted file mode 100644 index c9a35b3..0000000 --- a/src/WallpaperEngine/Assets/CDirectory.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "CContainer.h" -#include "CFileEntry.h" - -namespace WallpaperEngine::Assets { -/** - * Directory container implementation, provides access to background files under a specific directory - */ -class CDirectory final : public CContainer { - public: - explicit CDirectory (const std::filesystem::path& basepath); - - [[nodiscard]] std::filesystem::path resolveRealFile (const std::filesystem::path& filename) const override; - [[nodiscard]] std::shared_ptr readFile (const std::filesystem::path& filename, uint32_t* length) const override; - - private: - /** The basepath for the directory */ - std::filesystem::path m_basepath {}; -}; -} // namespace WallpaperEngine::Assets \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CFileEntry.h b/src/WallpaperEngine/Assets/CFileEntry.h deleted file mode 100644 index 0dcb79e..0000000 --- a/src/WallpaperEngine/Assets/CFileEntry.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -namespace WallpaperEngine::Assets { -/** - * File cache entry to prevent hit the disk when loading the same file multiple times - */ -class CFileEntry { - public: - CFileEntry (std::shared_ptr content, uint32_t length) : - content (std::move(content)), - length (length) {} - ~CFileEntry() = default; - - /** File contents */ - std::shared_ptr content = nullptr; - /** File length */ - uint32_t length = 0; -}; -} // namespace WallpaperEngine::Assets diff --git a/src/WallpaperEngine/Assets/CPackage.cpp b/src/WallpaperEngine/Assets/CPackage.cpp deleted file mode 100644 index 26ec945..0000000 --- a/src/WallpaperEngine/Assets/CPackage.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include "CPackage.h" -#include "CAssetLoadException.h" -#include "CPackageLoadException.h" -#include "WallpaperEngine/Logging/CLog.h" - -#include -#include - -using namespace WallpaperEngine::Assets; - -class CPackageEntry { - public: - CPackageEntry (std::string filename, uint32_t offset, uint32_t length) : - filename (filename), - offset (offset), - length (length) {} - - std::string filename; - uint32_t offset; - uint32_t length; -}; - -CPackage::CPackage (std::filesystem::path path) : m_path (std::move (path)) { - this->init (); -} - -std::shared_ptr CPackage::readFile (const std::filesystem::path& filename, uint32_t* length) const { - const auto it = this->m_contents.find (filename); - - if (it == this->m_contents.end ()) - throw CAssetLoadException (filename, "Cannot find the file in the package"); - - // set file length if required - if (length != nullptr) - *length = it->second->length; - - return it->second->content; -} - -void CPackage::init () { - FILE* fp = fopen (this->m_path.c_str (), "rb+"); - - if (fp == nullptr) - throw CPackageLoadException (this->m_path, std::to_string (errno)); - - // first validate header - this->validateHeader (fp); - // header is okay, load everything into memory - this->loadFiles (fp); - - fclose (fp); -} - -char* CPackage::readSizedString (FILE* fp) { - unsigned int length = 0; - - if (fread (&length, sizeof (unsigned int), 1, fp) != 1) - sLog.exception ("Cannot read sized string length on file ", this->m_path); - - // account for 0 termination of the string - length++; - - char* pointer = new char [length]; - memset (pointer, 0, length); - - // read only the string bytes so the last one in the memory is 0 - length--; - - // read data from file - if (fread (pointer, sizeof (char), length, fp) != length) - sLog.exception ("Not enough bytes to read string of length ", length, " on file ", this->m_path); - - return pointer; -} - -uint32_t CPackage::readInteger (FILE* fp) { - uint32_t output; - - if (fread (&output, sizeof (uint32_t), 1, fp) != 1) - sLog.exception ("Not enough bytes to read an integer from file ", this->m_path); - - return output; -} - -void CPackage::validateHeader (FILE* fp) { - const char* pointer = this->readSizedString (fp); - - if (strncmp ("PKGV", pointer, 4) != 0) { - std::stringstream msg; - msg << "Expected PKGV indicator, found " << pointer; - delete [] pointer; - throw std::runtime_error (msg.str ()); - } - - // free memory - delete [] pointer; -} - -void CPackage::loadFiles (FILE* fp) { - const uint32_t count = this->readInteger (fp); - std::vector list; - - for (uint32_t index = 0; index < count; index++) { - // first read the filename - char* filename = this->readSizedString (fp); - uint32_t offset = this->readInteger (fp); - uint32_t length = this->readInteger (fp); - - // add the file to the list - list.emplace_back (filename, offset, length); - // only free filename, the file's contents are stored in a map for a later use - delete [] filename; - } - - // get current baseOffset, this is where the files start - const long baseOffset = ftell (fp); - - for (const auto& cur : list) { - const long offset = cur.offset + baseOffset; - - // with all the data we can jump to the offset and read the content - if (fseek (fp, offset, SEEK_SET) != 0) - sLog.exception ("Cannot find file ", cur.filename, " from package ", this->m_path); - - // allocate memory for the file's contents and read it from the file - std::shared_ptr contents = std::shared_ptr(new uint8_t [cur.length]); - - if (fread (contents.get(), cur.length, 1, fp) != 1) { - sLog.exception ("Cannot read file ", cur.filename, " contents from package ", this->m_path); - } - - // add the file to the map - this->m_contents.insert_or_assign (cur.filename, std::make_unique (contents, cur.length)); - } -} \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CPackage.h b/src/WallpaperEngine/Assets/CPackage.h deleted file mode 100644 index 5baafe2..0000000 --- a/src/WallpaperEngine/Assets/CPackage.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#include "CContainer.h" -#include "CFileEntry.h" - -namespace WallpaperEngine::Assets { -/** - * Package container implementation, provides access to background files that are stored - * inside the WallpaperEngine's pkg format - */ -class CPackage final : public CContainer { - public: - explicit CPackage (std::filesystem::path path); - - [[nodiscard]] std::shared_ptr readFile (const std::filesystem::path& filename, uint32_t* length) const override; - - protected: - /** - * Loads the current package file and loads all it's contents to memory - */ - void init (); - - /** - * Reads the header from the current position and ensures it's a compatible version - * - * @param fp The file where to read from - */ - void validateHeader (FILE* fp); - - /** - * Loads the files in the package into memory - * - * @param fp The file where to read from - */ - void loadFiles (FILE* fp); - - /** - * Reads a size-prefixed string - * - * @param fp File to read from - * - * @return The read data, important to free it - */ - char* readSizedString (FILE* fp); - /** - * Reads a simple unsigned of 32 bits - * - * @param fp File to read from - * - * @return The read value - */ - uint32_t readInteger (FILE* fp); - - private: - /** The path to the package file */ - std::filesystem::path m_path {}; - /** Contents of the package file */ - std::map> m_contents {}; -}; -} // namespace WallpaperEngine::Assets diff --git a/src/WallpaperEngine/Assets/CPackageLoadException.cpp b/src/WallpaperEngine/Assets/CPackageLoadException.cpp deleted file mode 100644 index e47b3e7..0000000 --- a/src/WallpaperEngine/Assets/CPackageLoadException.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "CPackageLoadException.h" - -using namespace WallpaperEngine::Assets; - -CPackageLoadException::CPackageLoadException (const std::string& filename, const std::string& extrainfo) : - m_message ("Cannot load package " + filename + ": " + extrainfo) {} - -const char* CPackageLoadException::what () const noexcept { - return this->m_message.c_str (); -} diff --git a/src/WallpaperEngine/Assets/CPackageLoadException.h b/src/WallpaperEngine/Assets/CPackageLoadException.h deleted file mode 100644 index ef9a8dd..0000000 --- a/src/WallpaperEngine/Assets/CPackageLoadException.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -namespace WallpaperEngine::Assets { -class CPackageLoadException final : public std::exception { - public: - explicit CPackageLoadException (const std::string& filename, const std::string& extrainfo = ""); - [[nodiscard]] const char* what () const noexcept override; - - private: - std::string m_message {}; -}; -} // namespace WallpaperEngine::Assets \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CVirtualContainer.cpp b/src/WallpaperEngine/Assets/CVirtualContainer.cpp deleted file mode 100644 index d244e95..0000000 --- a/src/WallpaperEngine/Assets/CVirtualContainer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include - -#include "CAssetLoadException.h" -#include "CVirtualContainer.h" - -using namespace WallpaperEngine::Assets; - -void CVirtualContainer::add (const std::filesystem::path& filename, const std::shared_ptr& contents, uint32_t length) { - this->m_virtualFiles.emplace (filename, std::make_unique (contents, length)); -} - -void CVirtualContainer::add (const std::filesystem::path& filename, const std::string& contents) { - // do not copy the null terminator - size_t length = contents.length (); - std::shared_ptr copy = std::shared_ptr (new uint8_t [length]); - - memcpy (copy.get(), contents.c_str (), length); - - // finally add to the container - this->add (filename, copy, length); -} - -void CVirtualContainer::add (const std::filesystem::path& filename, const char* contents) { - this->add (filename, std::string (contents)); -} - -void CVirtualContainer::add (const std::filesystem::path& filename, const json& contents) { - this->add (filename, contents.dump ()); -} - -std::shared_ptr CVirtualContainer::readFile (const std::filesystem::path& filename, uint32_t* length) const { - const auto cur = this->m_virtualFiles.find (filename); - - if (cur == this->m_virtualFiles.end ()) - throw CAssetLoadException (filename, "Cannot find file in the virtual container"); - - if (length != nullptr) - *length = cur->second->length; - - // clone original first - return cur->second->content; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Assets/CVirtualContainer.h b/src/WallpaperEngine/Assets/CVirtualContainer.h deleted file mode 100644 index 6957f3b..0000000 --- a/src/WallpaperEngine/Assets/CVirtualContainer.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "CContainer.h" -#include "CFileEntry.h" -#include - - -namespace WallpaperEngine::Assets { -using json = nlohmann::json; -/** - * Virtual container implementation, provides virtual files for the backgrounds to use - */ -class CVirtualContainer final : public CContainer { - public: - /** - * Adds a new file to the virtual container - * - * @param filename - * @param contents - * @param length - */ - void add (const std::filesystem::path& filename, const std::shared_ptr& contents, uint32_t length); - - /** - * Adds a new file to the virtual container - * - * @param filename - * @param contents - */ - void add (const std::filesystem::path& filename, const std::string& contents); - - /** - * Adds a new file to the virtual container - * - * @param filename - * @param contents - */ - void add (const std::filesystem::path& filename, const char* contents); - /** - * Adds a new file to the virtual container from a json object - * @param filename - * @param contents - */ - void add (const std::filesystem::path& filename, const json& contents); - - /** @inheritdoc */ - std::shared_ptr readFile (const std::filesystem::path& filename, uint32_t* length) const override; - - private: - /** The recorded files in this virtual container */ - std::map> m_virtualFiles = {}; -}; -} // namespace WallpaperEngine::Assets \ No newline at end of file diff --git a/src/WallpaperEngine/Audio/CAudioStream.cpp b/src/WallpaperEngine/Audio/CAudioStream.cpp index e2a42b7..7671c20 100644 --- a/src/WallpaperEngine/Audio/CAudioStream.cpp +++ b/src/WallpaperEngine/Audio/CAudioStream.cpp @@ -61,26 +61,24 @@ int audio_read_thread (void* arg) { static int audio_read_data_callback (void* streamarg, uint8_t* buffer, int buffer_size) { const auto stream = static_cast (streamarg); - const int left = stream->getLength () - stream->getPosition (); - buffer_size = FFMIN (buffer_size, left); + stream->getBuffer ()->read (reinterpret_cast (buffer), buffer_size); - memcpy (buffer, stream->getBuffer ().get() + stream->getPosition (), buffer_size); - // update position - stream->setPosition (stream->getPosition () + buffer_size); - - return buffer_size; + // return read bytes only + return stream->getBuffer ()->gcount (); } int64_t audio_seek_data_callback (void* streamarg, int64_t offset, int whence) { const auto stream = static_cast (streamarg); + // this was supported before, now we don't as there's no easy way to tell length + // so returning <0 signals no support for it if (whence & AVSEEK_SIZE) - return stream->getLength (); + return -1; switch (whence) { - case SEEK_CUR: stream->setPosition (stream->getPosition () + offset); break; - case SEEK_SET: stream->setPosition (offset); break; + case SEEK_CUR: stream->getBuffer ()->seekg (offset, std::ios_base::cur); break; + case SEEK_SET: stream->getBuffer ()->seekg (offset, std::ios_base::beg); break; } return offset; @@ -91,7 +89,7 @@ CAudioStream::CAudioStream (CAudioContext& context, const std::string& filename) this->loadCustomContent (filename.c_str ()); } -CAudioStream::CAudioStream (CAudioContext& context, std::shared_ptr buffer, uint32_t length) : +CAudioStream::CAudioStream (CAudioContext& context, const ReadStreamSharedPtr& buffer, uint32_t length) : m_audioContext (context) { // setup a custom context first this->m_formatContext = avformat_alloc_context (); @@ -101,7 +99,6 @@ CAudioStream::CAudioStream (CAudioContext& context, std::shared_ptrm_buffer = buffer; this->m_length = length; - this->m_position = 0; // setup custom io for it this->m_formatContext->pb = avio_alloc_context (static_cast (av_malloc (4096)), 4096, 0, this, @@ -330,7 +327,7 @@ bool CAudioStream::isRepeat () const { return this->m_repeat; } -std::shared_ptr CAudioStream::getBuffer () { +ReadStreamSharedPtr& CAudioStream::getBuffer () { return this->m_buffer; } @@ -338,14 +335,6 @@ uint32_t CAudioStream::getLength () const { return this->m_length; } -uint32_t CAudioStream::getPosition () const { - return this->m_position; -} - -void CAudioStream::setPosition (uint32_t current) { - this->m_position = current; -} - SDL_cond* CAudioStream::getWaitCondition () { return this->m_queue->wait; } diff --git a/src/WallpaperEngine/Audio/CAudioStream.h b/src/WallpaperEngine/Audio/CAudioStream.h index 9cc8734..7f236e3 100644 --- a/src/WallpaperEngine/Audio/CAudioStream.h +++ b/src/WallpaperEngine/Audio/CAudioStream.h @@ -31,13 +31,15 @@ extern "C" { namespace WallpaperEngine::Audio { class CAudioContext; +using namespace WallpaperEngine::FileSystem; + /** * Represents a playable audio stream for the audio driver */ class CAudioStream { public: CAudioStream (CAudioContext& context, const std::string& filename); - CAudioStream (CAudioContext& context, std::shared_ptr buffer, uint32_t length); + CAudioStream (CAudioContext& context, const ReadStreamSharedPtr& buffer, uint32_t length); CAudioStream (CAudioContext& audioContext, AVCodecContext* context); ~CAudioStream (); @@ -88,21 +90,11 @@ class CAudioStream { /** * @return The file data buffer */ - [[nodiscard]] std::shared_ptr getBuffer (); + [[nodiscard]] ReadStreamSharedPtr& getBuffer (); /** * @return The length of the file data buffer */ [[nodiscard]] uint32_t getLength () const; - /** - * @return The read position of the data buffer - */ - [[nodiscard]] uint32_t getPosition () const; - /** - * Updates the read position of the data buffer - * - * @param current - */ - void setPosition (uint32_t current); /** * @return The SDL_cond used to signal waiting for data */ @@ -185,11 +177,9 @@ class CAudioStream { /** The stream index for the audio being played */ int m_audioStream = NO_AUDIO_STREAM; /** File data pointer */ - std::shared_ptr m_buffer = nullptr; + ReadStreamSharedPtr m_buffer = nullptr; /** The length of the file data pointer */ uint32_t m_length = 0; - /** The read position on the file data pointer */ - uint32_t m_position = 0; struct MyAVPacketList { AVPacket* packet; diff --git a/src/WallpaperEngine/Data/Assets/Package.h b/src/WallpaperEngine/Data/Assets/Package.h new file mode 100644 index 0000000..ffcffd7 --- /dev/null +++ b/src/WallpaperEngine/Data/Assets/Package.h @@ -0,0 +1,23 @@ +#pragma once + +#include "Types.h" +#include "WallpaperEngine/Data/Utils/BinaryReader.h" + +#include +#include + +namespace WallpaperEngine::Data::Assets { +using namespace WallpaperEngine::Data::Utils; + +struct FileEntry { + std::string filename; + uint32_t offset; + uint32_t length; +}; + +struct Package { + BinaryReaderUniquePtr file; + FileEntryList files; + uint32_t baseOffset; +}; +} \ No newline at end of file diff --git a/src/WallpaperEngine/Data/Assets/Types.h b/src/WallpaperEngine/Data/Assets/Types.h index f548676..244d70c 100644 --- a/src/WallpaperEngine/Data/Assets/Types.h +++ b/src/WallpaperEngine/Data/Assets/Types.h @@ -7,9 +7,14 @@ namespace WallpaperEngine::Data::Assets { struct Mipmap; struct Frame; struct Texture; +struct Package; +struct FileEntry; using MipmapSharedPtr = std::shared_ptr ; using FrameSharedPtr = std::shared_ptr ; using TextureUniquePtr = std::unique_ptr ; +using FileEntryUniquePtr = std::unique_ptr ; +using PackageUniquePtr = std::unique_ptr ; using MipmapList = std::vector ; +using FileEntryList = std::vector ; } \ No newline at end of file diff --git a/src/WallpaperEngine/Data/Model/Effect.h b/src/WallpaperEngine/Data/Model/Effect.h index 432523e..a1a1837 100644 --- a/src/WallpaperEngine/Data/Model/Effect.h +++ b/src/WallpaperEngine/Data/Model/Effect.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "Types.h" diff --git a/src/WallpaperEngine/Data/Model/Project.h b/src/WallpaperEngine/Data/Model/Project.h index 1d00a3b..f9b4f53 100644 --- a/src/WallpaperEngine/Data/Model/Project.h +++ b/src/WallpaperEngine/Data/Model/Project.h @@ -4,6 +4,7 @@ #include #include "Types.h" +#include "WallpaperEngine/FileSystem/Container.h" namespace WallpaperEngine::Data::Model { /** @@ -27,7 +28,6 @@ struct Project { bool supportsAudioProcessing; /** All the available properties that the project defines for the user to change */ Properties properties; - /** The wallpaper this project defines */ WallpaperUniquePtr wallpaper; /** VFS to access the project's files */ diff --git a/src/WallpaperEngine/Data/Model/Types.h b/src/WallpaperEngine/Data/Model/Types.h index 33e8d38..0e716f5 100644 --- a/src/WallpaperEngine/Data/Model/Types.h +++ b/src/WallpaperEngine/Data/Model/Types.h @@ -3,16 +3,12 @@ #include #include #include -#include #include -#include "WallpaperEngine/Assets/CContainer.h" - -namespace WallpaperEngine::Assets { -class CContainer; +namespace WallpaperEngine::FileSystem { +class Container; } - namespace WallpaperEngine::Data::Model { struct Project; class Wallpaper; @@ -40,9 +36,6 @@ struct Effect; struct EffectPass; struct ModelStruct; -// TODO: REMOVE ONCE THESE ARE RENAMED AND MOVED -using Container = WallpaperEngine::Assets::CContainer; - using PropertySharedPtr = std::shared_ptr ; using Properties = std::map ; using DynamicValueUniquePtr = std::unique_ptr ; @@ -53,7 +46,7 @@ using ShaderConstantMap = std::map ; using ProjectUniquePtr = std::unique_ptr ; using WallpaperUniquePtr = std::unique_ptr ; -using ContainerUniquePtr = std::unique_ptr ; +using ContainerUniquePtr = std::unique_ptr ; using SceneUniquePtr = std::unique_ptr ; using WebUniquePtr = std::unique_ptr ; using VideoUniquePtr = std::unique_ptr