mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-09 18:43:45 +00:00
21 lines
783 B
C
21 lines
783 B
C
#include "libc64/malloc.h"
|
|
#include "libu64/overlay.h"
|
|
#include "printf.h"
|
|
|
|
#include "macros.h"
|
|
|
|
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
|
|
void* allocatedRamAddr = SYSTEM_ARENA_MALLOC_R((intptr_t)vramEnd - (intptr_t)vramStart, "../loadfragment2.c", 31);
|
|
|
|
if (gOverlayLogSeverity >= 3) {
|
|
PRINTF("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);
|
|
}
|
|
|
|
if (allocatedRamAddr != NULL) {
|
|
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
|
|
}
|
|
|
|
return allocatedRamAddr;
|
|
}
|