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: [PATCH] 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. --- data/uking_functions.csv | 10 ++++----- src/KingSystem/Physics/CMakeLists.txt | 4 ++-- .../Physics/RigidBody/physRigidBody.cpp | 20 ++++++++--------- .../Physics/System/physContactMgr.cpp | 4 ++-- .../Physics/System/physEntityGroupFilter.cpp | 4 ++-- .../Physics/System/physGroupFilter.cpp | 4 ++-- .../Physics/System/physMaterialMask.cpp | 8 +++---- .../Physics/System/physRigidContactPoints.cpp | 6 ++--- .../System/physRigidContactPointsEx.cpp | 8 +++---- .../{physMemSystem.cpp => physSystem.cpp} | 22 +++++++++---------- .../System/{physMemSystem.h => physSystem.h} | 10 ++++----- 11 files changed, 50 insertions(+), 50 deletions(-) rename src/KingSystem/Physics/System/{physMemSystem.cpp => physSystem.cpp} (77%) rename src/KingSystem/Physics/System/{physMemSystem.h => physSystem.h} (95%) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 09dcd94b..5588a757 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -93408,7 +93408,7 @@ Address,Quality,Size,Name 0x0000007101214b04,U,000016,PhysicsMemSys::waitForResourceCreation 0x0000007101214b14,U,000136,PhysicsMemSys::x_0 0x0000007101214b9c,U,000564,PhysicsMemSys::initHeaps -0x0000007101214dd0,O,001416,_ZN4ksys4phys9MemSystem14initSystemDataEPN4sead4HeapE +0x0000007101214dd0,O,001416,_ZN4ksys4phys6System14initSystemDataEPN4sead4HeapE 0x0000007101215358,U,000092, 0x00000071012153b4,U,000120, 0x000000710121542c,U,000276, @@ -93443,11 +93443,11 @@ Address,Quality,Size,Name 0x000000710121686c,U,000040,PhysicsMemSys::addGroupFilterX 0x0000007101216894,U,000052, 0x00000071012168c8,U,000052, -0x00000071012168fc,O,000008,_ZNK4ksys4phys9MemSystem18allocContactPointsEPN4sead4HeapEiRKNS2_14SafeStringBaseIcEEiii -0x0000007101216904,O,000008,_ZNK4ksys4phys9MemSystem17freeContactPointsEPNS0_18RigidContactPointsE -0x000000710121690c,O,000008,_ZNK4ksys4phys9MemSystem20allocContactPointsExEPN4sead4HeapEiiRKNS2_14SafeStringBaseIcEEiii +0x00000071012168fc,O,000008,_ZNK4ksys4phys6System18allocContactPointsEPN4sead4HeapEiRKNS2_14SafeStringBaseIcEEiii +0x0000007101216904,O,000008,_ZNK4ksys4phys6System17freeContactPointsEPNS0_18RigidContactPointsE +0x000000710121690c,O,000008,_ZNK4ksys4phys6System20allocContactPointsExEPN4sead4HeapEiiRKNS2_14SafeStringBaseIcEEiii 0x0000007101216914,U,000080,PhysicsMemSys::freeContactPoints2 -0x0000007101216964,O,000008,_ZNK4ksys4phys9MemSystem21registerContactPointsEPNS0_18RigidContactPointsE +0x0000007101216964,O,000008,_ZNK4ksys4phys6System21registerContactPointsEPNS0_18RigidContactPointsE 0x000000710121696c,U,000008,PhysicsMemSys::x_3 0x0000007101216974,U,000048,PhysicsMemSys::x_2 0x00000071012169a4,U,000008,PhysicsMemSys::allocCollisionStuff diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index 32711838..31d62f2e 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -84,8 +84,6 @@ target_sources(uking PRIVATE System/physMaterialMask.h System/physMaterialTable.cpp System/physMaterialTable.h - System/physMemSystem.cpp - System/physMemSystem.h System/physParamSet.cpp System/physParamSet.h System/physRigidContactPoints.cpp @@ -96,6 +94,8 @@ target_sources(uking PRIVATE System/physSensorGroupFilter.h System/physShapeParam.cpp System/physShapeParam.h + System/physSystem.cpp + System/physSystem.h System/physSystemData.cpp System/physSystemData.h System/physUserTag.cpp diff --git a/src/KingSystem/Physics/RigidBody/physRigidBody.cpp b/src/KingSystem/Physics/RigidBody/physRigidBody.cpp index 39cc772d..dd832e3b 100644 --- a/src/KingSystem/Physics/RigidBody/physRigidBody.cpp +++ b/src/KingSystem/Physics/RigidBody/physRigidBody.cpp @@ -13,7 +13,7 @@ #include "KingSystem/Physics/RigidBody/physRigidBodyMotionSensor.h" #include "KingSystem/Physics/RigidBody/physRigidBodyParam.h" #include "KingSystem/Physics/RigidBody/physRigidBodyRequestMgr.h" -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" #include "KingSystem/Physics/System/physUserTag.h" #include "KingSystem/Physics/physConversions.h" @@ -185,7 +185,7 @@ void RigidBody::x_0() { if (mMotionAccessor) { const bool use_system_time_factor = hasFlag(Flag::UseSystemTimeFactor); - setTimeFactor(use_system_time_factor ? MemSystem::instance()->getTimeFactor() : 1.0f); + setTimeFactor(use_system_time_factor ? System::instance()->getTimeFactor() : 1.0f); if (isSensor()) { auto* accessor = sead::DynamicCast(mMotionAccessor); @@ -209,7 +209,7 @@ void RigidBody::setMotionFlag(MotionFlag flag) { if (mFlags.isOff(Flag::_20) && mFlags.isOff(Flag::UpdateRequested)) { mFlags.set(Flag::UpdateRequested); - MemSystem::instance()->getRigidBodyRequestMgr()->pushRigidBody(getLayerType(), this); + System::instance()->getRigidBodyRequestMgr()->pushRigidBody(getLayerType(), this); } } @@ -262,7 +262,7 @@ bool RigidBody::x_6() { setMotionFlag(MotionFlag::_2); result = false; } else if (mFlags.isOn(Flag::UpdateRequested)) { - MemSystem::instance()->getRigidBodyRequestMgr()->pushRigidBody(getLayerType(), this); + System::instance()->getRigidBodyRequestMgr()->pushRigidBody(getLayerType(), this); result = false; } @@ -353,7 +353,7 @@ MotionType RigidBody::getMotionType() const { void RigidBody::setContactPoints(RigidContactPoints* points) { mContactPoints = points; if (isFlag8Set() && mContactPoints && !mContactPoints->isLinked()) - MemSystem::instance()->registerContactPoints(points); + System::instance()->registerContactPoints(points); } void RigidBody::freeze(bool should_freeze, bool preserve_velocities, bool preserve_max_impulse) { @@ -619,7 +619,7 @@ float RigidBody::getMaxAngularVelocity() const { } void RigidBody::applyLinearImpulse(const sead::Vector3f& impulse) { - if (MemSystem::instance()->isPaused()) + if (System::instance()->isPaused()) return; if (hasFlag(Flag::_400) || hasFlag(Flag::_40)) @@ -635,7 +635,7 @@ void RigidBody::applyLinearImpulse(const sead::Vector3f& impulse) { } void RigidBody::applyAngularImpulse(const sead::Vector3f& impulse) { - if (MemSystem::instance()->isPaused()) + if (System::instance()->isPaused()) return; if (hasFlag(Flag::_400) || hasFlag(Flag::_40)) @@ -651,7 +651,7 @@ void RigidBody::applyAngularImpulse(const sead::Vector3f& impulse) { } void RigidBody::applyPointImpulse(const sead::Vector3f& impulse, const sead::Vector3f& point) { - if (MemSystem::instance()->isPaused()) + if (System::instance()->isPaused()) return; if (hasFlag(Flag::_400) || hasFlag(Flag::_40)) @@ -1083,7 +1083,7 @@ void RigidBody::lock() { void RigidBody::lock(bool also_lock_world) { if (also_lock_world) - MemSystem::instance()->lockWorld(getLayerType()); + System::instance()->lockWorld(getLayerType()); lock(); } @@ -1094,7 +1094,7 @@ void RigidBody::unlock() { void RigidBody::unlock(bool also_unlock_world) { unlock(); if (also_unlock_world) - MemSystem::instance()->unlockWorld(getLayerType()); + System::instance()->unlockWorld(getLayerType()); } hkpMotion* RigidBody::getMotion() const { diff --git a/src/KingSystem/Physics/System/physContactMgr.cpp b/src/KingSystem/Physics/System/physContactMgr.cpp index 7af57a4f..51f6949f 100644 --- a/src/KingSystem/Physics/System/physContactMgr.cpp +++ b/src/KingSystem/Physics/System/physContactMgr.cpp @@ -2,9 +2,9 @@ #include #include "KingSystem/Physics/System/physEntityGroupFilter.h" #include "KingSystem/Physics/System/physGroupFilter.h" -#include "KingSystem/Physics/System/physMemSystem.h" #include "KingSystem/Physics/System/physRigidContactPoints.h" #include "KingSystem/Physics/System/physRigidContactPointsEx.h" +#include "KingSystem/Physics/System/physSystem.h" namespace ksys::phys { @@ -53,7 +53,7 @@ void ContactMgr::doLoadContactInfoTable(agl::utl::ResParameterArchive archive, const auto root = archive.getRootList(); const auto names = root.getResParameterObj(0); - const auto* filter = MemSystem::instance()->getGroupFilter(type); + const auto* filter = System::instance()->getGroupFilter(type); const auto layer_base = static_cast(getContactLayerBase(type)); for (int i = 0; i < table.receivers.size(); ++i) { diff --git a/src/KingSystem/Physics/System/physEntityGroupFilter.cpp b/src/KingSystem/Physics/System/physEntityGroupFilter.cpp index 63e65733..e6879ca0 100644 --- a/src/KingSystem/Physics/System/physEntityGroupFilter.cpp +++ b/src/KingSystem/Physics/System/physEntityGroupFilter.cpp @@ -8,7 +8,7 @@ #include #include #include "KingSystem/Physics/System/physContactMgr.h" -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" #include "KingSystem/Utils/BitField.h" #include "KingSystem/Utils/HeapUtil.h" @@ -59,7 +59,7 @@ void receiverMaskEnableLayer(ReceiverMask* mask, ContactLayer layer) { bool receiverMaskGetSensorLayerMaskForType(ReceiverMask* mask, const sead::SafeString& receiver_type) { - return MemSystem::instance()->getContactMgr()->getSensorLayerMask(mask, receiver_type); + return System::instance()->getContactMgr()->getSensorLayerMask(mask, receiver_type); } void receiverMaskSetSensorLayerMask(ReceiverMask* mask, u32 layer_mask) { diff --git a/src/KingSystem/Physics/System/physGroupFilter.cpp b/src/KingSystem/Physics/System/physGroupFilter.cpp index c8f0df8d..9bb8c3c8 100644 --- a/src/KingSystem/Physics/System/physGroupFilter.cpp +++ b/src/KingSystem/Physics/System/physGroupFilter.cpp @@ -1,6 +1,6 @@ #include "KingSystem/Physics/System/physGroupFilter.h" #include -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" namespace ksys::phys { @@ -55,7 +55,7 @@ u32 SystemGroupHandler::m7() { } void SystemGroupHandler::removeThis() { - MemSystem::instance()->removeSystemGroupHandler(this); + System::instance()->removeSystemGroupHandler(this); } } // namespace ksys::phys diff --git a/src/KingSystem/Physics/System/physMaterialMask.cpp b/src/KingSystem/Physics/System/physMaterialMask.cpp index 9a2072a6..c468c76d 100644 --- a/src/KingSystem/Physics/System/physMaterialMask.cpp +++ b/src/KingSystem/Physics/System/physMaterialMask.cpp @@ -1,6 +1,6 @@ #include "KingSystem/Physics/System/physMaterialMask.h" #include "KingSystem/Physics/System/physMaterialTable.h" -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" namespace ksys::phys { @@ -57,15 +57,15 @@ const char* MaterialMask::getSubMaterialName() const { } int MaterialMask::getSubMaterialIdx(Material mat, const sead::SafeString& submat_name) { - return MemSystem::instance()->getMaterialTable()->getSubMaterialIdx(mat, submat_name); + return System::instance()->getMaterialTable()->getSubMaterialIdx(mat, submat_name); } const sead::SafeString& MaterialMask::getSubMaterialName(Material mat, int submat_idx) { - return MemSystem::instance()->getMaterialTable()->getSubMaterial(mat, submat_idx); + return System::instance()->getMaterialTable()->getSubMaterial(mat, submat_idx); } int MaterialMask::getNumSubMaterials(Material mat) { - return MemSystem::instance()->getMaterialTable()->getNumSubMaterials(mat); + return System::instance()->getMaterialTable()->getNumSubMaterials(mat); } const sead::SafeString& MaterialMask::getSubMaterialName(int mat, int submat_idx) { diff --git a/src/KingSystem/Physics/System/physRigidContactPoints.cpp b/src/KingSystem/Physics/System/physRigidContactPoints.cpp index 9170491a..5bc63b34 100644 --- a/src/KingSystem/Physics/System/physRigidContactPoints.cpp +++ b/src/KingSystem/Physics/System/physRigidContactPoints.cpp @@ -1,15 +1,15 @@ #include "KingSystem/Physics/System/physRigidContactPoints.h" -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" namespace ksys::phys { RigidContactPoints* RigidContactPoints::make(sead::Heap* heap, int num, const sead::SafeString& name, int a, int b, int c) { - return MemSystem::instance()->allocContactPoints(heap, num, name, a, b, c); + return System::instance()->allocContactPoints(heap, num, name, a, b, c); } void RigidContactPoints::free(RigidContactPoints* instance) { - MemSystem::instance()->freeContactPoints(instance); + System::instance()->freeContactPoints(instance); } RigidContactPoints::RigidContactPoints(const sead::SafeString& name, int a, int b, int c) diff --git a/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp b/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp index 58a6a925..ed868ec9 100644 --- a/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp +++ b/src/KingSystem/Physics/System/physRigidContactPointsEx.cpp @@ -1,17 +1,17 @@ #include "KingSystem/Physics/System/physRigidContactPointsEx.h" #include "KingSystem/Physics/System/physContactMgr.h" -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" namespace ksys::phys { RigidContactPointsEx* RigidContactPointsEx::make(sead::Heap* heap, int num, int num2, const sead::SafeString& name, int a, int b, int c) { - return MemSystem::instance()->allocContactPointsEx(heap, num, num2, name, a, b, c); + return System::instance()->allocContactPointsEx(heap, num, num2, name, a, b, c); } void RigidContactPointsEx::free(RigidContactPointsEx* instance) { - MemSystem::instance()->freeContactPointsEx(instance); + System::instance()->freeContactPointsEx(instance); } bool RigidContactPointsEx::registerLayerPair(ContactLayer layer1, ContactLayer layer2, @@ -30,7 +30,7 @@ bool RigidContactPointsEx::registerLayerPair(ContactLayer layer1, ContactLayer l entry->layer1 = layer1; entry->layer2 = layer2; entry->enabled = enabled; - [&] { MemSystem::instance()->registerContactPointLayerPair(this, layer1, layer2, enabled); }(); + [&] { System::instance()->registerContactPointLayerPair(this, layer1, layer2, enabled); }(); return true; } diff --git a/src/KingSystem/Physics/System/physMemSystem.cpp b/src/KingSystem/Physics/System/physSystem.cpp similarity index 77% rename from src/KingSystem/Physics/System/physMemSystem.cpp rename to src/KingSystem/Physics/System/physSystem.cpp index 9bf4af62..df841497 100644 --- a/src/KingSystem/Physics/System/physMemSystem.cpp +++ b/src/KingSystem/Physics/System/physSystem.cpp @@ -1,4 +1,4 @@ -#include "KingSystem/Physics/System/physMemSystem.h" +#include "KingSystem/Physics/System/physSystem.h" #include "KingSystem/Physics/Cloth/physClothResource.h" #include "KingSystem/Physics/Ragdoll/physRagdollControllerKeyList.h" #include "KingSystem/Physics/Ragdoll/physRagdollResource.h" @@ -17,9 +17,9 @@ namespace ksys::phys { -SEAD_SINGLETON_DISPOSER_IMPL(MemSystem) +SEAD_SINGLETON_DISPOSER_IMPL(System) -void MemSystem::initSystemData(sead::Heap* heap) { +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), @@ -48,23 +48,23 @@ void MemSystem::initSystemData(sead::Heap* heap) { mContactMgr); } -RigidContactPoints* MemSystem::allocContactPoints(sead::Heap* heap, int num, - const sead::SafeString& name, int a, int b, - int c) const { +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 MemSystem::freeContactPoints(RigidContactPoints* points) const { +void System::freeContactPoints(RigidContactPoints* points) const { mContactMgr->freeContactPoints(points); } -RigidContactPointsEx* MemSystem::allocContactPointsEx(sead::Heap* heap, int num, int num2, - const sead::SafeString& name, int a, int b, - int c) const { +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 MemSystem::registerContactPoints(RigidContactPoints* points) const { +void System::registerContactPoints(RigidContactPoints* points) const { mContactMgr->registerContactPoints(points); } diff --git a/src/KingSystem/Physics/System/physMemSystem.h b/src/KingSystem/Physics/System/physSystem.h similarity index 95% rename from src/KingSystem/Physics/System/physMemSystem.h rename to src/KingSystem/Physics/System/physSystem.h index 218f915e..dcd2e556 100644 --- a/src/KingSystem/Physics/System/physMemSystem.h +++ b/src/KingSystem/Physics/System/physSystem.h @@ -24,10 +24,10 @@ enum class IsIndoorStage { Yes, }; -class MemSystem { - SEAD_SINGLETON_DISPOSER(MemSystem) - MemSystem(); - virtual ~MemSystem(); +class System { + SEAD_SINGLETON_DISPOSER(System) + System(); + virtual ~System(); public: float getTimeFactor() const { return mTimeFactor; } @@ -90,6 +90,6 @@ private: sead::Heap* mPhysicsTempLowHeap{}; u8 _1c8[0x480 - 0x1c8]; }; -KSYS_CHECK_SIZE_NX150(MemSystem, 0x480); +KSYS_CHECK_SIZE_NX150(System, 0x480); } // namespace ksys::phys