From a2abffd37b9ce62d8d5d52031ec6c56a7fd03938 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:59:54 +0200 Subject: [PATCH] coreinit: Manual endian-swap is not required for MEMPTR --- src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp | 7 ++----- src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp index e1904f72..a9f9f3a8 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp @@ -538,7 +538,6 @@ namespace coreinit void coreinitExport_MEMAllocFromAllocator(PPCInterpreter_t* hCPU) { - debug_printf("MEMAllocFromAllocator(0x%x, 0x%x)\n", hCPU->gpr[3], hCPU->gpr[4]); MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]); // redirect execution to allocator alloc callback hCPU->instructionPointer = memAllocator->func->funcAlloc.GetMPTR(); @@ -546,7 +545,6 @@ namespace coreinit void coreinitExport_MEMFreeToAllocator(PPCInterpreter_t* hCPU) { - debug_printf("MEMFreeToAllocator(0x%x, 0x%08x)\n", hCPU->gpr[3], hCPU->gpr[4]); MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]); // redirect execution to allocator free callback hCPU->instructionPointer = memAllocator->func->funcFree.GetMPTR(); @@ -568,11 +566,10 @@ namespace coreinit void coreinitExport_MEMInitAllocatorForDefaultHeap(PPCInterpreter_t* hCPU) { - debug_printf("MEMInitAllocatorForDefaultHeap(0x%08x)", hCPU->gpr[3]); ppcDefineParamStructPtr(memAllocator, MEMAllocator, 0); - gDefaultHeapAllocator->funcAlloc = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Alloc)); - gDefaultHeapAllocator->funcFree = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Free)); + gDefaultHeapAllocator->funcAlloc = PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Alloc); + gDefaultHeapAllocator->funcFree = PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Free); memAllocator->func = gDefaultHeapAllocator.GetPtr(); memAllocator->heap = MEMPTR(MEMGetBaseHeapHandle(1)); diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp index fe221717..c587b879 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp @@ -831,8 +831,8 @@ SysAllocator gExpHeapDefaultAllocator; void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, sint32 alignment) { allocator->func = gExpHeapDefaultAllocator.GetPtr(); - gExpHeapDefaultAllocator->funcAlloc = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Alloc)); - gExpHeapDefaultAllocator->funcFree = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Free)); + gExpHeapDefaultAllocator->funcAlloc = PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Alloc); + gExpHeapDefaultAllocator->funcFree = PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Free); allocator->heap = heap; allocator->param1 = alignment;