2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-31 18:28:17 +00:00
|
|
|
void* Overlay_AllocateAndLoad(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd) {
|
2021-02-14 00:49:40 +00:00
|
|
|
void* allocatedVRamAddr = SystemArena_MallocRDebug((s32)vRamEnd - (s32)vRamStart, "../loadfragment2.c", 31);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (gOverlayLogSeverity >= 3) {
|
|
|
|
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr,
|
2022-05-31 18:28:17 +00:00
|
|
|
((uintptr_t)vRamEnd - (uintptr_t)vRamStart) + (uintptr_t)allocatedVRamAddr,
|
|
|
|
(uintptr_t)vRamStart - (uintptr_t)allocatedVRamAddr);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (allocatedVRamAddr != NULL) {
|
2020-03-17 04:31:30 +00:00
|
|
|
Overlay_Load(vRomStart, vRomEnd, vRamStart, vRamEnd, allocatedVRamAddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return allocatedVRamAddr;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|