#ifndef __URDE_IFACTORY_HPP__ #define __URDE_IFACTORY_HPP__ #include #include #include "RetroTypes.hpp" namespace urde { class CVParamTransfer; class IObj; class CObjectReference; class CResLoader; class CFactoryMgr; class CSimplePool; class IDvdRequest; using CFactoryFnReturn = std::unique_ptr; using FFactoryFunc = std::function; using FMemFactoryFunc = std::function&& in, u32 len, const urde::CVParamTransfer& vparms, CObjectReference* selfRef)>; class IFactory { public: virtual ~IFactory() = default; virtual CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference*)=0; virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr*, CObjectReference*)=0; virtual void CancelBuild(const SObjectTag&)=0; virtual bool CanBuild(const SObjectTag&)=0; virtual const SObjectTag* GetResourceIdByName(const char*) const=0; virtual FourCC GetResourceTypeById(CAssetId id) const=0; virtual void EnumerateResources(const std::function& lambda) const=0; virtual void EnumerateNamedResources(const std::function& lambda) const=0; virtual CResLoader* GetResLoader() { return nullptr; } virtual CFactoryMgr* GetFactoryMgr() { return nullptr; } virtual void LoadOriginalIDs(CSimplePool& sp) {} virtual void AsyncIdle() {} /* Non-factory versions, replaces CResLoader */ virtual u32 ResourceSize(const urde::SObjectTag& tag)=0; virtual std::shared_ptr LoadResourceAsync(const urde::SObjectTag& tag, void* target)=0; virtual std::shared_ptr LoadResourcePartAsync(const urde::SObjectTag& tag, u32 size, u32 off, void* target)=0; virtual std::unique_ptr LoadResourceSync(const urde::SObjectTag& tag)=0; virtual std::unique_ptr LoadResourcePartSync(const urde::SObjectTag& tag, u32 size, u32 off)=0; virtual void GetTagListForFile(const char* pakName, std::vector& out) const {} virtual CAssetId TranslateOriginalToNew(CAssetId id) const { return -1; } virtual CAssetId TranslateNewToOriginal(CAssetId id) const { return -1; } }; } #endif // __URDE_IFACTORY_HPP__