ksys/phys: Start adding StaticCompound (very incomplete)

This commit is contained in:
Léo Lam 2022-01-04 19:24:04 +01:00
parent 3f33ba5d59
commit 2359ce6fb4
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
6 changed files with 143 additions and 8 deletions

View File

@ -84177,7 +84177,7 @@ Address,Quality,Size,Name
0x0000007100fc9b48,U,000092,
0x0000007100fc9ba4,U,000140,
0x0000007100fc9c30,U,000140,
0x0000007100fc9cbc,U,000208,ResourceHksc::ctor
0x0000007100fc9cbc,O,000208,_ZN4ksys4phys14StaticCompoundC1Ev
0x0000007100fc9d8c,U,000352,ResourceHksc::dtor
0x0000007100fc9eec,U,000008,
0x0000007100fc9ef4,U,000036,ResourceHksc::dtorDelete
@ -84197,12 +84197,12 @@ Address,Quality,Size,Name
0x0000007100fcac2c,U,000112,
0x0000007100fcac9c,U,000112,
0x0000007100fcad0c,U,000328,
0x0000007100fcae54,U,000028,ResourceHksc::getFieldBodyGroup
0x0000007100fcae70,U,000084,
0x0000007100fcaec4,U,000008,ResourceHksc::m0
0x0000007100fcaecc,U,000092,ResourceHksc::m1
0x0000007100fcaf28,U,000008,ResourceHksc::needsParse
0x0000007100fcaf30,U,000372,
0x0000007100fcae54,O,000028,_ZN4ksys4phys14StaticCompound17getFieldBodyGroupEi
0x0000007100fcae70,O,000084,_ZNK4ksys4phys14StaticCompound17hasFieldBodyGroupEPNS0_14FieldBodyGroupE
0x0000007100fcaec4,O,000008,_ZNK4ksys4phys14StaticCompound27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100fcaecc,O,000092,_ZNK4ksys4phys14StaticCompound18getRuntimeTypeInfoEv
0x0000007100fcaf28,O,000008,_ZNK4ksys4phys14StaticCompound10needsParseEv
0x0000007100fcaf30,O,000372,_ZN4ksys4phys14StaticCompound33checkDerivedRuntimeTypeInfoStaticEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100fcb0a4,U,000004,nullsub_5551
0x0000007100fcb0a8,U,000004,nullsub_5552
0x0000007100fcb0ac,U,000136,
@ -84230,7 +84230,7 @@ Address,Quality,Size,Name
0x0000007100fcbbe4,U,000176,
0x0000007100fcbc94,U,000324,
0x0000007100fcbdd8,U,000104,
0x0000007100fcbe40,U,000168,FieldBodyGroup::ctor
0x0000007100fcbe40,O,000168,_ZN4ksys4phys14FieldBodyGroupC1Ev
0x0000007100fcbee8,U,000288,
0x0000007100fcc008,U,001492,FieldBodyGroup::init
0x0000007100fcc5dc,U,000120,

Can't render this file because it is too large.

View File

@ -1,10 +1,12 @@
target_sources(uking PRIVATE
Cloth/physClothParam.cpp
Cloth/physClothParam.h
Ragdoll/physRagdollConfig.cpp
Ragdoll/physRagdollConfig.h
Ragdoll/physRagdollParam.cpp
Ragdoll/physRagdollParam.h
RigidBody/physEdgeRigidBodyParam.cpp
RigidBody/physEdgeRigidBodyParam.h
RigidBody/physMotionAccessor.cpp
@ -27,11 +29,18 @@ target_sources(uking PRIVATE
RigidBody/Shape/physSphereShape.h
RigidBody/Shape/physWaterCylinderShape.cpp
RigidBody/Shape/physWaterCylinderShape.h
StaticCompound/physStaticCompound.cpp
StaticCompound/physStaticCompound.h
StaticCompound/physStaticCompoundFieldBodyGroup.cpp
StaticCompound/physStaticCompoundFieldBodyGroup.h
SupportBone/physSupportBoneParam.cpp
SupportBone/physSupportBoneParam.h
SupportBone/physSupportBoneResource.cpp
SupportBone/physSupportBoneResource.h
SupportBone/physSupportBoneResourceMainBone.cpp
System/physCharacterControllerParam.cpp
System/physCharacterControllerParam.h
System/physConstraint.cpp

View File

@ -0,0 +1,24 @@
#include "KingSystem/Physics/StaticCompound/physStaticCompound.h"
#include "KingSystem/Physics/StaticCompound/physStaticCompoundFieldBodyGroup.h"
namespace ksys::phys {
StaticCompound::StaticCompound() = default;
StaticCompound::~StaticCompound() {
// FIXME
}
FieldBodyGroup* StaticCompound::getFieldBodyGroup(int idx) {
return &mFieldBodyGroups[idx];
}
bool StaticCompound::hasFieldBodyGroup(FieldBodyGroup* group) const {
for (int i = 0, n = mFieldBodyGroups.size(); i < n; ++i) {
if (&mFieldBodyGroups[i] == group)
return true;
}
return false;
}
} // namespace ksys::phys

View File

@ -0,0 +1,53 @@
#pragma once
#include <basis/seadTypes.h>
#include <container/seadBuffer.h>
#include <hostio/seadHostIONode.h>
#include <math/seadMatrix.h>
#include <prim/seadSafeString.h>
#include <prim/seadTypedBitFlag.h>
#include <thread/seadCriticalSection.h>
#include "KingSystem/Resource/resResource.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::phys {
class FieldBodyGroup;
class StaticCompound : public res::Resource, public sead::hostio::Node {
SEAD_RTTI_OVERRIDE(StaticCompound, res::Resource)
public:
StaticCompound();
~StaticCompound() override;
FieldBodyGroup* getFieldBodyGroup(int idx);
bool hasFieldBodyGroup(FieldBodyGroup* group) const;
// res::Resource interface
void doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) override;
bool needsParse() const override { return true; }
bool finishParsing_() override;
bool m7_() override;
private:
enum class Flag {
Initialised = 1 << 0,
};
sead::TypedBitFlag<Flag> mFlags;
sead::Heap* mHeap{};
void* _50{};
void* mData{};
int _60{};
void* _68{};
int _70{};
sead::Buffer<FieldBodyGroup> mFieldBodyGroups;
sead::FixedSafeString<32> mName;
sead::Matrix34f mMtx = sead::Matrix34f::ident;
sead::Buffer<void*> _f0{};
sead::CriticalSection mCS;
};
KSYS_CHECK_SIZE_NX150(StaticCompound, 0x140);
} // namespace ksys::phys

View File

@ -0,0 +1,7 @@
#include "KingSystem/Physics/StaticCompound/physStaticCompoundFieldBodyGroup.h"
namespace ksys::phys {
FieldBodyGroup::FieldBodyGroup() = default;
} // namespace ksys::phys

View File

@ -0,0 +1,42 @@
#pragma once
#include <basis/seadTypes.h>
#include <container/seadBuffer.h>
#include <container/seadPtrArray.h>
#include <math/seadMatrix.h>
#include <math/seadVector.h>
#include <thread/seadAtomic.h>
#include "KingSystem/Utils/Types.h"
namespace ksys::phys {
class RigidBody;
class StaticCompound;
class FieldBodyGroup {
public:
FieldBodyGroup();
~FieldBodyGroup();
FieldBodyGroup(const FieldBodyGroup&) = delete;
auto operator=(const FieldBodyGroup&) = delete;
sead::Atomic<u32> _0;
sead::Atomic<u32> _4;
sead::Buffer<void*> _8;
sead::Buffer<void*> _18;
sead::Buffer<void*> _28;
sead::Buffer<void*> _38;
sead::Matrix34f mMtx0 = sead::Matrix34f::ident;
sead::Matrix34f mMtx1 = sead::Matrix34f::ident;
sead::Matrix34f* mMtxPtr{};
sead::PtrArray<RigidBody> mRigidBodies;
StaticCompound* mStaticCompound{};
sead::Vector3f _c8 = sead::Vector3f::zero;
sead::Vector3f _d4 = sead::Vector3f::zero;
u32 _e0{};
sead::Buffer<void*> _e8;
};
KSYS_CHECK_SIZE_NX150(FieldBodyGroup, 0xf8);
} // namespace ksys::phys