mirror of
https://github.com/zeldaret/botw
synced 2026-06-16 14:49:51 -04:00
ksys/res: Implement Handle destructor
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include <container/seadBuffer.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
#include <time/seadTickTime.h>
|
||||
#include "KingSystem/Resource/resResourceMgrTask.h"
|
||||
#include "KingSystem/Resource/resSystem.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
@@ -40,4 +42,31 @@ const sead::Buffer<const sead::SafeString> sStatusStrings{0x11, sStatusStrings_}
|
||||
|
||||
Handle::Handle() = default;
|
||||
|
||||
Handle::~Handle() {
|
||||
unload();
|
||||
}
|
||||
|
||||
void Handle::unload() {
|
||||
if (!mFlags.isOn(Flag::_2))
|
||||
return;
|
||||
|
||||
mFlags.reset(Flag::_7);
|
||||
mFlags.set(Flag::_4);
|
||||
|
||||
if (mTaskHandle.hasTask()) {
|
||||
mTaskHandle.removeTaskFromQueue();
|
||||
if (!mUnit) {
|
||||
stubbedLogFunction();
|
||||
mStatus = Status::_14;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mUnit)
|
||||
return;
|
||||
|
||||
if (ResourceMgrTask::instance())
|
||||
ResourceMgrTask::instance()->requestUnload(this);
|
||||
}
|
||||
|
||||
} // namespace ksys::res
|
||||
|
||||
Reference in New Issue
Block a user