1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#include "KingSystem/ActorSystem/actBaseProcUnit.h"
#include <prim/seadSafeString.h>
#include <prim/seadScopedLock.h>
#include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
#include "KingSystem/Utils/Debug.h"
namespace ksys::act {
// NON_MATCHING: Equivalent but branches are off.
bool BaseProcUnit::setProc(BaseProc* proc) {
bool ret;
static constexpr const char* sStateNames[] = {"Init", "Calc", "Sleep", "Delete"};
auto lock = sead::makeScopedLock(mCS);
if (mProc)
mProc = nullptr;
if (mHandle == &BaseProcHandle::sDummyHandle)
return false;
if (mHandle) {
if (mFlags != 1) {
sead::FixedSafeString<64> message;
if (proc)
message.format("%s, %d, %d, %s, ( %p:%p )", proc->getName().cstr(), mFlags,
proc->isInitialized(), sStateNames[u8(proc->getState())], this,
mHandle.load());
else
message.format("なし, %d, ?, ?, ( %p:%p )", mFlags, this, mHandle.load());
util::PrintDebug(message);
}
mProc = proc;
mFlags = 2;
ret = true;
} else {
sead::FixedSafeString<64> message;
if (proc)
message.format("%s, %d, %d, %s, ( %p:%p )", proc->getName().cstr(), mFlags,
proc->isInitialized(), sStateNames[u8(proc->getState())], this,
mHandle.load());
else
message.format("なし, %d, ?, ?, ( %p:%p )", mFlags, this, mHandle.load());
util::PrintDebug(message);
ret = false;
}
return ret;
}
bool BaseProcUnit::isParentHandleDefault() const {
return mHandle == &BaseProcHandle::sDummyHandle;
}
} // namespace ksys::act
|