mirror of
https://github.com/zeldaret/botw
synced 2026-05-25 07:22:56 -04:00
7226150ed7
Also moves from functions from ActorLinkConstDataAccess (the base class for BaseProc) into the Actor-specific ActorConstDataAccess
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
|
|
#include "KingSystem/ActorSystem/actBaseProc.h"
|
|
#include "KingSystem/ActorSystem/actBaseProcMgr.h"
|
|
#include "KingSystem/Utils/Debug.h"
|
|
|
|
namespace ksys::act {
|
|
|
|
ActorLinkConstDataAccess::~ActorLinkConstDataAccess() {
|
|
if (mAcquired && mProc)
|
|
mProc->release();
|
|
|
|
mAcquired = false;
|
|
mProc = nullptr;
|
|
}
|
|
|
|
bool ActorLinkConstDataAccess::acquire(BaseProc* proc) {
|
|
if (mProc) {
|
|
if (mAcquired)
|
|
mProc->release();
|
|
|
|
mAcquired = false;
|
|
mProc = nullptr;
|
|
}
|
|
|
|
return proc && proc->acquire(*this);
|
|
}
|
|
|
|
bool acquireProc(ActorLinkConstDataAccess* accessor, BaseProc* proc, const sead::SafeString& from,
|
|
s32) {
|
|
bool acquired = false;
|
|
|
|
if (accessor) {
|
|
acquired = accessor->acquire(proc);
|
|
if (!acquired)
|
|
return false;
|
|
}
|
|
|
|
if (acquired || BaseProcMgr::instance()->isHighPriorityThread())
|
|
return true;
|
|
|
|
sead::FixedSafeString<256> message;
|
|
// (%s)Acquiring from a low priority thread. Please change via ActorLinkConstDataAccess
|
|
message.format("(%s)低スレッドからの取得です。ActorLinkConstDataAccess経由に変更お願いします",
|
|
from.cstr());
|
|
util::PrintDebug(message);
|
|
return false;
|
|
}
|
|
|
|
} // namespace ksys::act
|