ksys/act: Implement a couple more ActorParam functions

This commit is contained in:
Léo Lam
2020-11-08 01:44:58 +01:00
parent f9456b5b1c
commit 9eb8806b6f
5 changed files with 108 additions and 6 deletions
+3 -3
View File
@@ -89049,10 +89049,10 @@
0x000000710118576c,memsetSomeMemory,36,_ZN4ksys3act10ActorParam19resetDummyResourcesEv
0x0000007101185790,ActorParam::Event::ctor,244,_ZN4ksys3act10ActorParamC1Ev
0x0000007101185884,sub_7101185884,60,_ZN4ksys3act10ActorParamD1Ev
0x00000071011858c0,ActorParam::Data::doUnload,440,
0x00000071011858c0,ActorParam::Data::doUnload,440,_ZN4ksys3act10ActorParam10deleteDataEv?
0x0000007101185a78,sub_7101185A78,68,_ZN4ksys3act10ActorParamD0Ev
0x0000007101185abc,ActorParam::Load::deleteRes2,164,
0x0000007101185b60,ActorParam::Load::isDummyParamResource,136,
0x0000007101185abc,ActorParam::Load::deleteRes2,164,_ZN4ksys3act10ActorParam16deleteResHandlesEv
0x0000007101185b60,ActorParam::Load::isDummyParamResource,136,_ZNK4ksys3act10ActorParam12isDummyParamENS_3res9ActorLink5Users4UserE
0x0000007101185be8,ActorParam::Load::constructRes2,188,
0x0000007101185ca4,ActorParam::Event::incRefCount,72,
0x0000007101185cec,ActorParam::Data::unload,124,
Can't render this file because it is too large.
Binary file not shown.
+35 -1
View File
@@ -1,4 +1,5 @@
#include "KingSystem/ActorSystem/actActorParam.h"
#include <prim/seadScopedLock.h>
namespace ksys::act {
@@ -15,7 +16,40 @@ ActorParam::ActorParam() {
}
ActorParam::~ActorParam() {
finalize();
deleteData();
}
// NON_MATCHING: b.le -> b.lt
void ActorParam::deleteData() {
auto lock = sead::makeScopedLock(mCS);
if (mActorName.isEmpty())
return;
for (s32 i = 0; i < mNumHandles1; ++i)
mHandles1[i].requestUnload();
mNumHandles1 = 0;
for (s32 i = 0; i < mNumHandles2; ++i)
mHandles2[i].requestUnload();
mNumHandles2 = 0;
deleteResHandles();
mActorName = "";
_168 = 0;
_a = 0;
mRes = {};
mEvent.resetSignal();
}
void ActorParam::deleteResHandles() {
mHandles1.freeBuffer();
mHandles2.freeBuffer();
}
bool ActorParam::isDummyParam(res::ActorLink::Users::User user) const {
return mRes.mActorLink->getUsers().getUserName(user) == "Dummy";
}
} // namespace ksys::act
+35 -2
View File
@@ -8,11 +8,11 @@
#include "KingSystem/ActorSystem/actBaseProcJob.h"
#include "KingSystem/Resource/resHandle.h"
#include "KingSystem/Utils/Thread/Event.h"
#include "KingSystem/Resource/resResourceActorLink.h"
namespace ksys {
namespace res {
class ActorLink;
class AIProgram;
class AISchedule;
class AnimationInfo;
@@ -42,6 +42,34 @@ namespace act {
// FIXME: incomplete
class ActorParam : public sead::hostio::Node {
public:
enum class ResourceType {
ActorLink = 0,
ModelList = 1,
ASList = 2,
AIProgram = 3,
GParamList = 4,
Physics = 5,
Chemical = 6,
AttClientList = 7,
AISchedule = 8,
EventFlow = 9,
DamageParam = 10,
RagdollConfigList = 11,
RagdollBlendWeight = 12,
Awareness = 13,
Unknown14 = 14,
Unknown15 = 15,
Unknown16 = 16,
DropTable = 17,
ShopData = 18,
Recipe = 19,
Lod = 20,
BoneControl = 21,
LifeCondition = 22,
UMii = 23,
AnimationInfo = 24,
};
struct Resources {
res::ActorLink* mActorLink;
res::ModelList* mModelList;
@@ -74,6 +102,8 @@ public:
ActorParam();
virtual ~ActorParam();
bool isDummyParam(res::ActorLink::Users::User user) const;
u16 _8 = 0;
u8 _a = 0;
sead::FixedSafeString<64> mActorName;
@@ -93,7 +123,10 @@ public:
static Resources sDummyResources;
private:
void finalize();
friend class ActorParamMgr;
void deleteData();
void deleteResHandles();
sead::CriticalSection mCS{nullptr};
util::Event mEvent{nullptr,
@@ -14,6 +14,41 @@ class ActorLink : public ParamIO, public Resource {
SEAD_RTTI_OVERRIDE(ActorLink, Resource)
public:
struct Users {
enum class User {
Profile = 0,
ActorCapture = 1,
AS = 2,
Model = 3,
Anim = 4,
AIProgram = 5,
GParam = 6,
DamageParam = 7,
RgConfigList = 8,
RgBlendWeight = 9,
Awareness = 10,
Physics = 11,
Chemical = 12,
Attention = 13,
ELink = 14,
SLink = 15,
XLink = 16,
DropTable = 17,
ShopData = 18,
Recipe = 19,
LOD = 20,
BoneControl = 21,
AISchedule = 22,
LifeCondition = 23,
UMii = 24,
AnimationInfo = 25,
};
const agl::utl::Parameter<sead::SafeString>& getUser(User user) const {
return *(&profile + u32(user));
}
sead::SafeString getUserName(User user) const { return getUser(user).ref().cstr(); }
agl::utl::Parameter<sead::SafeString> profile;
agl::utl::Parameter<sead::SafeString> actor_capture;
agl::utl::Parameter<sead::SafeString> as;