2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:07:42 +00:00

Lots of CResFactory fixes

This commit is contained in:
Jack Andersen
2017-10-27 00:10:32 -10:00
parent 8346f56595
commit 2f4cddd3d2
29 changed files with 210 additions and 139 deletions

View File

@@ -21,7 +21,7 @@ class ProjectResourceFactoryBase : public IFactory
hecl::ClientProcess& m_clientProc;
public:
struct AsyncTask
struct AsyncTask : urde::IDvdRequest
{
ProjectResourceFactoryBase& m_parent;
@@ -52,6 +52,10 @@ public:
: m_parent(parent), x0_tag(tag), xc_targetDataPtr(&ptr), x14_resSize(size),
x14_resOffset(off) {}
AsyncTask(ProjectResourceFactoryBase& parent, const SObjectTag& tag,
u8* ptr)
: m_parent(parent), x0_tag(tag), xc_targetDataRawPtr(ptr) {}
AsyncTask(ProjectResourceFactoryBase& parent, const SObjectTag& tag,
u8* ptr, u32 size, u32 off)
: m_parent(parent), x0_tag(tag), xc_targetDataRawPtr(ptr), x14_resSize(size),
@@ -69,7 +73,10 @@ public:
const hecl::ProjectPath& path);
void CookComplete();
bool AsyncPump();
void WaitForComplete();
void WaitUntilComplete();
bool IsComplete() { return m_complete; }
void PostCancelRequest() {}
EMediaType GetMediaType() const { return EMediaType::Real; }
};
protected:
@@ -154,9 +161,8 @@ public:
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const;
u32 ResourceSize(const SObjectTag& tag);
std::shared_ptr<AsyncTask> LoadResourceAsync(const urde::SObjectTag& tag, std::unique_ptr<u8[]>& target);
std::shared_ptr<AsyncTask> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 size, u32 off, std::unique_ptr<u8[]>& target);
std::shared_ptr<AsyncTask> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 size, u32 off, u8* target);
std::shared_ptr<urde::IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target);
std::shared_ptr<urde::IDvdRequest> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 size, u32 off, void* target);
std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag);
std::unique_ptr<u8[]> LoadResourcePartSync(const urde::SObjectTag& tag, u32 size, u32 off);