Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match EGG::Heap #14

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Object(NonMatching, "egg/core/eggDvdRipper.cpp"),
Object(NonMatching, "egg/core/eggStream.cpp"),
Object(Matching, "egg/core/eggAllocator.cpp"),
Object(NonMatching, "egg/core/eggHeap.cpp"),
Object(Matching, "egg/core/eggHeap.cpp"),
Object(Matching, "egg/core/eggExpHeap.cpp"),
Object(NonMatching, "egg/core/eggFrmHeap.cpp"),
Object(NonMatching, "egg/core/eggAssertHeap.cpp"),
Expand Down
2 changes: 1 addition & 1 deletion include/egg/core/eggHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Heap : public Disposer {
return (int)mHeapHandle->end;
}

inline const char *getName() {
inline const char *getName() const {
return mName;
}

Expand Down
11 changes: 3 additions & 8 deletions src/egg/core/eggHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ void *Heap::alloc(size_t size, int align, Heap *heap) {
heap = currentHeap;
}
if (heap != sAllocatableHeap) {
// TODO small instshuffle here, related to regshuffle problems
OSReport("cannot allocate from heap %x(%s) : allocatable heap is %x(%s)\n", heap, heap->getName(),
sAllocatableHeap, sAllocatableHeap->getName());
OSReport("\tthread heap=%x(%s)\n", threadHeap, threadHeap != nullptr ? threadHeap->getName() : "none");
Expand Down Expand Up @@ -153,14 +152,13 @@ void Heap::dispose() {
/* 804958a0 */
void Heap::dump() {}

// TODO: This debugging function with stripped out error reports doesn't match yet
/* 804958b0 */
void Heap::dumpAll() {
Heap *heap = nullptr;
u32 mem[2] = {0, 0};

OSLockMutex(&sRootMutex);
Heap *heap = nullptr;
while ((heap = (Heap *)nw4r::ut::List_GetNext(&sHeapList, &heap)) != nullptr) {
while ((heap = (Heap *)nw4r::ut::List_GetNext(&sHeapList, heap)) != nullptr) {
Heap *childHeap = nullptr;
Heap *parentHeap = heap->findParentHeap();
if ((u32)heap < 0x90000000) {
Expand Down Expand Up @@ -195,13 +193,10 @@ Heap *Heap::_becomeCurrentHeapWithoutLock() {
return h;
}

// TODO
extern "C" void MEMInitAllocatorForHeap(Allocator *alloc, s32 align, Heap *heap);

// TODO this could be an inline virtual function
/* 80495a40 */
void Heap::initAllocator(Allocator *alloc, s32 align) {
MEMInitAllocatorForHeap(alloc, align, this);
MEMInitAllocatorFor_Heap(alloc, align, this);
}

} // namespace EGG
Expand Down