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:
Kenix3
2020-06-04 23:07:09 -04:00
parent 664182c289
commit 5c97d35841
8 changed files with 31 additions and 27 deletions
+1
View File
@@ -4,5 +4,6 @@
#include "structs.h"
#include "functions.h"
#include "variables.h"
#include "macros.h"
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef _MACROS_H_
#define _MACROS_H_
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
#define PHYSICAL_TO_VIRTUAL(addr) ((u32)(addr) + 0x80000000)
#define PHYSICAL_TO_VIRTUAL2(addr) ((u32)(addr) - 0x80000000)
#define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gRspSegmentPhysAddrs[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr))
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
#endif
+1 -1
View File
@@ -1468,7 +1468,7 @@ typedef struct {
/* 0x009 */ u8 spawnedObjectCount;
/* 0x00A */ u8 mainKeepIndex;
/* 0x00B */ u8 keepObjectId;
/* 0x00C */ SceneObject objects[35];
/* 0x00C */ SceneObject objects[35]; // TODO: OBJECT_EXCHANGE_BANK_MAX array size
} SceneContext; // size = 0x958
typedef struct {
+1 -1
View File
@@ -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 void* gRspSegmentPhysAddrs[16]; // D_801F8180
extern u32 gRspSegmentPhysAddrs[16]; // D_801F8180
extern SchedThreadStruct schedContext; // D_801F81C0
extern OSMesgQueueListNode mainIrqmgrCallbackNode; // D_801F84F8
extern OSMesgQueue mainIrqmgrCallbackQueue; // D_801F8500