mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 06:54:14 -04:00
4fa13e4132
* Delete unused headers * Move PR and io to ultra64 * move headers to ultra64 * more cleanups * more reorganizing * i think that should be all * format * ifdef guards cleanup * Add IO_READ and IO_WRITE macros for future use * warnings * review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * warnings again * warn * ifdef guards * fix merge * fix merge * fix merge * bss * padutils.h * bss * bss * bss * fix merge * bss * bss * bss * fix merge * fixes * fixes * bss * bss * fix merge * fix * fix * fix includepaths * fix paths * bss * fix * ultra64/ -> PR/ * header guards * fix ehader guards * fix * fix++ * format * bss is borken * prevent 2 * :despair: * bss * rename assert to dbg_hungup * fix * a * fix * bss * fix * bss * bss --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
99 lines
3.4 KiB
C
99 lines
3.4 KiB
C
#include "prevent_bss_reordering.h"
|
|
#include "global.h"
|
|
#include "fault.h"
|
|
|
|
// Init Vars declarations (also used in the table below)
|
|
#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName) extern ActorInit name##_InitVars;
|
|
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, _allocType, _debugName) extern ActorInit name##_InitVars;
|
|
#define DEFINE_ACTOR_UNSET(_enumValue)
|
|
|
|
#include "tables/actor_table.h"
|
|
|
|
#undef DEFINE_ACTOR
|
|
#undef DEFINE_ACTOR_INTERNAL
|
|
#undef DEFINE_ACTOR_UNSET
|
|
|
|
// Actor Overlay Table definition
|
|
#define DEFINE_ACTOR(name, _enumValue, allocType, _debugName) \
|
|
{ SEGMENT_ROM_START(ovl_##name), \
|
|
SEGMENT_ROM_END(ovl_##name), \
|
|
SEGMENT_START(ovl_##name), \
|
|
SEGMENT_END(ovl_##name), \
|
|
NULL, \
|
|
&name##_InitVars, \
|
|
NULL, \
|
|
allocType, \
|
|
0 },
|
|
|
|
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, allocType, _debugName) \
|
|
{ 0, 0, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0 },
|
|
|
|
#define DEFINE_ACTOR_UNSET(_enumValue) { 0 },
|
|
|
|
ActorOverlay gActorOverlayTable[] = {
|
|
#include "tables/actor_table.h"
|
|
};
|
|
|
|
#undef DEFINE_ACTOR
|
|
#undef DEFINE_ACTOR_INTERNAL
|
|
#undef DEFINE_ACTOR_UNSET
|
|
|
|
ActorId gMaxActorId = 0;
|
|
|
|
FaultClient sActorOverlayTableFaultClient;
|
|
FaultAddrConvClient sActorOverlayTableFaultAddrConvClient;
|
|
|
|
void ActorOverlayTable_FaultClient(void* arg0, void* arg1) {
|
|
ActorOverlay* overlayEntry;
|
|
u32 overlaySize;
|
|
ActorId actorId;
|
|
|
|
FaultDrawer_SetCharPad(-2, 0);
|
|
|
|
FaultDrawer_Printf("actor_dlftbls %u\n", gMaxActorId);
|
|
FaultDrawer_Printf("No. RamStart- RamEnd cn Name\n");
|
|
|
|
for (actorId = 0, overlayEntry = &gActorOverlayTable[0]; actorId < gMaxActorId; actorId++, overlayEntry++) {
|
|
overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart;
|
|
if (overlayEntry->loadedRamAddr != NULL) {
|
|
FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", actorId, overlayEntry->loadedRamAddr,
|
|
(u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded, "");
|
|
}
|
|
}
|
|
}
|
|
|
|
uintptr_t ActorOverlayTable_FaultAddrConv(uintptr_t address, void* param) {
|
|
uintptr_t addr = address;
|
|
ActorOverlay* actorOvl = &gActorOverlayTable[0];
|
|
size_t ramConv;
|
|
void* ramStart;
|
|
size_t diff;
|
|
ActorId actorId;
|
|
|
|
for (actorId = 0; actorId < gMaxActorId; actorId++, actorOvl++) {
|
|
diff = (uintptr_t)actorOvl->vramEnd - (uintptr_t)actorOvl->vramStart;
|
|
ramStart = actorOvl->loadedRamAddr;
|
|
ramConv = (uintptr_t)actorOvl->vramStart - (uintptr_t)ramStart;
|
|
|
|
if (ramStart != NULL) {
|
|
if ((addr >= (uintptr_t)ramStart) && (addr < (uintptr_t)ramStart + diff)) {
|
|
return addr + ramConv;
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void ActorOverlayTable_Init(void) {
|
|
gMaxActorId = ACTOR_ID_MAX;
|
|
Fault_AddClient(&sActorOverlayTableFaultClient, ActorOverlayTable_FaultClient, NULL, NULL);
|
|
Fault_AddAddrConvClient(&sActorOverlayTableFaultAddrConvClient, ActorOverlayTable_FaultAddrConv, NULL);
|
|
}
|
|
|
|
void ActorOverlayTable_Cleanup(void) {
|
|
Fault_RemoveClient(&sActorOverlayTableFaultClient);
|
|
Fault_RemoveAddrConvClient(&sActorOverlayTableFaultAddrConvClient);
|
|
gMaxActorId = 0;
|
|
}
|