metaforce/Runtime/Character/CAssetFactory.hpp

43 lines
1.5 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
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
2018-12-08 05:30:43 +00:00
namespace urde {
2016-04-14 21:42:47 +00:00
class CCharacterFactory;
class CAnimRes;
2018-12-08 05:30:43 +00:00
class CCharacterFactoryBuilder {
2015-08-25 07:04:50 +00:00
public:
2018-12-08 05:30:43 +00:00
class CDummyFactory : public IFactory {
public:
CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference* selfRef);
void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr<IObj>*, CObjectReference* selfRef);
void CancelBuild(const SObjectTag&);
bool CanBuild(const SObjectTag&);
const SObjectTag* GetResourceIdByName(std::string_view) const;
FourCC GetResourceTypeById(CAssetId id) const;
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const;
u32 ResourceSize(const urde::SObjectTag& tag);
std::shared_ptr<IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target);
std::shared_ptr<IDvdRequest> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 off, u32 size, void* target);
std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag);
std::unique_ptr<u8[]> LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size);
};
2016-04-15 03:02:21 +00:00
private:
2018-12-08 05:30:43 +00:00
CDummyFactory x0_dummyFactory;
CSimplePool x4_dummyStore;
2016-04-15 03:02:21 +00:00
public:
2018-12-08 05:30:43 +00:00
CCharacterFactoryBuilder();
TToken<CCharacterFactory> GetFactory(const CAnimRes& res);
2015-08-17 23:46:41 +00:00
};
2016-04-14 21:42:47 +00:00
2018-12-08 05:30:43 +00:00
} // namespace urde