mirror of https://github.com/zeldaret/mm.git
z_lib now uses SEGMENTED_TO_VIRTUAL macro
Additionally removed some TODO comments in z_scene and defining gRspSegmentPhysAddrs array size as NUM_SEGMENTS
This commit is contained in:
parent
5c97d35841
commit
cb8b9a2020
|
|
@ -4109,7 +4109,7 @@ extern UNK_TYPE1 D_801F80F8; // D_801F80F8
|
|||
extern u64 lastRenderFrameTimestamp; // D_801F8150
|
||||
extern OSMesgQueue siEventCallbackQueue; // D_801F8160
|
||||
extern OSMesg siEventCallbackBuffer[1]; // D_801F8178
|
||||
extern u32 gRspSegmentPhysAddrs[16]; // D_801F8180
|
||||
extern u32 gRspSegmentPhysAddrs[NUM_SEGMENTS]; // D_801F8180
|
||||
extern SchedThreadStruct schedContext; // D_801F81C0
|
||||
extern OSMesgQueueListNode mainIrqmgrCallbackNode; // D_801F84F8
|
||||
extern OSMesgQueue mainIrqmgrCallbackQueue; // D_801F8500
|
||||
|
|
|
|||
|
|
@ -607,18 +607,16 @@ f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
|
|||
void Lib_Nop801004FC(void) {}
|
||||
|
||||
void* Lib_PtrSegToVirt(void* ptr) {
|
||||
// UB to cast the pointer to u32
|
||||
return (void*)PHYSICAL_TO_VIRTUAL((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF));
|
||||
return SEGMENTED_TO_VIRTUAL(ptr);
|
||||
}
|
||||
|
||||
void* Lib_PtrSegToVirtNull(void* ptr) {
|
||||
// UB to cast the pointer to u32 in order to bitshift.
|
||||
// UB: to cast the pointer to u32 in order to bitshift.
|
||||
if (((u32)ptr >> 28) == 0) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// UB to cast the pointer to u32
|
||||
return (void*)PHYSICAL_TO_VIRTUAL((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF));
|
||||
return SEGMENTED_TO_VIRTUAL(ptr);
|
||||
}
|
||||
|
||||
void* Lib_PtrSegToK0(void* ptr) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void Scene_Init(GlobalContext* ctxt, SceneContext* sceneCtxt) {
|
|||
sceneCtxt->objectVramEnd = (void*)((u32)sceneCtxt->objectVramStart + spaceSize);
|
||||
// TODO: Second argument here is an object enum
|
||||
sceneCtxt->mainKeepIndex = Scene_LoadObject(sceneCtxt, 1);
|
||||
// TODO: Segment number enum
|
||||
// TODO: Segment number enum?
|
||||
gRspSegmentPhysAddrs[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].vramAddr);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,6 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
|
|||
s16 temp16;
|
||||
u8 unk20;
|
||||
|
||||
// TODO: UB to cast a u32 to pointer
|
||||
ctxt->linkActorEntry = (ActorEntry*)Lib_PtrSegToVirt(entry->spawnList.segment) +
|
||||
ctxt->setupEntranceList[ctxt->curSpawn].spawn;
|
||||
if ( (ctxt->linkActorEntry->params & 0x0F00) >> 8 == 0x0C ||
|
||||
|
|
@ -180,7 +179,6 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
|
|||
actorOverlayTable[0].initInfo->objectId = temp16;
|
||||
Scene_LoadObject(&ctxt->sceneContext, temp16);
|
||||
|
||||
// TODO: UB to cast pointer to u32
|
||||
ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].vramAddr = objectVramAddr;
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +232,7 @@ void Scene_HeaderCommand07(GlobalContext* ctxt, SceneCmd* entry) {
|
|||
if (entry->specialFiles.keepObjectId != 0) {
|
||||
ctxt->sceneContext.keepObjectId = Scene_LoadObject(&ctxt->sceneContext,
|
||||
entry->specialFiles.keepObjectId);
|
||||
// TODO: Segment number enum
|
||||
// TODO: Segment number enum?
|
||||
gRspSegmentPhysAddrs[5] =
|
||||
PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].vramAddr);
|
||||
}
|
||||
|
|
@ -298,7 +296,6 @@ void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) {
|
|||
|
||||
// TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT
|
||||
if (i < 0x22) {
|
||||
// TODO: UB to cast pointer to u32
|
||||
firstObject[i + 1].vramAddr = nextPtr;
|
||||
}
|
||||
i++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue