From c6c8beaf58523d2bc045e4753ac6ad8736d317f3 Mon Sep 17 00:00:00 2001 From: RobbyV2 Date: Wed, 29 Jul 2026 18:38:52 -0400 Subject: phys: match System heap accessors --- src/KingSystem/Physics/System/physSystem.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/KingSystem/Physics/System/physSystem.cpp') 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 +#include #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(mHavokAllocator->getHeapFreeSize()) / + static_cast(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 -- cgit v1.2.3