metaforce/Runtime/Character/CAssetFactory.hpp

48 lines
1.8 KiB
C++
Raw Permalink 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
2021-04-10 08:42:06 +00:00
namespace metaforce {
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;
2021-04-10 08:42:06 +00:00
u32 ResourceSize(const metaforce::SObjectTag& tag) override;
std::shared_ptr<IDvdRequest> LoadResourceAsync(const metaforce::SObjectTag& tag, void* target) override;
std::shared_ptr<IDvdRequest> LoadResourcePartAsync(const metaforce::SObjectTag& tag, u32 off, u32 size,
void* target) override;
2021-04-10 08:42:06 +00:00
std::unique_ptr<u8[]> LoadResourceSync(const metaforce::SObjectTag& tag) override;
std::unique_ptr<u8[]> LoadNewResourcePartSync(const metaforce::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
2021-04-10 08:42:06 +00:00
} // namespace metaforce