mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-23 01:29:19 +01:00
coreinit: Manual endian-swap is not required for MEMPTR
This commit is contained in:
parent
fb0c36f714
commit
a2abffd37b
@ -538,7 +538,6 @@ namespace coreinit
|
|||||||
|
|
||||||
void coreinitExport_MEMAllocFromAllocator(PPCInterpreter_t* hCPU)
|
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]);
|
MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
|
||||||
// redirect execution to allocator alloc callback
|
// redirect execution to allocator alloc callback
|
||||||
hCPU->instructionPointer = memAllocator->func->funcAlloc.GetMPTR();
|
hCPU->instructionPointer = memAllocator->func->funcAlloc.GetMPTR();
|
||||||
@ -546,7 +545,6 @@ namespace coreinit
|
|||||||
|
|
||||||
void coreinitExport_MEMFreeToAllocator(PPCInterpreter_t* hCPU)
|
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]);
|
MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
|
||||||
// redirect execution to allocator free callback
|
// redirect execution to allocator free callback
|
||||||
hCPU->instructionPointer = memAllocator->func->funcFree.GetMPTR();
|
hCPU->instructionPointer = memAllocator->func->funcFree.GetMPTR();
|
||||||
@ -568,11 +566,10 @@ namespace coreinit
|
|||||||
|
|
||||||
void coreinitExport_MEMInitAllocatorForDefaultHeap(PPCInterpreter_t* hCPU)
|
void coreinitExport_MEMInitAllocatorForDefaultHeap(PPCInterpreter_t* hCPU)
|
||||||
{
|
{
|
||||||
debug_printf("MEMInitAllocatorForDefaultHeap(0x%08x)", hCPU->gpr[3]);
|
|
||||||
ppcDefineParamStructPtr(memAllocator, MEMAllocator, 0);
|
ppcDefineParamStructPtr(memAllocator, MEMAllocator, 0);
|
||||||
|
|
||||||
gDefaultHeapAllocator->funcAlloc = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Alloc));
|
gDefaultHeapAllocator->funcAlloc = PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Alloc);
|
||||||
gDefaultHeapAllocator->funcFree = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Free));
|
gDefaultHeapAllocator->funcFree = PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Free);
|
||||||
|
|
||||||
memAllocator->func = gDefaultHeapAllocator.GetPtr();
|
memAllocator->func = gDefaultHeapAllocator.GetPtr();
|
||||||
memAllocator->heap = MEMPTR<void>(MEMGetBaseHeapHandle(1));
|
memAllocator->heap = MEMPTR<void>(MEMGetBaseHeapHandle(1));
|
||||||
|
@ -831,8 +831,8 @@ SysAllocator<MEMAllocatorFunc> gExpHeapDefaultAllocator;
|
|||||||
void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, sint32 alignment)
|
void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, sint32 alignment)
|
||||||
{
|
{
|
||||||
allocator->func = gExpHeapDefaultAllocator.GetPtr();
|
allocator->func = gExpHeapDefaultAllocator.GetPtr();
|
||||||
gExpHeapDefaultAllocator->funcAlloc = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Alloc));
|
gExpHeapDefaultAllocator->funcAlloc = PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Alloc);
|
||||||
gExpHeapDefaultAllocator->funcFree = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Free));
|
gExpHeapDefaultAllocator->funcFree = PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Free);
|
||||||
|
|
||||||
allocator->heap = heap;
|
allocator->heap = heap;
|
||||||
allocator->param1 = alignment;
|
allocator->param1 = alignment;
|
||||||
|
Loading…
Reference in New Issue
Block a user