From 667a90d7ed4a9cfe8e25927cf9572ba0e3374479 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 30 May 2020 21:45:05 +0200 Subject: [PATCH] Fix the alloc and free functions to use all heaps --- source/memory_mapping.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/memory_mapping.cpp b/source/memory_mapping.cpp index ef7aa87..b5f467a 100644 --- a/source/memory_mapping.cpp +++ b/source/memory_mapping.cpp @@ -376,7 +376,7 @@ void* MemoryMapping::alloc(uint32_t size, uint32_t align){ DEBUG_FUNCTION_LINE("break %d",i); break; } - res = MEMAllocFromExpHeapEx((MEMHeapHandle) mem_mapping->effective_start_address, size, align); + res = MEMAllocFromExpHeapEx((MEMHeapHandle) mem_mapping[i].effective_start_address, size, align); if (res != NULL) { break; } @@ -395,8 +395,8 @@ void MemoryMapping::free(void* ptr){ DEBUG_FUNCTION_LINE("break %d",i); break; } - if(ptr_val > mem_mapping->effective_start_address && ptr_val < mem_mapping->effective_end_address){ - MEMFreeToExpHeap((MEMHeapHandle) mem_mapping->effective_start_address, ptr); + if(ptr_val > mem_mapping[i].effective_start_address && ptr_val < mem_mapping[i].effective_end_address){ + MEMFreeToExpHeap((MEMHeapHandle) mem_mapping[i].effective_start_address, ptr); break; } }