diff options
| author | Michael Zhao <44533763+Pistonight@users.noreply.github.com> | 2026-07-30 17:06:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-30 17:06:14 -0700 |
| commit | 7c65472576f5857bbcca71697f5e71aa93af6f8c (patch) | |
| tree | dc415e01bcc296d7312aaf6cd6c94367b6cac394 /src/KingSystem/Physics/System/physSystem.cpp | |
| parent | 4f1f92f132249b67316565ff5cb2fb4370c5c725 (diff) | |
| parent | c6c8beaf58523d2bc045e4753ac6ad8736d317f3 (diff) | |
Match phys::System heap accessors
Diffstat (limited to 'src/KingSystem/Physics/System/physSystem.cpp')
| -rw-r--r-- | src/KingSystem/Physics/System/physSystem.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/KingSystem/Physics/System/physSystem.cpp b/src/KingSystem/Physics/System/physSystem.cpp index ef55e1f1..acc926fc 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" @@ -16,6 +18,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" @@ -133,4 +136,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 |
