diff options
| author | RobbyV2 <robby@robby.blue> | 2026-07-29 18:38:52 -0400 |
|---|---|---|
| committer | RobbyV2 <robby@robby.blue> | 2026-07-30 09:07:17 -0400 |
| commit | c6c8beaf58523d2bc045e4753ac6ad8736d317f3 (patch) | |
| tree | 875f79ee11a9df633c9fb6cc78ee177e33d69c7a /src/KingSystem | |
| parent | cd3e7a9fbd5f76e23b4f4b837ee122659c60a4b3 (diff) | |
phys: match System heap accessors
Diffstat (limited to 'src/KingSystem')
| -rw-r--r-- | src/KingSystem/Physics/System/physSystem.cpp | 21 | ||||
| -rw-r--r-- | src/KingSystem/Physics/System/physSystem.h | 7 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/KingSystem/Physics/System/physSystem.cpp b/src/KingSystem/Physics/System/physSystem.cpp index e9a1ffb5..b320a04e 100644 --- a/src/KingSystem/Physics/System/physSystem.cpp +++ b/src/KingSystem/Physics/System/physSystem.cpp @@ -1,4 +1,6 @@ #include "KingSystem/Physics/System/physSystem.h" +#include <heap/seadHeap.h> +#include <thread/seadThread.h> #include "KingSystem/Physics/Cloth/physClothResource.h" #include "KingSystem/Physics/Ragdoll/physRagdollControllerKeyList.h" #include "KingSystem/Physics/Ragdoll/physRagdollResource.h" @@ -14,6 +16,7 @@ #include "KingSystem/Physics/System/physRayCastRequestMgr.h" #include "KingSystem/Physics/System/physSensorGroupFilter.h" #include "KingSystem/Physics/System/physSystemData.h" +#include "KingSystem/Physics/physHavokMemoryAllocator.h" #include "KingSystem/Resource/resEntryFactory.h" #include "KingSystem/Resource/resSystem.h" @@ -110,4 +113,22 @@ RagdollControllerKeyList* System::getRagdollCtrlKeyList() const { return mSystemData->getRagdollCtrlKeyList(); } +bool System::isHavokMainHeapOom() const { + return static_cast<f32>(mHavokAllocator->getHeapFreeSize()) / + static_cast<f32>(mHavokAllocator->getHeapSize()) < + 0.05f; +} + +sead::Heap* System::getPhysicsTempHeap(LowPriority low_priority) const { + if (low_priority != LowPriority::No || + sead::ThreadMgr::instance()->getCurrentThread()->getPriority() > + sead::Thread::cDefaultPriority) + return mPhysicsTempLowHeap; + + if (mPhysicsTempDefaultHeap->getMaxAllocatableSize(8) <= 0x2800) + mPhysicsTempDefaultHeap->dump(); + + return mPhysicsTempDefaultHeap; +} + } // namespace ksys::phys diff --git a/src/KingSystem/Physics/System/physSystem.h b/src/KingSystem/Physics/System/physSystem.h index 1bd55360..765f4ce4 100644 --- a/src/KingSystem/Physics/System/physSystem.h +++ b/src/KingSystem/Physics/System/physSystem.h @@ -17,6 +17,7 @@ class ContactLayerCollisionInfoGroup; class ContactMgr; class ContactPointInfo; class GroupFilter; +class HavokMemoryAllocator; class LayerContactPointInfo; class MaterialTable; class RayCastForRequest; @@ -132,7 +133,8 @@ public: // 0x000000710121684c void decrementWorldUnkCounter(ContactLayerType layer_type); - // 0x0000007101216cec + bool isHavokMainHeapOom() const; + sead::Heap* getPhysicsTempHeap(LowPriority low_priority) const; private: @@ -144,7 +146,8 @@ private: float _6c = 1.0; float _70 = 1.0 / 30.0; float mTimeFactor{}; - u8 _78[0xa8 - 0x78]; + HavokMemoryAllocator* mHavokAllocator{}; + u8 _80[0xa8 - 0x80]; sead::CriticalSection mCS; void* _e8{}; void* _f0{}; |
