Merge pull request #180 from mairokaizo/pr/physsystem

ksys::phys::System: implement isPaused and collision/handler helpers
This commit is contained in:
Michael Zhao
2026-07-29 20:46:17 -07:00
committed by GitHub
3 changed files with 50 additions and 10 deletions
+8 -8
View File
@@ -93556,7 +93556,7 @@ Address,Quality,Size,Name
0x00000071012166cc,U,000116,
0x0000007101216740,U,000060,PhysicsMemSys::calc
0x000000710121677c,U,000012,PhysicsMemSys::setPauseState
0x0000007101216788,U,000008,_ZNK4ksys4phys6System8isPausedEv
0x0000007101216788,O,000008,_ZNK4ksys4phys6System8isPausedEv
0x0000007101216790,U,000092,PhysicsMemSys::__auto17
0x00000071012167ec,U,000020,PhysicsMemSys::__auto11
0x0000007101216800,U,000020,PhysicsMemSys::setEntityContactListenerField91
@@ -93565,7 +93565,7 @@ Address,Quality,Size,Name
0x0000007101216828,U,000004,nullsub_4711
0x000000710121682c,U,000032,
0x000000710121684c,U,000032,
0x000000710121686c,U,000040,_ZN4ksys4phys6System21addSystemGroupHandlerENS0_16ContactLayerTypeEi
0x000000710121686c,O,000040,_ZN4ksys4phys6System21addSystemGroupHandlerENS0_16ContactLayerTypeEi
0x0000007101216894,U,000052,
0x00000071012168c8,U,000052,
0x00000071012168fc,O,000008,_ZNK4ksys4phys6System21allocContactPointInfoEPN4sead4HeapEiRKNS2_14SafeStringBaseIcEEiii
@@ -93575,18 +93575,18 @@ Address,Quality,Size,Name
0x0000007101216964,O,000008,_ZNK4ksys4phys6System24registerContactPointInfoEPNS0_16ContactPointInfoE
0x000000710121696c,U,000008,PhysicsMemSys::x_3
0x0000007101216974,U,000048,_ZN4ksys4phys6System29registerContactPointLayerPairEPNS0_21LayerContactPointInfoENS0_12ContactLayerES4_b
0x00000071012169a4,U,000008,_ZNK4ksys4phys6System18allocCollisionInfoEPN4sead4HeapERKNS2_14SafeStringBaseIcEE
0x00000071012169ac,U,000008,_ZNK4ksys4phys6System17freeCollisionInfoEPNS0_13CollisionInfoE
0x00000071012169b4,U,000012,_ZN4ksys4phys6System34makeContactLayerCollisionInfoGroupEPN4sead4HeapENS0_12ContactLayerEiRKNS2_14SafeStringBaseIcEE
0x00000071012169c0,U,000008,_ZN4ksys4phys6System34freeContactLayerCollisionInfoGroupEPNS0_30ContactLayerCollisionInfoGroupE
0x00000071012169a4,O,000008,_ZNK4ksys4phys6System18allocCollisionInfoEPN4sead4HeapERKNS2_14SafeStringBaseIcEE
0x00000071012169ac,O,000008,_ZNK4ksys4phys6System17freeCollisionInfoEPNS0_13CollisionInfoE
0x00000071012169b4,O,000012,_ZN4ksys4phys6System34makeContactLayerCollisionInfoGroupEPN4sead4HeapENS0_12ContactLayerEiRKNS2_14SafeStringBaseIcEE
0x00000071012169c0,O,000008,_ZN4ksys4phys6System34freeContactLayerCollisionInfoGroupEPNS0_30ContactLayerCollisionInfoGroupE
0x00000071012169c8,U,000088,_ZN4ksys4phys6System14trackLayerPairENS0_12ContactLayerES2_
0x0000007101216a20,U,000136,_ZN4ksys4phys6System32removeRigidBodyFromContactSystemEPNS0_9RigidBodyE
0x0000007101216aa8,U,000008,
0x0000007101216ab0,U,000008,
0x0000007101216ab8,U,000008,
0x0000007101216ac0,U,000008,
0x0000007101216ac8,U,000032,_ZNK4ksys4phys6System14getGroupFilterENS0_16ContactLayerTypeE
0x0000007101216ae8,U,000012,_ZN4ksys4phys6System19allocRayCastRequestEPNS0_18SystemGroupHandlerENS0_9GroundHitE
0x0000007101216ac8,O,000032,_ZNK4ksys4phys6System14getGroupFilterENS0_16ContactLayerTypeE
0x0000007101216ae8,O,000012,_ZN4ksys4phys6System19allocRayCastRequestEPNS0_18SystemGroupHandlerENS0_9GroundHitE
0x0000007101216af4,U,000276,
0x0000007101216c08,U,000080,PhysicsMemSys::isHavokMainHeapOom
0x0000007101216c58,U,000008,PhysicsMemSys::setRigidBodyDividedMeshShapeMgr
Can't render this file because it is too large.
@@ -9,7 +9,9 @@
#include "KingSystem/Physics/System/physContactMgr.h"
#include "KingSystem/Physics/System/physContactPointInfo.h"
#include "KingSystem/Physics/System/physEntityGroupFilter.h"
#include "KingSystem/Physics/System/physGroupFilter.h"
#include "KingSystem/Physics/System/physMaterialTable.h"
#include "KingSystem/Physics/System/physRayCastRequestMgr.h"
#include "KingSystem/Physics/System/physSensorGroupFilter.h"
#include "KingSystem/Physics/System/physSystemData.h"
#include "KingSystem/Resource/resEntryFactory.h"
@@ -19,6 +21,10 @@ namespace ksys::phys {
SEAD_SINGLETON_DISPOSER_IMPL(System)
bool System::isPaused() const {
return mPaused;
}
void System::initSystemData(sead::Heap* heap) {
res::registerEntryFactory(new (heap) res::EntryFactory<RigidBodyResource>(1.0, 0x400), "hkrb");
res::registerEntryFactory(new (heap) res::EntryFactory<RagdollResource>(1.0, 0x400), "hkrg");
@@ -57,6 +63,37 @@ void System::freeContactPointInfo(ContactPointInfo* info) const {
mContactMgr->freeContactPointInfo(info);
}
CollisionInfo* System::allocCollisionInfo(sead::Heap* heap, const sead::SafeString& name) const {
return mContactMgr->makeCollisionInfo(heap, name);
}
void System::freeCollisionInfo(CollisionInfo* info) const {
mContactMgr->freeCollisionInfo(info);
}
ContactLayerCollisionInfoGroup*
System::makeContactLayerCollisionInfoGroup(sead::Heap* heap, ContactLayer layer, int capacity,
const sead::SafeString& name) {
return mContactMgr->makeContactLayerCollisionInfoGroup(heap, layer, capacity, name);
}
void System::freeContactLayerCollisionInfoGroup(ContactLayerCollisionInfoGroup* group) {
mContactMgr->freeContactLayerCollisionInfoGroup(group);
}
GroupFilter* System::getGroupFilter(ContactLayerType type) const {
return mGroupFilters[static_cast<s32>(type)];
}
RayCastForRequest* System::allocRayCastRequest(SystemGroupHandler* group_handler,
GroundHit ground_hit) {
return mRayCastRequestMgr->allocRequest(group_handler, ground_hit);
}
SystemGroupHandler* System::addSystemGroupHandler(ContactLayerType layer_type, int free_list_idx) {
return getGroupFilter(layer_type)->addSystemGroupHandler(free_list_idx);
}
LayerContactPointInfo* System::allocLayerContactPointInfo(sead::Heap* heap, int num, int num2,
const sead::SafeString& name, int a,
int b, int c) const {
+5 -2
View File
@@ -20,6 +20,7 @@ class GroupFilter;
class LayerContactPointInfo;
class MaterialTable;
class RayCastForRequest;
class RayCastRequestMgr;
class RagdollControllerKeyList;
class RagdollInstanceMgr;
class RigidBody;
@@ -135,7 +136,9 @@ public:
sead::Heap* getPhysicsTempHeap(LowPriority low_priority) const;
private:
u8 _28[0x64 - 0x28];
u8 _28[0x60 - 0x28];
bool mPaused;
u8 _61[0x64 - 0x61];
float _64 = 1.0 / 30.0;
float _68 = 1.0 / 30.0;
float _6c = 1.0;
@@ -158,7 +161,7 @@ private:
void* mRigidBodyDividedMeshShapeMgr;
SystemData* mSystemData;
MaterialTable* mMaterialTable;
void* _188{};
RayCastRequestMgr* mRayCastRequestMgr{};
void* _190{};
void* _198{};
void* _1a0{};