From 38ace7f1fd76760b804c55daec4c124fe361ee13 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 20 Apr 2024 10:05:28 +0200 Subject: [PATCH 1/2] coreinit: Add MEMCheckExpHeap and MEMCheckHeap --- include/coreinit/memexpheap.h | 3 +++ include/coreinit/memheap.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/coreinit/memexpheap.h b/include/coreinit/memexpheap.h index 11da2d2a8..1904dc256 100644 --- a/include/coreinit/memexpheap.h +++ b/include/coreinit/memexpheap.h @@ -131,6 +131,9 @@ MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, MEMExpHeapBlockVisitor callback, void *context); +bool +MEMCheckExpHeap(MEMHeapHandle handle, bool logErrors); + #ifdef __cplusplus } #endif diff --git a/include/coreinit/memheap.h b/include/coreinit/memheap.h index 914d3206e..7af307f9e 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 From f1086b1a489bb7250d5542458dc46f42f4df8180 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 20 Apr 2024 17:46:59 +0200 Subject: [PATCH 2/2] coreinit: Fix MEMCheckExpHeap and MEMCheckHeap functions --- include/coreinit/memexpheap.h | 11 +++++++++-- include/coreinit/memheap.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/coreinit/memexpheap.h b/include/coreinit/memexpheap.h index 1904dc256..1d6fe1e0d 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,8 +137,9 @@ MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, MEMExpHeapBlockVisitor callback, void *context); -bool -MEMCheckExpHeap(MEMHeapHandle handle, bool logErrors); +BOOL +MEMCheckExpHeap(MEMHeapHandle handle, + MEMExpHeapCheckFlags mode); #ifdef __cplusplus } diff --git a/include/coreinit/memheap.h b/include/coreinit/memheap.h index 7af307f9e..94a581475 100644 --- a/include/coreinit/memheap.h +++ b/include/coreinit/memheap.h @@ -147,7 +147,7 @@ MEMSetFillValForHeap(MEMHeapFillType type, /** * Checks the heap for corruption */ -bool +BOOL MEMCheckHeap(MEMHeapHandle handle); #ifdef __cplusplus