Match phys::System heap accessors - #185
Merged
Merged
Conversation
Pistonight
requested changes
Jul 30, 2026
Pistonight
left a comment
Collaborator
There was a problem hiding this comment.
@Pistonight made 3 comments.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on RobbyV2).
src/KingSystem/Physics/System/physSystem.cpp line 3 at r1 (raw file):
#include "KingSystem/Physics/System/physSystem.h" #include <heap/seadHeap.h> #include <thread/seadThread.h>
looks like other files also have this issue but ...
can we put <> imports above "" imports?
( we should probably fix the clang format rules)
src/KingSystem/Physics/System/physSystem.cpp line 80 at r1 (raw file):
bool System::isHavokMainHeapOom() const { return f32(mHavokAllocator->getHeapFreeSize()) / f32(mHavokAllocator->getHeapSize()) < 0.05f;
nit: prefer c++ cast static_cast<f32>
src/KingSystem/Physics/System/physSystem.cpp line 91 at r1 (raw file):
return mPhysicsTempDefaultHeap; } return mPhysicsTempLowHeap;
does changing to guard-style work?
if (low_priority != LowPriority::No) {
return mPhysicsTempLowHeap;
}
if (sead::ThreadMgr::instance()->getCurrentThread()->getPriority() > sead::Thread::cDefaultPriority) {
return mPhysicsTempLowHeap;
}
if (mPhysicsTempDefaultHeap->getMaxAllocatableSize(8) <= 0x2800)
mPhysicsTempDefaultHeap->dump();
return mPhysicsTempDefaultHeap;
RobbyV2
force-pushed
the
phys-system-heap-accessors
branch
from
July 30, 2026 13:07
aaacee0 to
c6c8bea
Compare
Contributor
Author
|
Done. The two guards are folded into one condition because the split form does not match. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isHavokMainHeapOom returns true when the Havok main heap free size divided by its total size is below 0.05.
The allocator sits at this+0x78, inside the old _78 padding, so I added HavokMemoryAllocator* mHavokAllocator and shortened the padding to _80.
getPhysicsTempHeap returns mPhysicsTempDefaultHeap when low_priority is LowPriority::No and the current thread priority is at most sead::Thread::cDefaultPriority, dumping that heap first when getMaxAllocatableSize(8) is at most 0x2800. Every other case returns mPhysicsTempLowHeap.
This change is