mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 21:07:42 +00:00
Integrate hecl ClientProcess into resource factory
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define URDE_PROJECT_RESOURCE_FACTORY_BASE_HPP
|
||||
|
||||
#include "hecl/ClientProcess.hpp"
|
||||
#include "hecl/Database.hpp"
|
||||
#include "Runtime/IFactory.hpp"
|
||||
#include "Runtime/CFactoryMgr.hpp"
|
||||
#include "Runtime/CResFactory.hpp"
|
||||
@@ -24,6 +25,8 @@ protected:
|
||||
const hecl::Database::Project* m_proj = nullptr;
|
||||
const hecl::Database::DataSpecEntry* m_origSpec = nullptr;
|
||||
const hecl::Database::DataSpecEntry* m_pcSpec = nullptr;
|
||||
/* Used to resolve cooked paths */
|
||||
std::unique_ptr<hecl::Database::IDataSpec> m_cookSpec;
|
||||
urde::CFactoryMgr m_factoryMgr;
|
||||
|
||||
std::experimental::optional<hecl::BlenderConnection> m_backgroundBlender;
|
||||
@@ -31,27 +34,48 @@ protected:
|
||||
std::mutex m_backgroundIndexMutex;
|
||||
bool m_backgroundRunning = false;
|
||||
|
||||
std::unordered_map<SObjectTag, CResFactory::SLoadingData> m_asyncLoadList;
|
||||
struct AsyncTask
|
||||
{
|
||||
ProjectResourceFactoryBase& m_parent;
|
||||
|
||||
SObjectTag x0_tag;
|
||||
IDvdRequest* x8_dvdReq = nullptr;
|
||||
IObj** xc_targetPtr = nullptr;
|
||||
std::unique_ptr<u8[]> x10_loadBuffer;
|
||||
u32 x14_resSize = 0;
|
||||
CVParamTransfer x18_cvXfer;
|
||||
|
||||
hecl::ProjectPath m_workingPath;
|
||||
hecl::ProjectPath m_cookedPath;
|
||||
const hecl::ClientProcess::CookTransaction* m_cookTransaction = nullptr;
|
||||
const hecl::ClientProcess::BufferTransaction* m_bufTransaction = nullptr;
|
||||
bool m_failed = false;
|
||||
|
||||
AsyncTask(ProjectResourceFactoryBase& parent, const SObjectTag& tag,
|
||||
IObj** ptr, const CVParamTransfer& xfer)
|
||||
: m_parent(parent), x0_tag(tag), xc_targetPtr(ptr), x18_cvXfer(xfer) {}
|
||||
|
||||
void EnsurePath(const hecl::ProjectPath& path);
|
||||
void CookComplete();
|
||||
bool AsyncPump();
|
||||
};
|
||||
std::unordered_map<SObjectTag, AsyncTask> m_asyncLoadList;
|
||||
|
||||
virtual SObjectTag TagFromPath(const hecl::ProjectPath& path) const=0;
|
||||
|
||||
hecl::BlenderConnection& GetBackgroundBlender() const;
|
||||
void ReadCatalog(const hecl::ProjectPath& catalogPath);
|
||||
void BackgroundIndexRecursiveProc(const hecl::SystemString& path, int level);
|
||||
void BackgroundIndexRecursiveProc(const hecl::ProjectPath& path, int level);
|
||||
void BackgroundIndexProc();
|
||||
void CancelBackgroundIndex();
|
||||
void BeginBackgroundIndex(const hecl::Database::Project& proj,
|
||||
void BeginBackgroundIndex(hecl::Database::Project& proj,
|
||||
const hecl::Database::DataSpecEntry& origSpec,
|
||||
const hecl::Database::DataSpecEntry& pcSpec);
|
||||
|
||||
virtual hecl::ProjectPath GetCookedPath(const SObjectTag& tag,
|
||||
const hecl::ProjectPath& working,
|
||||
bool pcTarget) const=0;
|
||||
virtual bool DoCook(const SObjectTag& tag, const hecl::ProjectPath& working,
|
||||
const hecl::ProjectPath& cooked,
|
||||
bool pcTarget)=0;
|
||||
CFactoryFnReturn MakeObject(const SObjectTag& tag, const hecl::ProjectPath& path,
|
||||
const CVParamTransfer& paramXfer);
|
||||
hecl::ProjectPath GetCookedPath(const hecl::ProjectPath& working, bool pcTarget) const;
|
||||
bool SyncCook(const hecl::ProjectPath& working);
|
||||
CFactoryFnReturn SyncMakeObject(const SObjectTag& tag, const hecl::ProjectPath& path,
|
||||
const CVParamTransfer& paramXfer);
|
||||
|
||||
public:
|
||||
ProjectResourceFactoryBase(hecl::ClientProcess& clientProc) : m_clientProc(clientProc) {}
|
||||
@@ -62,6 +86,7 @@ public:
|
||||
const urde::SObjectTag* GetResourceIdByName(const char*) const;
|
||||
|
||||
void AsyncIdle();
|
||||
void Shutdown() {CancelBackgroundIndex();}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user