mirror of
https://github.com/zeldaret/botw
synced 2026-06-28 02:23:01 -04:00
ksys/res: Implement more ResourceMgrTask functions
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <resource/seadResourceMgr.h>
|
||||
#include <resource/seadSZSDecompressor.h>
|
||||
#include <thread/seadThreadUtil.h>
|
||||
#include "KingSystem/Framework/frmWorkerSupportThreadMgr.h"
|
||||
#include "KingSystem/Resource/resCache.h"
|
||||
#include "KingSystem/Resource/resCompactedHeap.h"
|
||||
#include "KingSystem/Resource/resEntryFactory.h"
|
||||
@@ -414,6 +415,11 @@ bool ResourceMgrTask::calc_(void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResourceMgrTask::callSystemCalc_(void* userdata) {
|
||||
systemCalc_();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResourceMgrTask::dropSFromExtensionIfNeeded(const sead::SafeString& path,
|
||||
sead::BufferedSafeString& new_path, s32 dot_idx,
|
||||
const sead::SafeString& extension) const {
|
||||
@@ -633,6 +639,41 @@ bool ResourceMgrTask::getUncompressedSize(u32* size, const sead::SafeString& pat
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResourceMgrTask::clearUnits_() {
|
||||
const auto lock = sead::makeScopedLock(mUnitsCS);
|
||||
|
||||
const int num_units = mUnits.size();
|
||||
if (num_units != 0 && returnFalse())
|
||||
stubbedLogFunction();
|
||||
|
||||
for (auto it = mUnits.robustBegin(), end = mUnits.robustEnd(); it != end; ++it) {
|
||||
ResourceUnit* unit = &*it;
|
||||
if (it->mTask3.canSubmitRequest()) {
|
||||
mUnits.erase(unit);
|
||||
requestClearCache(&unit);
|
||||
}
|
||||
}
|
||||
|
||||
if (mUnits.size() != 0 || (num_units != 0 && returnFalse()))
|
||||
stubbedLogFunction();
|
||||
}
|
||||
|
||||
void ResourceMgrTask::systemCalc_() {
|
||||
if (mTask1->canSubmitRequest()) {
|
||||
util::TaskRequest request;
|
||||
request.mSynchronous = false;
|
||||
request.mHasHandle = false;
|
||||
request.mLaneId = u8(LaneId::_6);
|
||||
request.mThread = mResourceControlThread;
|
||||
request.mName = "res::System::calc";
|
||||
mTask1->submitRequest(request);
|
||||
}
|
||||
|
||||
mTexHandleMgr->preCalc();
|
||||
updateCompaction();
|
||||
mTexHandleMgr->calc();
|
||||
}
|
||||
|
||||
// reordering
|
||||
#ifdef NON_MATCHING
|
||||
void ResourceMgrTask::setCompactionStopped(bool stopped) {
|
||||
@@ -652,6 +693,14 @@ bool ResourceMgrTask::isCompactionStopped() const {
|
||||
return mCompactionCounter == 0;
|
||||
}
|
||||
|
||||
void ResourceMgrTask::requestCalc() {
|
||||
frm::WorkerSupportThreadMgr::instance()->submitRequest(2, &mSystemCalcFn);
|
||||
}
|
||||
|
||||
void ResourceMgrTask::waitForCalc() {
|
||||
frm::WorkerSupportThreadMgr::instance()->waitForTask(2);
|
||||
}
|
||||
|
||||
bool ResourceMgrTask::initTempResourceLoader(TempResourceLoader* loader,
|
||||
TempResourceLoader::InitArg& arg) {
|
||||
arg.work = mTexHandleMgr->getArchiveWork();
|
||||
|
||||
@@ -219,9 +219,13 @@ public:
|
||||
bool getUncompressedSize(u32* size, const sead::SafeString& path,
|
||||
sead::FileDevice* device) const;
|
||||
|
||||
void updateCompaction();
|
||||
void setCompactionStopped(bool stopped);
|
||||
bool isCompactionStopped() const;
|
||||
|
||||
void requestCalc();
|
||||
void waitForCalc();
|
||||
|
||||
bool initTempResourceLoader(TempResourceLoader* loader, TempResourceLoader::InitArg& arg);
|
||||
|
||||
bool returnTrue1();
|
||||
@@ -290,6 +294,7 @@ private:
|
||||
~ResourceMgrTask();
|
||||
|
||||
bool calc_(void* userdata);
|
||||
void systemCalc_();
|
||||
bool callSystemCalc_(void* userdata);
|
||||
void clearUnits_();
|
||||
static void setInstance(ResourceMgrTask* task);
|
||||
|
||||
@@ -9,6 +9,9 @@ class TextureHandleMgr {
|
||||
public:
|
||||
virtual ~TextureHandleMgr();
|
||||
|
||||
void preCalc();
|
||||
void calc();
|
||||
|
||||
ArchiveWork* getArchiveWork() const;
|
||||
void clearAllCache();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user