ksys/res: Implement register/unregisterFactory

This commit is contained in:
Léo Lam
2021-04-26 18:23:16 +02:00
parent f8d110ce28
commit 92ed3dbddb
4 changed files with 27 additions and 4 deletions
@@ -150,6 +150,17 @@ f32 ResourceMgrTask::getDefragProgress() const {
return f32(_4cc) / f32(_4c8);
}
void ResourceMgrTask::registerFactory(sead::ResourceFactory* factory,
const sead::SafeString& name) {
auto lock = sead::makeScopedLock(mFactoryCS);
sead::ResourceMgr::instance()->registerFactory(factory, name);
}
void ResourceMgrTask::unregisterFactory(sead::ResourceFactory* factory) {
auto lock = sead::makeScopedLock(mFactoryCS);
sead::ResourceMgr::instance()->unregisterFactory(factory);
}
void ResourceMgrTask::cancelTasks() {
stubbedLogFunction();
stubbedLogFunction();
@@ -123,6 +123,9 @@ public:
bool isDefragDone() const;
f32 getDefragProgress() const;
void registerFactory(sead::ResourceFactory* factory, const sead::SafeString& name);
void unregisterFactory(sead::ResourceFactory* factory);
s32 getCacheIdx(const sead::SafeString& path) const;
void cancelTasks();
+9
View File
@@ -1,4 +1,5 @@
#include "KingSystem/Resource/resSystem.h"
#include "KingSystem/Resource/resEntryFactory.h"
#include "KingSystem/Resource/resResourceMgrTask.h"
namespace ksys::res {
@@ -7,6 +8,14 @@ bool stubbedLogFunction() {
return true;
}
void registerEntryFactory(EntryFactoryBase* factory, const sead::SafeString& name) {
ResourceMgrTask::instance()->registerFactory(factory, name);
}
void unregisterEntryFactory(EntryFactoryBase* factory) {
ResourceMgrTask::instance()->unregisterFactory(factory);
}
bool isHostPath(const sead::SafeString& path) {
return ResourceMgrTask::instance()->isHostPath(path);
}