#pragma once #include "RuntimeHost.h" #include #include class RuntimeStore { public: explicit RuntimeStore(RuntimeHost& runtimeHost); bool InitializeStore(std::string& error); std::string BuildPersistentStateJson() const; bool PollStoredFileChanges(bool& registryChanged, bool& reloadRequested, std::string& error); bool CreateStoredLayer(const std::string& shaderId, std::string& error); bool DeleteStoredLayer(const std::string& layerId, std::string& error); bool MoveStoredLayer(const std::string& layerId, int direction, std::string& error); bool MoveStoredLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error); bool SetStoredLayerBypassState(const std::string& layerId, bool bypassed, std::string& error); bool SetStoredLayerShaderSelection(const std::string& layerId, const std::string& shaderId, std::string& error); bool SetStoredParameterValue(const std::string& layerId, const std::string& parameterId, const JsonValue& newValue, std::string& error); bool SetStoredParameterValueByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue, std::string& error); bool SetStoredParameterValueByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue, bool persistState, std::string& error); bool ResetStoredLayerParameterValues(const std::string& layerId, std::string& error); bool SaveStackPresetSnapshot(const std::string& presetName, std::string& error) const; bool LoadStackPresetSnapshot(const std::string& presetName, std::string& error); const std::filesystem::path& GetRuntimeRepositoryRoot() const; const std::filesystem::path& GetRuntimeUiRoot() const; const std::filesystem::path& GetRuntimeDocsRoot() const; const std::filesystem::path& GetRuntimeDataRoot() const; unsigned short GetConfiguredControlServerPort() const; unsigned short GetConfiguredOscPort() const; const std::string& GetConfiguredOscBindAddress() const; double GetConfiguredOscSmoothing() const; unsigned GetConfiguredMaxTemporalHistoryFrames() const; unsigned GetConfiguredPreviewFps() const; bool IsExternalKeyingConfigured() const; const std::string& GetConfiguredInputVideoFormat() const; const std::string& GetConfiguredInputFrameRate() const; const std::string& GetConfiguredOutputVideoFormat() const; const std::string& GetConfiguredOutputFrameRate() const; void SetBoundControlServerPort(unsigned short port); void SetCompileStatus(bool succeeded, const std::string& message); void ClearReloadRequest(); private: bool LoadConfig(std::string& error); bool LoadPersistentState(std::string& error); bool SavePersistentState(std::string& error) const; bool ScanShaderPackages(std::string& error); std::string ReadTextFile(const std::filesystem::path& path, std::string& error) const; bool WriteTextFile(const std::filesystem::path& path, const std::string& contents, std::string& error) const; bool ResolvePaths(std::string& error); std::vector GetStackPresetNamesLocked() const; std::string MakeSafePresetFileStem(const std::string& presetName) const; bool TryResolveStoredLayerAndParameterByControlKeyLocked(const std::string& layerKey, const std::string& parameterKey, RuntimeHost::LayerPersistentState*& matchedLayer, const ShaderPackage*& matchedPackage, std::vector::const_iterator& parameterIt, std::string& error) const; JsonValue BuildRuntimeStateValue() const; JsonValue SerializeLayerStack() const; RuntimeHost& mRuntimeHost; };