summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/asm/unk_0201F06C.s2
-rw-r--r--arm9/asm/unk_0206C700.s2
-rw-r--r--arm9/global.inc6
-rw-r--r--arm9/lib/include/NNS_FND_allocator.h34
-rw-r--r--arm9/lib/include/NNS_FND_expheap.h54
-rw-r--r--arm9/lib/include/NNS_FND_heapcommon.h2
-rw-r--r--arm9/modules/05/asm/mod05_021D9A48.s2
-rw-r--r--arm9/modules/05/asm/mod05_021E4AE4.s2
-rw-r--r--arm9/modules/05/asm/module_05.s2
-rw-r--r--arm9/modules/06/asm/module_06.s18
-rw-r--r--arm9/modules/63/asm/mod63_021D74E0.s2
-rw-r--r--arm9/modules/63/asm/mod63_021D8890.s2
-rw-r--r--arm9/modules/64/asm/module_64.s2
-rw-r--r--arm9/modules/78/asm/module_78.s2
-rw-r--r--arm9/modules/84/asm/module_84_thumb1.s2
-rw-r--r--arm9/src/heap.c89
-rw-r--r--include/heap.h9
17 files changed, 156 insertions, 76 deletions
diff --git a/arm9/asm/unk_0201F06C.s b/arm9/asm/unk_0201F06C.s
index d33edce3..e465b1ec 100644
--- a/arm9/asm/unk_0201F06C.s
+++ b/arm9/asm/unk_0201F06C.s
@@ -265,7 +265,7 @@ _0201F1C8:
ldr r0, [r0, #0x0]
ldr r1, [r5, #0x4]
mov r2, #0x4
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
ldr r0, [r5, #0x0]
ldr r1, [r5, #0x4]
bl FUN_0201C360
diff --git a/arm9/asm/unk_0206C700.s b/arm9/asm/unk_0206C700.s
index 295f1006..8f7699de 100644
--- a/arm9/asm/unk_0206C700.s
+++ b/arm9/asm/unk_0206C700.s
@@ -738,7 +738,7 @@ _0206CCCE:
mov r3, #0x4
bl FUN_02007E68
ldr r0, [r4, #0x5c]
- bl FUN_02016AF8
+ bl GF_ExpHeap_FndGetTotalFreeSize
mov r1, #0x2
lsl r1, r1, #0xe
cmp r0, r1
diff --git a/arm9/global.inc b/arm9/global.inc
index 288dcf4e..cf0a8ab7 100644
--- a/arm9/global.inc
+++ b/arm9/global.inc
@@ -1030,9 +1030,9 @@
.extern AllocFromHeapAtEnd
.extern FreeToHeap
.extern FreeToHeapExplicit
-.extern FUN_02016AF8
-.extern FUN_02016B20
-.extern FUN_02016B44
+.extern GF_ExpHeap_FndGetTotalFreeSize
+.extern GF_ExpHeap_FndInitAllocator
+.extern ReallocFromHeap
.extern FUN_02016B90
.extern FUN_02016B94
.extern FUN_02016BB8
diff --git a/arm9/lib/include/NNS_FND_allocator.h b/arm9/lib/include/NNS_FND_allocator.h
new file mode 100644
index 00000000..48df282a
--- /dev/null
+++ b/arm9/lib/include/NNS_FND_allocator.h
@@ -0,0 +1,34 @@
+#ifndef GUARD_NNS_FND_ALLOCATOR_H
+#define GUARD_NNS_FND_ALLOCATOR_H
+
+#include "NNS_FND_heapcommon.h"
+
+typedef struct NNSFndAllocator NNSFndAllocator;
+
+typedef void* (*NNSFndFuncAllocatorAlloc)(
+ NNSFndAllocator* pAllocator,
+ u32 size);
+
+typedef void (*NNSFndFuncAllocatorFree)(
+ NNSFndAllocator* pAllocator,
+ void* memBlock);
+
+typedef struct NNSFndAllocatorFunc NNSFndAllocatorFunc;
+
+struct NNSFndAllocatorFunc
+{
+ NNSFndFuncAllocatorAlloc pfAlloc;
+ NNSFndFuncAllocatorFree pfFree;
+};
+
+struct NNSFndAllocator
+{
+ NNSFndAllocatorFunc const * pFunc;
+ void* pHeap;
+ u32 heapParam1;
+ u32 heapParam2;
+};
+
+void NNS_FndInitAllocatorForExpHeap(NNSFndAllocator * pAllocator, NNSFndHeapHandle heap, int alignment);
+
+#endif //GUARD_NNS_FND_ALLOCATOR_H
diff --git a/arm9/lib/include/NNS_FND_expheap.h b/arm9/lib/include/NNS_FND_expheap.h
index 171cacf6..c0008f28 100644
--- a/arm9/lib/include/NNS_FND_expheap.h
+++ b/arm9/lib/include/NNS_FND_expheap.h
@@ -3,13 +3,53 @@
#include "NNS_FND_heapcommon.h"
+typedef struct NNSiFndExpHeapMBlockHead NNSiFndExpHeapMBlockHead;
+
+struct NNSiFndExpHeapMBlockHead
+{
+ u16 signature; // Signature
+ u16 attribute; // Attribute
+ // [8:groupID]
+ // [7:alignment]
+ // [1:temporary flag]
+
+ u32 blockSize; // Block size (data area only)
+
+ NNSiFndExpHeapMBlockHead* pMBHeadPrev; // Previous block
+ NNSiFndExpHeapMBlockHead* pMBHeadNext; // Next block
+};
+
+typedef struct NNSiFndExpMBlockList NNSiFndExpMBlockList;
+
+struct NNSiFndExpMBlockList
+{
+ NNSiFndExpHeapMBlockHead* head; // Pointer for memory block linked to header
+ NNSiFndExpHeapMBlockHead* tail; // Pointer to the memory block linked to the tail of the expanded heap
+};
+
+typedef struct NNSiFndExpHeapHead NNSiFndExpHeapHead;
+
+struct NNSiFndExpHeapHead
+{
+ NNSiFndExpMBlockList mbFreeList; // Free list
+ NNSiFndExpMBlockList mbUsedList; // Used list
+
+ u16 groupID; // Current group ID (lower 8 bits only)
+ u16 feature; // Attribute
+};
+
NNSFndHeapHandle NNS_FndCreateExpHeapEx(void *startAddress, u32 size, u32 optFlag);
-void *NNS_FndAllocFromExpHeapEx(void *param0, u32 param1, s32 param2);
-void NNS_FndDestroyExpHeap();
-void NNS_FndFreeToExpHeap(void *ptr1, void *ptr2);
-u32 NNS_FndGetTotalFreeSizeForExpHeap(void *param0);
-void NNS_FndInitAllocatorForExpHeap(u32 param0, void *param1, u32 param2);
-u32 NNS_FndGetSizeForMBlockExpHeap(void *param0);
-void NNS_FndResizeForMBlockExpHeap(void *ptr1, void *ptr2, u32 param2);
+void *NNS_FndAllocFromExpHeapEx(NNSFndHeapHandle heap, u32 size, int alignment);
+void NNS_FndDestroyExpHeap(NNSFndHeapHandle heap);
+void NNS_FndFreeToExpHeap(NNSFndHeapHandle heap, void *memBlock);
+u32 NNS_FndGetTotalFreeSizeForExpHeap(NNSFndHeapHandle heap);
+u32 NNS_FndGetSizeForMBlockExpHeap(const void *memBlock);
+void NNS_FndResizeForMBlockExpHeap(NNSFndHeapHandle heap, void *memBlock, u32 size);
+
+#define NNS_FndCreateExpHeap(startAddress, size) \
+ NNS_FndCreateExpHeapEx(startAddress, size, 0)
+#define NNS_FndAllocFromExpHeap(heap, size) \
+ NNS_FndAllocFromExpHeapEx(heap, size, NNS_FND_HEAP_DEFAULT_ALIGNMENT)
+
#endif //GUARD_NNS_FND_EXPHEAP_H
diff --git a/arm9/lib/include/NNS_FND_heapcommon.h b/arm9/lib/include/NNS_FND_heapcommon.h
index 6008e7e8..eb6f1bdb 100644
--- a/arm9/lib/include/NNS_FND_heapcommon.h
+++ b/arm9/lib/include/NNS_FND_heapcommon.h
@@ -3,6 +3,8 @@
#include "NNS_FND_list.h"
+#define NNS_FND_HEAP_DEFAULT_ALIGNMENT 4
+
typedef struct NNSiFndHeapHead NNSiFndHeapHead;
struct NNSiFndHeapHead
diff --git a/arm9/modules/05/asm/mod05_021D9A48.s b/arm9/modules/05/asm/mod05_021D9A48.s
index ee169f98..4cd22924 100644
--- a/arm9/modules/05/asm/mod05_021D9A48.s
+++ b/arm9/modules/05/asm/mod05_021D9A48.s
@@ -199,7 +199,7 @@ _021D9B98:
mov r1, #4
add r0, r7, #0
add r2, r1, #0
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
mov r0, #0x6e
mov r1, #4
bl NARC_ctor
diff --git a/arm9/modules/05/asm/mod05_021E4AE4.s b/arm9/modules/05/asm/mod05_021E4AE4.s
index 98146a9c..09f66fe5 100644
--- a/arm9/modules/05/asm/mod05_021E4AE4.s
+++ b/arm9/modules/05/asm/mod05_021E4AE4.s
@@ -1093,7 +1093,7 @@ MOD05_021E5294: ; 0x021E5294
add r1, r0, #0
add r0, r4, #0
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
pop {r4, pc}
.section .rodata
diff --git a/arm9/modules/05/asm/module_05.s b/arm9/modules/05/asm/module_05.s
index 913e5b00..ee979879 100644
--- a/arm9/modules/05/asm/module_05.s
+++ b/arm9/modules/05/asm/module_05.s
@@ -24929,7 +24929,7 @@ MOD05_021F4968: ; 0x021F4968
sub r1, r1, r0
bx r3
nop
-_021F4974: .word FUN_02016B44
+_021F4974: .word ReallocFromHeap
thumb_func_start MOD05_021F4978
MOD05_021F4978: ; 0x021F4978
diff --git a/arm9/modules/06/asm/module_06.s b/arm9/modules/06/asm/module_06.s
index 9a618431..83971e80 100644
--- a/arm9/modules/06/asm/module_06.s
+++ b/arm9/modules/06/asm/module_06.s
@@ -2285,7 +2285,7 @@ MOD06_0223A75C: ; 0x0223A75C
add r0, r4, r0
mov r1, #4
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r4, #0
pop {r3, r4, r5, pc}
@@ -2964,7 +2964,7 @@ MOD06_0223AC78: ; 0x0223AC78
add r0, r4, r0
add r1, r5, #0
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
mov r2, #0x4f
lsl r2, r2, #2
add r0, r4, #0
@@ -4020,7 +4020,7 @@ MOD06_0223B458: ; 0x0223B458
add r0, #0xc4
add r1, r7, #0
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r6, #0
add r0, #0x78
mov r1, #0x62
@@ -4587,7 +4587,7 @@ MOD06_0223B828: ; 0x0223B828
add r0, #0xdc
add r1, r7, #0
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r6, #0
add r0, #0x78
mov r1, #0x62
@@ -43590,7 +43590,7 @@ MOD06_0224EA64: ; 0x0224EA64
add r0, #0xdc
mov r1, #4
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r4, #0
add r0, #0xdc
mov r1, #3
@@ -43704,7 +43704,7 @@ MOD06_0224EB30: ; 0x0224EB30
add r0, #0xdc
mov r1, #4
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r4, #0
add r0, #0xdc
mov r2, #4
@@ -43738,7 +43738,7 @@ MOD06_0224EB78: ; 0x0224EB78
add r0, #0xdc
mov r1, #4
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r4, #0
add r0, #0xdc
mov r2, #4
@@ -43878,7 +43878,7 @@ MOD06_0224EC5C: ; 0x0224EC5C
add r0, r0, r1
mov r1, #4
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
ldr r5, [sp, #8]
mov r1, #0x6e
add r4, sp, #0x10
@@ -44299,7 +44299,7 @@ MOD06_0224EF98: ; 0x0224EF98
mov r1, #4
add r0, r5, r0
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r5, #0
mov r1, #0x8d
mov r2, #8
diff --git a/arm9/modules/63/asm/mod63_021D74E0.s b/arm9/modules/63/asm/mod63_021D74E0.s
index d309fdee..a32913d9 100644
--- a/arm9/modules/63/asm/mod63_021D74E0.s
+++ b/arm9/modules/63/asm/mod63_021D74E0.s
@@ -500,7 +500,7 @@ MOD63_021D78BC: ; 0x021D78BC
add r0, #0x68
add r1, r4, #0
mov r2, #4
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
mov r0, #0x30
add r1, r6, #0
add r2, r4, #0
diff --git a/arm9/modules/63/asm/mod63_021D8890.s b/arm9/modules/63/asm/mod63_021D8890.s
index 42cbfcd7..982a2b9a 100644
--- a/arm9/modules/63/asm/mod63_021D8890.s
+++ b/arm9/modules/63/asm/mod63_021D8890.s
@@ -1930,7 +1930,7 @@ _021D9840:
ldr r1, [r2, #0x14]
add r1, r2, r1
sub r1, r1, r0
- bl FUN_02016B44
+ bl ReallocFromHeap
mov r0, #0x80
mov r1, #0x4c
bl NARC_ctor
diff --git a/arm9/modules/64/asm/module_64.s b/arm9/modules/64/asm/module_64.s
index 7a70bf1f..c6d71664 100644
--- a/arm9/modules/64/asm/module_64.s
+++ b/arm9/modules/64/asm/module_64.s
@@ -30,7 +30,7 @@ _021D7504:
add r0, r5, r0
mov r1, #0x2f
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r0, r4, #0
bl OverlayManager_GetField18
add r4, r0, #0
diff --git a/arm9/modules/78/asm/module_78.s b/arm9/modules/78/asm/module_78.s
index 7fc7439a..8a6451fe 100644
--- a/arm9/modules/78/asm/module_78.s
+++ b/arm9/modules/78/asm/module_78.s
@@ -338,7 +338,7 @@ MOD78_021D778C: ; 0x021D778C
add r0, #0x70
mov r1, #0x48
mov r2, #4
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
add r1, r5, #0
add r1, #0x9c
ldrb r2, [r1]
diff --git a/arm9/modules/84/asm/module_84_thumb1.s b/arm9/modules/84/asm/module_84_thumb1.s
index a5838988..e133a761 100644
--- a/arm9/modules/84/asm/module_84_thumb1.s
+++ b/arm9/modules/84/asm/module_84_thumb1.s
@@ -934,7 +934,7 @@ MOD84_021D7BC8: ; 0x021D7BC8
add r0, #0x6c
mov r1, #0x4b
mov r2, #0x20
- bl FUN_02016B20
+ bl GF_ExpHeap_FndInitAllocator
ldr r0, [r4, #4]
mov r1, #0
bl NNS_G3dGetAnmByIdx
diff --git a/arm9/src/heap.c b/arm9/src/heap.c
index 93ecefa4..79763865 100644
--- a/arm9/src/heap.c
+++ b/arm9/src/heap.c
@@ -2,6 +2,7 @@
#include "error_message_reset.h"
#include "unk_02031734.h"
#include "NNS_FND_expheap.h"
+#include "NNS_FND_allocator.h"
struct UnkStruct_020166C8 UNK_021C4D28;
@@ -61,7 +62,7 @@ THUMB_FUNC void FUN_020166C8(const struct UnkStruct_020EDB10 *templates, u32 nTe
if (ptr != NULL)
{
- UNK_021C4D28.heapHandles[r7] = NNS_FndCreateExpHeapEx(ptr, templates[r7].size, 0);
+ UNK_021C4D28.heapHandles[r7] = NNS_FndCreateExpHeap(ptr, templates[r7].size);
UNK_021C4D28.heapIdxs[r7] = (u8)r7;
}
else
@@ -115,56 +116,56 @@ THUMB_FUNC u32 FUN_02016828(u32 param0, u32 param1, u32 param2)
return FUN_02016834(param0, param1, param2, -4);
}
-THUMB_FUNC u32 FUN_02016834(u32 param0, u32 param1, u32 param2, s32 param3)
+THUMB_FUNC u32 FUN_02016834(u32 param0, u32 param1, u32 size, s32 alignment)
{
GF_ASSERT(OS_GetProcMode() != OS_PROCMODE_IRQ);
u8 *ptr = UNK_021C4D28.heapIdxs;
if (UNK_021C4D28.unk1a == ptr[param1])
{
- void *ptr2 = UNK_021C4D28.heapHandles[ptr[param0]];
- if (ptr2 != 0)
+ NNSFndHeapHandle ptr2 = UNK_021C4D28.heapHandles[ptr[param0]];
+ if (ptr2 != NULL)
{
- void *ptr3 = NNS_FndAllocFromExpHeapEx(ptr2, param2, param3);
- if (ptr3 != 0)
+ void *ptr3 = NNS_FndAllocFromExpHeapEx(ptr2, size, alignment);
+ if (ptr3 != NULL)
{
- param3 = FUN_020167F4();
- if (param3 >= 0)
+ s32 i = FUN_020167F4();
+ if (i >= 0)
{
- UNK_021C4D28.heapHandles[param3] = NNS_FndCreateExpHeapEx(ptr3, param2, 0);
+ UNK_021C4D28.heapHandles[i] = NNS_FndCreateExpHeap(ptr3, size);
- if (UNK_021C4D28.heapHandles[param3] != 0)
+ if (UNK_021C4D28.heapHandles[i] != 0)
{
- UNK_021C4D28.unk04[param3] = ptr2;
- UNK_021C4D28.unk08[param3] = ptr3;
- UNK_021C4D28.heapIdxs[param1] = (u8)param3;
+ UNK_021C4D28.unk04[i] = ptr2;
+ UNK_021C4D28.unk08[i] = ptr3;
+ UNK_021C4D28.heapIdxs[param1] = (u8)i;
- return 1;
+ return TRUE;
}
else
{
- GF_AssertFail();
+ GF_ASSERT(0);
}
}
else
{
- GF_AssertFail();
+ GF_ASSERT(0);
}
}
else
{
- GF_AssertFail();
+ GF_ASSERT(0);
}
}
else
{
- GF_AssertFail();
+ GF_ASSERT(0);
}
}
else
{
- GF_AssertFail();
+ GF_ASSERT(0);
}
return 0;
}
@@ -173,25 +174,27 @@ THUMB_FUNC void FUN_020168D0(u32 heap_id)
{
GF_ASSERT (OS_GetProcMode() != OS_PROCMODE_IRQ);
- if (UNK_021C4D28.heapHandles[UNK_021C4D28.heapIdxs[heap_id]] != 0)
+ NNSFndHeapHandle handle = UNK_021C4D28.heapHandles[UNK_021C4D28.heapIdxs[heap_id]];
+
+ if (handle != NULL)
{
- NNS_FndDestroyExpHeap();
+ NNS_FndDestroyExpHeap(handle);
u8 index = UNK_021C4D28.heapIdxs[heap_id];
- void *ptr1 = UNK_021C4D28.unk04[index];
+ NNSFndHeapHandle ptr1 = UNK_021C4D28.unk04[index];
void *ptr2 = UNK_021C4D28.unk08[index];
- if (ptr1 != 0 && ptr2 != 0)
+ if (ptr1 != NULL && ptr2 != NULL)
{
NNS_FndFreeToExpHeap(ptr1, ptr2);
}
else
{
- GF_AssertFail();
+ GF_ASSERT(0);
}
- UNK_021C4D28.heapHandles[UNK_021C4D28.heapIdxs[heap_id]] = 0;
- UNK_021C4D28.unk04[UNK_021C4D28.heapIdxs[heap_id]] = 0;
- UNK_021C4D28.unk08[UNK_021C4D28.heapIdxs[heap_id]] = 0;
+ UNK_021C4D28.heapHandles[UNK_021C4D28.heapIdxs[heap_id]] = NULL;
+ UNK_021C4D28.unk04[UNK_021C4D28.heapIdxs[heap_id]] = NULL;
+ UNK_021C4D28.unk08[UNK_021C4D28.heapIdxs[heap_id]] = NULL;
UNK_021C4D28.heapIdxs[heap_id] = (u8)UNK_021C4D28.unk1a;
}
@@ -288,7 +291,7 @@ void FreeToHeap(void *ptr)
return;
}
- GF_AssertFail();
+ GF_ASSERT(0);
}
void FreeToHeapExplicit(u32 param0, void *param1)
@@ -311,49 +314,49 @@ void FreeToHeapExplicit(u32 param0, void *param1)
return;
}
- GF_AssertFail();
+ GF_ASSERT(0);
}
-THUMB_FUNC u32 FUN_02016AF8(u32 param0)
+THUMB_FUNC u32 GF_ExpHeap_FndGetTotalFreeSize(u32 heap_id)
{
- if (param0 < UNK_021C4D28.totalNumHeaps)
+ if (heap_id < UNK_021C4D28.totalNumHeaps)
{
- u8 index = UNK_021C4D28.heapIdxs[param0];
+ u8 index = UNK_021C4D28.heapIdxs[heap_id];
return NNS_FndGetTotalFreeSizeForExpHeap(UNK_021C4D28.heapHandles[index]);
}
- GF_AssertFail();
+ GF_ASSERT(0);
return 0;
}
-THUMB_FUNC void FUN_02016B20(u32 param0, u32 param1, u32 param2)
+THUMB_FUNC void GF_ExpHeap_FndInitAllocator(NNSFndAllocator * pAllocator, u32 heap_id, int alignment)
{
- if (param1 < UNK_021C4D28.totalNumHeaps)
+ if (heap_id < UNK_021C4D28.totalNumHeaps)
{
- u8 index = UNK_021C4D28.heapIdxs[param1];
- NNS_FndInitAllocatorForExpHeap(param0, UNK_021C4D28.heapHandles[index], param2);
+ u8 index = UNK_021C4D28.heapIdxs[heap_id];
+ NNS_FndInitAllocatorForExpHeap(pAllocator, UNK_021C4D28.heapHandles[index], alignment);
return;
}
- GF_AssertFail();
+ GF_ASSERT(0);
}
-THUMB_FUNC void FUN_02016B44(void *ptr, u32 param1)
+THUMB_FUNC void ReallocFromHeap(void *ptr, u32 newSize)
{
GF_ASSERT (OS_GetProcMode() != OS_PROCMODE_IRQ);
- param1 += 16;
- if (NNS_FndGetSizeForMBlockExpHeap(ptr - 16) >= param1)
+ newSize += 16;
+ if (NNS_FndGetSizeForMBlockExpHeap(ptr - 16) >= newSize)
{
u8 heap_id = (u8)((u32 *)ptr)[-1];
u8 index = UNK_021C4D28.heapIdxs[heap_id];
- NNS_FndResizeForMBlockExpHeap(UNK_021C4D28.heapHandles[index], ptr - 16, param1);
+ NNS_FndResizeForMBlockExpHeap(UNK_021C4D28.heapHandles[index], ptr - 16, newSize);
return;
}
- GF_AssertFail();
+ GF_ASSERT(0);
}
THUMB_FUNC u32 FUN_02016B90(u32 param0)
diff --git a/include/heap.h b/include/heap.h
index 73be3ba6..3eb124ba 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -3,6 +3,7 @@
#include "global.h"
#include "NNS_FND_expheap.h"
+#include "NNS_FND_allocator.h"
struct UnkStruct_020EDB10
{
@@ -28,7 +29,7 @@ void FUN_020166C8(const struct UnkStruct_020EDB10 *templates, u32 nTemplates, u3
s32 FUN_020167F4();
u32 FUN_0201681C(u32 param0, u32 heap_id, u32 param2);
u32 FUN_02016828(u32 param0, u32 param1, u32 param2);
-u32 FUN_02016834(u32 param0, u32 param1, u32 param2, s32 param3);
+u32 FUN_02016834(u32 param0, u32 param1, u32 size, s32 alignment);
void FUN_020168D0(u32 heap_id);
u32 *FUN_02016944(void *param0, u32 param1, s32 param2, u32 param3);
void FUN_02016988();
@@ -36,9 +37,9 @@ void *AllocFromHeap(u32 heap_id, u32 size);
void *AllocFromHeapAtEnd(u32 heap_id, u32 size);
void FreeToHeap(void *ptr);
void FreeToHeapExplicit(u32 heap_id, void * ptr);
-u32 FUN_02016AF8(u32 param0);
-void FUN_02016B20(u32 param0, u32 param1, u32 param2);
-void FUN_02016B44(void *ptr, u32 param1);
+u32 GF_ExpHeap_FndGetTotalFreeSize(u32 heap_id);
+void GF_ExpHeap_FndInitAllocator(NNSFndAllocator * pAllocator, u32 heap_id, int alignment);
+void ReallocFromHeap(void *ptr, u32 newSize);
u32 FUN_02016B90(u32 param0);
#endif //POKEDIAMOND_HEAP_H