metaforce/Runtime/Character/CAssetFactory.hpp

49 lines
1.6 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CASSETFACTORY_HPP__
#define __URDE_CASSETFACTORY_HPP__
2015-08-17 20:33:58 +00:00
2016-04-14 21:42:47 +00:00
#include "IFactory.hpp"
#include "IObj.hpp"
#include "CToken.hpp"
2016-04-15 03:02:21 +00:00
#include "CSimplePool.hpp"
2015-08-18 05:54:43 +00:00
2016-03-04 23:04:53 +00:00
namespace urde
{
2016-04-14 21:42:47 +00:00
class CCharacterFactory;
class CAnimRes;
2016-04-15 03:02:21 +00:00
class CCharacterFactoryBuilder
2015-08-17 23:46:41 +00:00
{
2015-08-25 07:04:50 +00:00
public:
2016-04-15 03:02:21 +00:00
class CDummyFactory : public IFactory
{
public:
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference* selfRef);
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**, CObjectReference* selfRef);
2016-04-15 03:02:21 +00:00
void CancelBuild(const SObjectTag&);
bool CanBuild(const SObjectTag&);
const SObjectTag* GetResourceIdByName(const char*) const;
2017-08-13 05:26:14 +00:00
FourCC GetResourceTypeById(CAssetId id) const;
2016-09-25 01:58:20 +00:00
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const;
u32 ResourceSize(const urde::SObjectTag& tag);
bool LoadResourceAsync(const urde::SObjectTag& tag, std::unique_ptr<u8[]>& target);
bool LoadResourcePartAsync(const urde::SObjectTag& tag, u32 size, u32 off, std::unique_ptr<u8[]>& target);
std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag);
std::unique_ptr<u8[]> LoadResourcePartSync(const urde::SObjectTag& tag, u32 size, u32 off);
2016-04-15 03:02:21 +00:00
};
private:
CDummyFactory x0_dummyFactory;
CSimplePool x4_dummyStore;
public:
CCharacterFactoryBuilder();
2016-04-14 21:42:47 +00:00
TToken<CCharacterFactory> GetFactory(const CAnimRes& res);
2015-08-17 23:46:41 +00:00
};
2016-04-14 21:42:47 +00:00
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CASSETFACTORY_HPP__