Merge pull request #30 from robojumper/eggAllocator

eggAllocator matching
This commit is contained in:
Elijah Thomas
2024-05-05 12:46:16 -04:00
committed by GitHub
6 changed files with 54 additions and 12 deletions
+1
View File
@@ -313,6 +313,7 @@ egg/core/eggStream.cpp:
egg/core/eggAllocator.cpp:
.text start:0x804952D0 end:0x804953F0
.data start:0x8056E8D0 end:0x8056E8E8
.sdata2 start:0x8057F2F0 end:0x8057F2F8
egg/core/eggHeap.cpp:
.text start:0x804953F0 end:0x80495AB0
+7 -7
View File
@@ -26184,12 +26184,12 @@ getUncompressedSize__Q23EGG14StreamDecompRLFPCv = .text:0x80495290; // type:func
getHeaderSize__Q23EGG14StreamDecompRLFv = .text:0x804952A0; // type:function size:0x8
getUncompressedSize__Q23EGG14StreamDecompLZFPCv = .text:0x804952B0; // type:function size:0x8
getHeaderSize__Q23EGG14StreamDecompLZFv = .text:0x804952C0; // type:function size:0x8
egg_allocator_pfAlloc = .text:0x804952D0; // type:function size:0x1C
egg_allocator_pfFree = .text:0x804952F0; // type:function size:0x14
MEMInitAllocatorForHeap = .text:0x80495310; // type:function size:0x1C
__ct__Q23EGG9AllocatorFPQ23EGG4Heapl = .text:0x80495330; // type:function size:0x50
MEM_AllocFor_Heap__FP12MEMAllocatorUi = .text:0x804952D0; // type:function size:0x1C scope:local
MEM_FreeFor_Heap__FP12MEMAllocatorPv = .text:0x804952F0; // type:function size:0x14 scope:local
MEMInitAllocatorFor_Heap__FP12MEMAllocatoriPv = .text:0x80495310; // type:function size:0x1C
__ct__Q23EGG9AllocatorFPQ23EGG4Heapi = .text:0x80495330; // type:function size:0x50
__dt__Q23EGG9AllocatorFv = .text:0x80495380; // type:function size:0x40
alloc__Q23EGG9AllocatorFUl = .text:0x804953C0; // type:function size:0x14
alloc__Q23EGG9AllocatorFUi = .text:0x804953C0; // type:function size:0x14
free__Q23EGG9AllocatorFPv = .text:0x804953E0; // type:function size:0x10
initialize__Q23EGG4HeapFv = .text:0x804953F0; // type:function size:0x40
__ct__Q23EGG4HeapFP12MEMiHeapHead = .text:0x80495430; // type:function size:0x90
@@ -37094,7 +37094,7 @@ lbl_8056E870 = .data:0x8056E870; // type:object size:0x18
lbl_8056E888 = .data:0x8056E888; // type:object size:0x18
lbl_8056E8A0 = .data:0x8056E8A0; // type:object size:0x18
lbl_8056E8B8 = .data:0x8056E8B8; // type:object size:0x18
lbl_8056E8D0 = .data:0x8056E8D0; // type:object size:0x18
__vt__Q23EGG9Allocator = .data:0x8056E8D0; // type:object size:0x14
lbl_8056E8E8 = .data:0x8056E8E8; // type:object size:0x68
__vt__Q23EGG4Heap = .data:0x8056E950; // type:object size:0x30
lbl_8056E980 = .data:0x8056E980; // type:object size:0x10
@@ -47590,7 +47590,7 @@ lbl_8057F2DC = .sdata2:0x8057F2DC; // type:object size:0x4 data:float
lbl_8057F2E0 = .sdata2:0x8057F2E0; // type:object size:0x4 data:float
lbl_8057F2E4 = .sdata2:0x8057F2E4; // type:object size:0x4 data:float
lbl_8057F2E8 = .sdata2:0x8057F2E8; // type:object size:0x8 data:float
lbl_8057F2F0 = .sdata2:0x8057F2F0; // type:object size:0x8
eggAllocatorFuncs = .sdata2:0x8057F2F0; // type:object size:0x8 scope:local
lbl_8057F2F8 = .sdata2:0x8057F2F8; // type:object size:0x4 data:float
lbl_8057F300 = .sdata2:0x8057F300; // type:object size:0x8 data:double
lbl_8057F308 = .sdata2:0x8057F308; // type:object size:0x4 data:float
+1 -1
View File
@@ -353,7 +353,7 @@ config.libs = [
Object(NonMatching, "egg/core/eggDvdFile.cpp"),
Object(NonMatching, "egg/core/eggDvdRipper.cpp"),
Object(NonMatching, "egg/core/eggStream.cpp"),
Object(NonMatching, "egg/core/eggAllocator.cpp"),
Object(Matching, "egg/core/eggAllocator.cpp"),
Object(NonMatching, "egg/core/eggHeap.cpp"),
Object(NonMatching, "egg/core/eggExpHeap.cpp"),
Object(NonMatching, "egg/core/eggFrmHeap.cpp"),
+2 -3
View File
@@ -3,9 +3,8 @@
#include "rvl/MEM.h"
#include <common.h>
// /* 80495310 */ MEMInitAllocatorFor_Heap(MEMAllocator* alloc, s32 align, void* heap);
// /* 804952f0 */ MEM_AllocFor_Heap(MEMAllocator* alloc, void* block);
// /* 804952d0 */ MEM_AllocFor_Heap(MEMAllocator* alloc, u32 size, s32 align);
/* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator* alloc, s32 align, void* heap);
namespace EGG {
class Heap;
class Allocator : public MEMAllocator {
+1 -1
View File
@@ -19,7 +19,7 @@ typedef struct MEMAllocatorFuncs {
typedef struct MEMAllocator {
const MEMAllocatorFuncs *funcs; // at 0x0
struct MEMiHeapHead *heap; // at 0x4
void *heap; // at 0x4
u32 heapParam1; // at 0x8
u32 heapParam2; // at 0xC
} MEMAllocator;
+42
View File
@@ -0,0 +1,42 @@
#include <egg/core/eggAllocator.h>
#include <egg/core/eggHeap.h>
/* 804952d0 */ static void *MEM_AllocFor_Heap(MEMAllocator* alloc, u32 size) {
return static_cast<EGG::Heap*>(static_cast<EGG::Allocator*>(alloc)->heap)->alloc(size, alloc->heapParam1);
}
/* 804952f0 */ static void MEM_FreeFor_Heap(MEMAllocator* alloc, void* block) {
return static_cast<EGG::Heap*>(static_cast<EGG::Allocator*>(alloc)->heap)->free(block);
}
const MEMAllocatorFuncs eggAllocatorFuncs = {
&MEM_AllocFor_Heap,
&MEM_FreeFor_Heap,
};
// TODO this is used from eggHeap for some reason. Figure out
// the correct privacy boundary later.
/* 80495310 */ void MEMInitAllocatorFor_Heap(MEMAllocator* alloc, s32 align, void* heap) {
alloc->funcs = &eggAllocatorFuncs;
alloc->heap = heap;
alloc->heapParam1 = align;
alloc->heapParam2 = 0;
}
namespace EGG {
/* 80495330 */ Allocator::Allocator(Heap *heap, s32 align) : mHeap(heap), align(align) {
MEMInitAllocatorFor_Heap(this, align, heap);
}
/* 80495380 */ Allocator::~Allocator() {}
/* 804953c0 */ void *Allocator::alloc(u32 size) {
return Heap::alloc(size, align, mHeap);
}
/* 804953e0 */ void Allocator::free(void *block) {
Heap::free(block, mHeap);
}
} // namespace EGG