2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2023-02-27 08:14:02 +00:00
|
|
|
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
|
2023-07-10 19:03:01 +00:00
|
|
|
void* allocatedRamAddr =
|
|
|
|
SystemArena_MallocRDebug((intptr_t)vramEnd - (intptr_t)vramStart, "../loadfragment2.c", 31);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
if (gOverlayLogSeverity >= 3) {
|
2023-02-27 08:14:02 +00:00
|
|
|
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vramStart, vramEnd, allocatedRamAddr,
|
|
|
|
((uintptr_t)vramEnd - (uintptr_t)vramStart) + (uintptr_t)allocatedRamAddr,
|
|
|
|
(uintptr_t)vramStart - (uintptr_t)allocatedRamAddr);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2023-02-27 08:14:02 +00:00
|
|
|
if (allocatedRamAddr != NULL) {
|
|
|
|
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
|
2020-03-17 04:31:30 +00:00
|
|
|
}
|
|
|
|
|
2023-02-27 08:14:02 +00:00
|
|
|
return allocatedRamAddr;
|
2020-03-22 21:19:43 +00:00
|
|
|
}
|