From 08cfb34e0bd4e767e7f3630470c246aa53f69cb0 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 20 Apr 2024 19:25:24 +0200 Subject: [PATCH] coreinit: Add MEMCheckExpHeap and MEMCheckHeap (#358) * coreinit: Add MEMCheckExpHeap and MEMCheckHeap * coreinit: Fix MEMCheckExpHeap and MEMCheckHeap functions --- include/coreinit/memexpheap.h | 10 ++++++++++ include/coreinit/memheap.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/include/coreinit/memexpheap.h b/include/coreinit/memexpheap.h index 11da2d2a..1d6fe1e0 100644 --- a/include/coreinit/memexpheap.h +++ b/include/coreinit/memexpheap.h @@ -31,6 +31,12 @@ typedef enum MEMExpHeapDirection MEM_EXP_HEAP_DIR_FROM_BOTTOM = 1, } MEMExpHeapDirection; +typedef enum MEMExpHeapCheckFlags +{ + MEM_EXP_HEAP_CHECK_FLAGS_NONE = 0, + MEM_EXP_HEAP_CHECK_FLAGS_LOG_ERRORS = 1, +} MEMExpHeapCheckFlags; + struct MEMExpHeapBlock { uint32_t attribs; @@ -131,6 +137,10 @@ MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, MEMExpHeapBlockVisitor callback, void *context); +BOOL +MEMCheckExpHeap(MEMHeapHandle handle, + MEMExpHeapCheckFlags mode); + #ifdef __cplusplus } #endif diff --git a/include/coreinit/memheap.h b/include/coreinit/memheap.h index 914d3206..94a58147 100644 --- a/include/coreinit/memheap.h +++ b/include/coreinit/memheap.h @@ -144,6 +144,12 @@ void MEMSetFillValForHeap(MEMHeapFillType type, uint32_t value); +/** + * Checks the heap for corruption + */ +BOOL +MEMCheckHeap(MEMHeapHandle handle); + #ifdef __cplusplus } #endif