From c29267564614d1421bbb2e4aab52743f2d71de98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Fri, 21 Jan 2022 12:39:01 +0100 Subject: ksys/phys: Rename MemSystem to System It was called MemSystem in the IDB because of a string in ksys::InitializeApp that referred to MemSystem initialisation as "Physics Memory System"; however that string actually referred to an initialisation step for the physics system, not to the name of the subsystem itself. --- src/KingSystem/Physics/System/physSystem.cpp | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/KingSystem/Physics/System/physSystem.cpp (limited to 'src/KingSystem/Physics/System/physSystem.cpp') diff --git a/src/KingSystem/Physics/System/physSystem.cpp b/src/KingSystem/Physics/System/physSystem.cpp new file mode 100644 index 00000000..df841497 --- /dev/null +++ b/src/KingSystem/Physics/System/physSystem.cpp @@ -0,0 +1,71 @@ +#include "KingSystem/Physics/System/physSystem.h" +#include "KingSystem/Physics/Cloth/physClothResource.h" +#include "KingSystem/Physics/Ragdoll/physRagdollControllerKeyList.h" +#include "KingSystem/Physics/Ragdoll/physRagdollResource.h" +#include "KingSystem/Physics/RigidBody/TeraMesh/physTeraMeshRigidBodyResource.h" +#include "KingSystem/Physics/RigidBody/physRigidBodyResource.h" +#include "KingSystem/Physics/StaticCompound/physStaticCompound.h" +#include "KingSystem/Physics/SupportBone/physSupportBoneResource.h" +#include "KingSystem/Physics/System/physContactMgr.h" +#include "KingSystem/Physics/System/physEntityGroupFilter.h" +#include "KingSystem/Physics/System/physMaterialTable.h" +#include "KingSystem/Physics/System/physRigidContactPoints.h" +#include "KingSystem/Physics/System/physSensorGroupFilter.h" +#include "KingSystem/Physics/System/physSystemData.h" +#include "KingSystem/Resource/resEntryFactory.h" +#include "KingSystem/Resource/resSystem.h" + +namespace ksys::phys { + +SEAD_SINGLETON_DISPOSER_IMPL(System) + +void System::initSystemData(sead::Heap* heap) { + res::registerEntryFactory(new (heap) res::EntryFactory(1.0, 0x400), "hkrb"); + res::registerEntryFactory(new (heap) res::EntryFactory(1.0, 0x400), "hkrg"); + res::registerEntryFactory(new (heap) res::EntryFactory(1.0, 0x100000), + "bphyssb"); + res::registerEntryFactory(new (heap) res::EntryFactory(2.0, 0x2800), "hkcl"); + res::registerEntryFactory(new (heap) res::EntryFactory(1.3, 0x40000), "hksc"); + res::registerEntryFactory(new (heap) res::EntryFactory(1.0, 0x800), + "hktmrb"); + res::registerEntryFactory(new (heap) res::EntryFactory(1.0, 0x4000), + "brgcon"); + + mEntityGroupFilter = EntityGroupFilter::make(ContactLayer::EntityObject, + ContactLayer::EntityMeshVisualizer, heap); + mSensorGroupFilter = SensorGroupFilter::make(ContactLayer::SensorCustomReceiver, heap); + mGroupFilters.pushBack(mEntityGroupFilter); + mGroupFilters.pushBack(mSensorGroupFilter); + + mContactMgr = new (heap) ContactMgr; + if (mContactMgr) + mContactMgr->init(heap); + + mMaterialTable = new (heap) MaterialTable; + + mSystemData = new (heap) SystemData; + mSystemData->load(mPhysicsSystemHeap, mEntityGroupFilter, mSensorGroupFilter, mMaterialTable, + mContactMgr); +} + +RigidContactPoints* System::allocContactPoints(sead::Heap* heap, int num, + const sead::SafeString& name, int a, int b, + int c) const { + return mContactMgr->allocContactPoints(heap, num, name, a, b, c); +} + +void System::freeContactPoints(RigidContactPoints* points) const { + mContactMgr->freeContactPoints(points); +} + +RigidContactPointsEx* System::allocContactPointsEx(sead::Heap* heap, int num, int num2, + const sead::SafeString& name, int a, int b, + int c) const { + return mContactMgr->allocContactPointsEx(heap, num, num2, name, a, b, c); +} + +void System::registerContactPoints(RigidContactPoints* points) const { + mContactMgr->registerContactPoints(points); +} + +} // namespace ksys::phys -- cgit v1.2.3