metaforce/Runtime/Character/CAssetFactory.hpp

48 lines
1.7 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-08-17 20:33:58 +00:00
#include <functional>
#include <memory>
#include "Runtime/CSimplePool.hpp"
#include "Runtime/CToken.hpp"
#include "Runtime/IFactory.hpp"
#include "Runtime/IObj.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) override;
void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr<IObj>*,
CObjectReference* selfRef) override;
void CancelBuild(const SObjectTag&) override;
bool CanBuild(const SObjectTag&) override;
const SObjectTag* GetResourceIdByName(std::string_view) const override;
FourCC GetResourceTypeById(CAssetId id) const override;
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const override;
void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const override;
u32 ResourceSize(const urde::SObjectTag& tag) override;
std::shared_ptr<IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target) override;
std::shared_ptr<IDvdRequest> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 off, u32 size,
void* target) override;
std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag) override;
std::unique_ptr<u8[]> LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size) override;
2018-12-08 05:30:43 +00:00
};
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