2020-10-03 17:22:44 +02:00
|
|
|
#include "global.h"
|
2024-08-28 09:38:42 +02:00
|
|
|
#include "fault.h"
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2021-08-30 03:24:32 +02:00
|
|
|
// Linker symbol declarations (used in the table below)
|
2022-06-06 21:51:03 +02:00
|
|
|
#define DEFINE_ACTOR(name, _1, _2, _3) DECLARE_OVERLAY_SEGMENT(name)
|
|
|
|
#define DEFINE_ACTOR_INTERNAL(_0, _1, _2, _3)
|
2021-08-30 03:24:32 +02:00
|
|
|
#define DEFINE_ACTOR_UNSET(_0)
|
|
|
|
|
|
|
|
#include "tables/actor_table.h"
|
|
|
|
|
|
|
|
#undef DEFINE_ACTOR
|
|
|
|
#undef DEFINE_ACTOR_INTERNAL
|
|
|
|
#undef DEFINE_ACTOR_UNSET
|
|
|
|
|
2024-08-02 17:50:02 -04:00
|
|
|
// Profile declarations (also used in the table below)
|
|
|
|
#define DEFINE_ACTOR(name, _1, _2, _3) extern ActorProfile name##_Profile;
|
|
|
|
#define DEFINE_ACTOR_INTERNAL(name, _1, _2, _3) extern ActorProfile name##_Profile;
|
2021-08-30 03:24:32 +02:00
|
|
|
#define DEFINE_ACTOR_UNSET(_0)
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2021-08-30 03:24:32 +02:00
|
|
|
#include "tables/actor_table.h"
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2021-08-30 03:24:32 +02:00
|
|
|
#undef DEFINE_ACTOR
|
|
|
|
#undef DEFINE_ACTOR_INTERNAL
|
|
|
|
#undef DEFINE_ACTOR_UNSET
|
|
|
|
|
|
|
|
// Actor Overlay Table definition
|
2024-02-26 23:23:19 -08:00
|
|
|
#if OOT_DEBUG
|
|
|
|
|
2022-06-06 21:51:03 +02:00
|
|
|
#define DEFINE_ACTOR(name, _1, allocType, nameString) \
|
2024-02-29 05:15:04 -08:00
|
|
|
{ \
|
|
|
|
ROM_FILE(ovl_##name), \
|
|
|
|
_ovl_##name##SegmentStart, \
|
|
|
|
_ovl_##name##SegmentEnd, \
|
|
|
|
NULL, \
|
2024-08-02 17:50:02 -04:00
|
|
|
&name##_Profile, \
|
2024-02-29 05:15:04 -08:00
|
|
|
nameString, \
|
|
|
|
allocType, \
|
|
|
|
0, \
|
|
|
|
},
|
|
|
|
|
2024-08-02 17:50:02 -04:00
|
|
|
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \
|
|
|
|
{ \
|
|
|
|
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_Profile, nameString, allocType, 0, \
|
2024-02-29 05:15:04 -08:00
|
|
|
},
|
2021-08-30 03:24:32 +02:00
|
|
|
|
2024-02-26 23:23:19 -08:00
|
|
|
#else
|
|
|
|
|
|
|
|
// Actor name is set to NULL in retail builds
|
2024-02-29 05:15:04 -08:00
|
|
|
#define DEFINE_ACTOR(name, _1, allocType, _3) \
|
|
|
|
{ \
|
|
|
|
ROM_FILE(ovl_##name), \
|
|
|
|
_ovl_##name##SegmentStart, \
|
|
|
|
_ovl_##name##SegmentEnd, \
|
|
|
|
NULL, \
|
2024-08-02 17:50:02 -04:00
|
|
|
&name##_Profile, \
|
2024-02-29 05:15:04 -08:00
|
|
|
NULL, \
|
|
|
|
allocType, \
|
|
|
|
0, \
|
|
|
|
},
|
|
|
|
|
2024-08-02 17:50:02 -04:00
|
|
|
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) \
|
|
|
|
{ \
|
|
|
|
ROM_FILE_UNSET, NULL, NULL, NULL, &name##_Profile, NULL, allocType, 0, \
|
2024-02-29 05:15:04 -08:00
|
|
|
},
|
2024-02-26 23:23:19 -08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-08-30 03:24:32 +02:00
|
|
|
#define DEFINE_ACTOR_UNSET(_0) { 0 },
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2020-03-22 22:19:43 +01:00
|
|
|
ActorOverlay gActorOverlayTable[] = {
|
2021-08-30 03:24:32 +02:00
|
|
|
#include "tables/actor_table.h"
|
2020-03-17 00:31:30 -04:00
|
|
|
};
|
|
|
|
|
2021-08-30 03:24:32 +02:00
|
|
|
#undef DEFINE_ACTOR
|
|
|
|
#undef DEFINE_ACTOR_INTERNAL
|
|
|
|
#undef DEFINE_ACTOR_UNSET
|
|
|
|
|
2020-05-18 20:24:00 +02:00
|
|
|
s32 gMaxActorId = 0;
|
2020-03-17 00:31:30 -04:00
|
|
|
|
|
|
|
static FaultClient sFaultClient;
|
|
|
|
|
2020-03-22 22:19:43 +01:00
|
|
|
void ActorOverlayTable_LogPrint(void) {
|
2024-02-01 22:56:17 -05:00
|
|
|
#if OOT_DEBUG
|
2020-03-17 00:31:30 -04:00
|
|
|
ActorOverlay* overlayEntry;
|
|
|
|
u32 i;
|
|
|
|
|
2024-01-12 07:38:13 -08:00
|
|
|
PRINTF("actor_dlftbls %u\n", gMaxActorId);
|
|
|
|
PRINTF("RomStart RomEnd SegStart SegEnd allocp profile segname\n");
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < (u32)gMaxActorId; i++, overlayEntry++) {
|
2024-02-29 05:15:04 -08:00
|
|
|
PRINTF("%08x %08x %08x %08x %08x %08x %s\n", overlayEntry->file.vromStart, overlayEntry->file.vromEnd,
|
2024-08-02 17:50:02 -04:00
|
|
|
overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, &overlayEntry->profile->id,
|
2024-01-12 07:38:13 -08:00
|
|
|
overlayEntry->name != NULL ? overlayEntry->name : "?");
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
2024-02-01 22:56:17 -05:00
|
|
|
#endif
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
|
|
|
|
2020-03-22 22:19:43 +01:00
|
|
|
void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) {
|
2020-03-17 00:31:30 -04:00
|
|
|
ActorOverlay* overlayEntry;
|
|
|
|
u32 overlaySize;
|
|
|
|
s32 i;
|
|
|
|
|
2024-09-03 20:43:06 -07:00
|
|
|
Fault_SetCharPad(-2, 0);
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2024-09-03 20:43:06 -07:00
|
|
|
Fault_Printf("actor_dlftbls %u\n", gMaxActorId);
|
|
|
|
Fault_Printf("No. RamStart- RamEnd cn Name\n");
|
2020-03-17 00:31:30 -04:00
|
|
|
|
2020-05-18 20:24:00 +02:00
|
|
|
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxActorId; i++, overlayEntry++) {
|
2023-07-10 21:03:01 +02:00
|
|
|
overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart;
|
2020-03-22 22:19:43 +01:00
|
|
|
if (overlayEntry->loadedRamAddr != NULL) {
|
2024-09-03 20:43:06 -07:00
|
|
|
Fault_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr,
|
|
|
|
(uintptr_t)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded,
|
|
|
|
(OOT_DEBUG && overlayEntry->name != NULL) ? overlayEntry->name : "");
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-22 22:19:43 +01:00
|
|
|
void ActorOverlayTable_Init(void) {
|
2020-05-18 20:24:00 +02:00
|
|
|
gMaxActorId = ACTOR_ID_MAX;
|
2020-03-17 00:31:30 -04:00
|
|
|
Fault_AddClient(&sFaultClient, ActorOverlayTable_FaultPrint, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2020-03-22 22:19:43 +01:00
|
|
|
void ActorOverlayTable_Cleanup(void) {
|
2020-03-17 00:31:30 -04:00
|
|
|
Fault_RemoveClient(&sFaultClient);
|
2020-05-18 20:24:00 +02:00
|
|
|
gMaxActorId = 0;
|
2020-03-17 00:31:30 -04:00
|
|
|
}
|