1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-04 00:36:09 +00:00
oot/src/code/loadfragment2.c
Derek Hensley bd6b51a869
Overlay Functions Cleanup (#1235)
* Cleanup load functions

* Some cleanup

* forgot .

* Split off Overlay_Load

* review

* OverlayRelocationType -> MIPSRelocationType

* Reloc type macro and mips relocations
2022-05-31 20:28:17 +02:00

17 lines
725 B
C

#include "global.h"
void* Overlay_AllocateAndLoad(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd) {
void* allocatedVRamAddr = SystemArena_MallocRDebug((s32)vRamEnd - (s32)vRamStart, "../loadfragment2.c", 31);
if (gOverlayLogSeverity >= 3) {
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr,
((uintptr_t)vRamEnd - (uintptr_t)vRamStart) + (uintptr_t)allocatedVRamAddr,
(uintptr_t)vRamStart - (uintptr_t)allocatedVRamAddr);
}
if (allocatedVRamAddr != NULL) {
Overlay_Load(vRomStart, vRomEnd, vRamStart, vRamEnd, allocatedVRamAddr);
}
return allocatedVRamAddr;
}