mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-24 09:01:22 -04:00
Added macros header
Additionally, updated code to use PHYSICAL_TO_VIRTUAL and ALIGN16 macros. Additionally, retyped gRspSegmentPhysAddrs back to u32 as in OOT. These get the straight return value of PHYSICAL_TO_VIRTUAL, so they are u32.
This commit is contained in:
+4
-8
@@ -607,9 +607,8 @@ f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
|
||||
void Lib_Nop801004FC(void) {}
|
||||
|
||||
void* Lib_PtrSegToVirt(void* ptr) {
|
||||
// TODO: PHYSICAL_TO_VIRTUAL macro
|
||||
// UB to cast the pointer to u32
|
||||
return (void*)(((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF)) + 0x80000000);
|
||||
return (void*)PHYSICAL_TO_VIRTUAL((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF));
|
||||
}
|
||||
|
||||
void* Lib_PtrSegToVirtNull(void* ptr) {
|
||||
@@ -618,17 +617,15 @@ void* Lib_PtrSegToVirtNull(void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// TODO: PHYSICAL_TO_VIRTUAL macro
|
||||
// UB to cast the pointer to u32
|
||||
return (void*)(((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF)) + 0x80000000);
|
||||
return (void*)PHYSICAL_TO_VIRTUAL((u32)gRspSegmentPhysAddrs[((u32)ptr << 4) >> 28] + ((u32)ptr & 0xFFFFFF));
|
||||
}
|
||||
|
||||
void* Lib_PtrSegToK0(void* ptr) {
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
// TODO: PHYSICAL_TO_VIRTUAL macro
|
||||
return (void*)((u32)ptr + 0x80000000);
|
||||
return (void*)PHYSICAL_TO_VIRTUAL(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -636,7 +633,6 @@ void* Lib_PtrSegToK0Null(void* ptr) {
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
// TODO: PHYSICAL_TO_VIRTUAL macro
|
||||
return (void*)((u32)ptr + 0x80000000);
|
||||
return (void*)PHYSICAL_TO_VIRTUAL(ptr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user