diff --git a/cafe/coreinit/exports.def b/cafe/coreinit/exports.def index 94ea769..d8f035c 100644 --- a/cafe/coreinit/exports.def +++ b/cafe/coreinit/exports.def @@ -39,11 +39,6 @@ OSXorAtomic64 OSTestAndClearAtomic64 OSTestAndSetAtomic64 -// coreinit/baseheap.h -MEMGetArena -MEMGetBaseHeapHandle -MEMSetBaseHeapHandle - // coreinit/blockheap.h MEMInitBlockHeap MEMDestroyBlockHeap @@ -248,6 +243,9 @@ MCP_DeviceList MCP_FullDeviceList // coreinit/memheap.h +MEMGetArena +MEMGetBaseHeapHandle +MEMSetBaseHeapHandle MEMDumpHeap MEMFindContainHeap MEMGetFillValForHeap diff --git a/include/coreinit/baseheap.h b/include/coreinit/baseheap.h deleted file mode 100644 index 3993c2e..0000000 --- a/include/coreinit/baseheap.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include - -/** - * \defgroup coreinit_baseheap Base Heap - * \ingroup coreinit - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *MEMHeapHandle; - -typedef enum MEMBaseHeapType -{ - MEM_BASE_HEAP_MEM1 = 0, - MEM_BASE_HEAP_MEM2 = 1, - MEM_BASE_HEAP_FG = 8, -} MEMBaseHeapType; - -/** - * Get which memory area a heap belongs to. - */ -MEMBaseHeapType -MEMGetArena(MEMHeapHandle handle); - -/** - * Get base heap for memory area. - */ -MEMHeapHandle -MEMGetBaseHeapHandle(MEMBaseHeapType type); - -/** - * Set base heap for memory area. - */ -MEMHeapHandle -MEMSetBaseHeapHandle(MEMBaseHeapType type, - MEMHeapHandle handle); - -#ifdef __cplusplus -} -#endif - -/** @} */ diff --git a/include/coreinit/memheap.h b/include/coreinit/memheap.h index d937992..fccf82b 100644 --- a/include/coreinit/memheap.h +++ b/include/coreinit/memheap.h @@ -16,6 +16,14 @@ extern "C" { #endif typedef struct MEMHeapHeader MEMHeapHeader; +typedef MEMHeapHeader *MEMHeapHandle; + +typedef enum MEMBaseHeapType +{ + MEM_BASE_HEAP_MEM1 = 0, + MEM_BASE_HEAP_MEM2 = 1, + MEM_BASE_HEAP_FG = 8, +} MEMBaseHeapType; typedef enum MEMHeapFillType { @@ -74,11 +82,35 @@ CHECK_OFFSET(MEMHeapHeader, 0x20, lock); CHECK_OFFSET(MEMHeapHeader, 0x30, flags); CHECK_SIZE(MEMHeapHeader, 0x40); + +/** + * Get which memory area a heap belongs to. + */ +MEMBaseHeapType +MEMGetArena(MEMHeapHandle handle); + + +/** + * Get base heap for memory area. + */ +MEMHeapHandle +MEMGetBaseHeapHandle(MEMBaseHeapType type); + + +/** + * Set base heap for memory area. + */ +MEMHeapHandle +MEMSetBaseHeapHandle(MEMBaseHeapType type, + MEMHeapHandle handle); + + /** * Print details about heap to COSWarn */ void -MEMDumpHeap(MEMHeapHeader *heap); +MEMDumpHeap(MEMHeapHandle heap); + /** * Find heap which contains a memory block. @@ -86,12 +118,14 @@ MEMDumpHeap(MEMHeapHeader *heap); MEMHeapHeader * MEMFindContainHeap(void *block); + /** * Get the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set. */ uint32_t MEMGetFillValForHeap(MEMHeapFillType type); + /** * Set the data fill value used when MEM_HEAP_FLAG_DEBUG_MODE is set. */