diff options
| author | Léo Lam <leo@leolam.fr> | 2020-08-20 11:02:59 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2020-08-20 11:26:23 +0200 |
| commit | c9207a3cc3e18c6746998d5d99f6ed5f38a83c86 (patch) | |
| tree | 5a0d2dccaf1f2489f94c056599d3ce3d77c392af /src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp | |
| parent | 7e96f826c09cc49a52fe03c765141a8f295b1091 (diff) | |
ksys/act: Implement act::acquireProc
Diffstat (limited to 'src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp')
| -rw-r--r-- | src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp index 3eda6bcd..91a3c860 100644 --- a/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp +++ b/src/KingSystem/ActorSystem/actActorLinkConstDataAccess.cpp @@ -1,5 +1,7 @@ #include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h" #include "KingSystem/ActorSystem/actBaseProc.h" +#include "KingSystem/ActorSystem/actBaseProcMgr.h" +#include "KingSystem/Utils/Debug.h" namespace ksys::act { @@ -20,9 +22,7 @@ bool ActorLinkConstDataAccess::acquire(BaseProc* proc) { mProc = nullptr; } - if (proc) - return proc->acquire(*this); - return false; + return proc && proc->acquire(*this); } bool ActorLinkConstDataAccess::hasProc(BaseProc* proc) const { @@ -33,4 +33,24 @@ void ActorLinkConstDataAccess::debugLog(s32, const sead::SafeString&) { // Intentionally left empty. } +bool acquireProc(ActorLinkConstDataAccess* accessor, BaseProc* proc, const sead::SafeString& from) { + 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 |
