1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-02 15:55:59 +00:00
oot/src/code/z_actor_dlftbls.c

96 lines
3.1 KiB
C
Raw Normal View History

#include "global.h"
2020-03-17 04:31:30 +00:00
// Linker symbol declarations (used in the table below)
#define DEFINE_ACTOR(name, _1, _2) DECLARE_OVERLAY_SEGMENT(name)
#define DEFINE_ACTOR_INTERNAL(_0, _1, _2)
#define DEFINE_ACTOR_UNSET(_0)
#include "tables/actor_table.h"
#undef DEFINE_ACTOR
#undef DEFINE_ACTOR_INTERNAL
#undef DEFINE_ACTOR_UNSET
// Init Vars declarations (also used in the table below)
#define DEFINE_ACTOR(name, _1, _2) extern ActorInit name##_InitVars;
#define DEFINE_ACTOR_INTERNAL(name, _1, _2) extern ActorInit name##_InitVars;
#define DEFINE_ACTOR_UNSET(_0)
2020-03-17 04:31:30 +00:00
#include "tables/actor_table.h"
2020-03-17 04:31:30 +00:00
#undef DEFINE_ACTOR
#undef DEFINE_ACTOR_INTERNAL
#undef DEFINE_ACTOR_UNSET
// Actor Overlay Table definition
#define DEFINE_ACTOR(name, _1, allocType) \
{ (u32)_ovl_##name##SegmentRomStart, \
(u32)_ovl_##name##SegmentRomEnd, \
_ovl_##name##SegmentStart, \
_ovl_##name##SegmentEnd, \
NULL, \
&name##_InitVars, \
#name, \
allocType, \
0 },
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType) { 0, 0, NULL, NULL, NULL, &name##_InitVars, #name, allocType, 0 },
#define DEFINE_ACTOR_UNSET(_0) { 0 },
2020-03-17 04:31:30 +00:00
2020-03-22 21:19:43 +00:00
ActorOverlay gActorOverlayTable[] = {
#include "tables/actor_table.h"
2020-03-17 04:31:30 +00:00
};
#undef DEFINE_ACTOR
#undef DEFINE_ACTOR_INTERNAL
#undef DEFINE_ACTOR_UNSET
s32 gMaxActorId = 0;
2020-03-17 04:31:30 +00:00
static FaultClient sFaultClient;
2020-03-22 21:19:43 +00:00
void ActorOverlayTable_LogPrint(void) {
2020-03-17 04:31:30 +00:00
ActorOverlay* overlayEntry;
u32 i;
osSyncPrintf("actor_dlftbls %u\n", gMaxActorId);
2020-03-17 04:31:30 +00:00
osSyncPrintf("RomStart RomEnd SegStart SegEnd allocp profile segname\n");
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < (u32)gMaxActorId; i++, overlayEntry++) {
2020-03-22 21:19:43 +00:00
osSyncPrintf("%08x %08x %08x %08x %08x %08x %s\n", overlayEntry->vromStart, overlayEntry->vromEnd,
overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr,
&overlayEntry->initInfo->id, overlayEntry->name != NULL ? overlayEntry->name : "?");
2020-03-17 04:31:30 +00:00
}
}
2020-03-22 21:19:43 +00:00
void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) {
2020-03-17 04:31:30 +00:00
ActorOverlay* overlayEntry;
u32 overlaySize;
s32 i;
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf("actor_dlftbls %u\n", gMaxActorId);
2020-03-17 04:31:30 +00:00
FaultDrawer_Printf("No. RamStart- RamEnd cn Name\n");
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxActorId; i++, overlayEntry++) {
2020-03-17 04:31:30 +00:00
overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart;
2020-03-22 21:19:43 +00:00
if (overlayEntry->loadedRamAddr != NULL) {
FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr,
(u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded,
2020-03-22 21:19:43 +00:00
overlayEntry->name != NULL ? overlayEntry->name : "");
2020-03-17 04:31:30 +00:00
}
}
}
2020-03-22 21:19:43 +00:00
void ActorOverlayTable_Init(void) {
gMaxActorId = ACTOR_ID_MAX;
2020-03-17 04:31:30 +00:00
Fault_AddClient(&sFaultClient, ActorOverlayTable_FaultPrint, NULL, NULL);
}
2020-03-22 21:19:43 +00:00
void ActorOverlayTable_Cleanup(void) {
2020-03-17 04:31:30 +00:00
Fault_RemoveClient(&sFaultClient);
gMaxActorId = 0;
2020-03-17 04:31:30 +00:00
}