Misc Cleanup 2 (#1007)

* Cleanup `UNK_TYPE`, `UNK_PTR` usage

* Add some missing empty lines after declarations

* Remove some legacy comments from non-matching times

* Fix some grammar (mostly "it's"/"its")

* Use proper names for two symbols after ZAPD bugfix

* Cleanup `place_title_cards.xml`

* Use `NULL` to check against `D_8012D260` pointer

* Parentheses around some macro arguments

* wip proofread headers up to z64animation.h
This commit is contained in:
Dragorn421
2021-12-01 00:40:42 +01:00
committed by GitHub
parent 04a9d51e90
commit 669732abbe
104 changed files with 217 additions and 92 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
/**
* Command Base macros intended for use in designing of more specific command macros
* Each macro packs bytes (B), halfowrds (H) and words (W, for consistency) into a single word
* Each macro packs bytes (B), halfwords (H) and words (W, for consistency) into a single word
*/
#define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8))
+6 -4
View File
@@ -21,9 +21,11 @@
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
#define MEDIAN3(a1, a2, a3) ((a2 >= a1) ? ((a3 >= a2) ? a2 : ((a1 >= a3) ? a1 : a3)) : ((a2 >= a3) ? a2 : ((a3 >= a1) ? a1 : a3)))
#define MEDIAN3(a1, a2, a3) \
(((a2) >= (a1)) ? (((a3) >= (a2)) ? (a2) : (((a1) >= (a3)) ? (a1) : (a3))) \
: (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3))))
#define RGBA8(r, g, b, a) (((r & 0xFF) << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | ((a & 0xFF) << 0))
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0))
#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
@@ -68,8 +70,8 @@
? ITEM_SWORD_BGS \
: gSaveContext.equips.buttonItems[0])
#define C_BTN_ITEM(button) ((gSaveContext.buttonStatus[button + 1] != BTN_DISABLED) \
? gSaveContext.equips.buttonItems[button + 1] \
#define C_BTN_ITEM(button) ((gSaveContext.buttonStatus[(button) + 1] != BTN_DISABLED) \
? gSaveContext.equips.buttonItems[(button) + 1] \
: ITEM_NONE)
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
+20 -20
View File
@@ -1337,24 +1337,24 @@ typedef struct {
} EntranceInfo; // size = 0x4
typedef struct {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ u32 vromStart; // if applicable
/* 0x08 */ u32 vromEnd; // if applicable
/* 0x0C */ void* vramStart; // if applicable
/* 0x10 */ void* vramEnd; // if applicable
/* 0x14 */ UNK_PTR unk_14;
/* 0x18 */ void* init; // initializes and executes the given context
/* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load
/* 0x20 */ UNK_PTR unk_20;
/* 0x24 */ UNK_PTR unk_24;
/* 0x28 */ UNK_TYPE unk_28;
/* 0x2C */ u32 instanceSize;
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ u32 vromStart; // if applicable
/* 0x08 */ u32 vromEnd; // if applicable
/* 0x0C */ void* vramStart; // if applicable
/* 0x10 */ void* vramEnd; // if applicable
/* 0x14 */ UNK_PTR unk_14;
/* 0x18 */ void* init; // initializes and executes the given context
/* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load
/* 0x20 */ UNK_PTR unk_20;
/* 0x24 */ UNK_PTR unk_24;
/* 0x28 */ UNK_TYPE4 unk_28;
/* 0x2C */ u32 instanceSize;
} GameStateOverlay; // size = 0x30
typedef struct PreNMIContext {
/* 0x00 */ GameState state;
/* 0xA4 */ u32 timer;
/* 0xA8 */ UNK_TYPE unk_A8;
/* 0xA4 */ u32 timer;
/* 0xA8 */ UNK_TYPE4 unk_A8;
} PreNMIContext; // size = 0xAC
typedef enum {
@@ -1669,11 +1669,11 @@ typedef struct {
/* 0x0234 */ OSScTask* curRDPTask;
/* 0x0238 */ s32 retraceCnt;
/* 0x023C */ s32 doAudio;
/* 0x0240 */ CfbInfo* curBuf;
/* 0x0244 */ CfbInfo* pendingSwapBuf1;
/* 0x0220 */ CfbInfo* pendingSwapBuf2;
/* 0x0220 */ UNK_TYPE unk_24C;
/* 0x0250 */ IrqMgrClient irqClient;
/* 0x0240 */ CfbInfo* curBuf;
/* 0x0244 */ CfbInfo* pendingSwapBuf1;
/* 0x0220 */ CfbInfo* pendingSwapBuf2;
/* 0x0220 */ UNK_TYPE4 unk_24C;
/* 0x0250 */ IrqMgrClient irqClient;
} SchedContext; // size = 0x258
// ========================
@@ -1833,7 +1833,7 @@ typedef struct {
/* 0x50 */ u8* symbols;
} JpegHuffmanTable; // size = 0x54
// this struct might be unaccurate but it's not used outside jpegutils.c anyways
// this struct might be inaccurate but it's not used outside jpegutils.c anyways
typedef struct {
/* 0x000 */ u8 codeOffs[16];
/* 0x010 */ u16 dcCodes[120];
+2 -2
View File
@@ -91,7 +91,7 @@ typedef struct {
typedef struct {
/* 0x00 */ AnimationHeaderCommon common;
/* 0x04 */ s16* frameData; // "tbl"
/* 0x04 */ s16* frameData; // "tbl"
/* 0x08 */ JointIndex* jointIndices; // "ref_tbl"
/* 0x0C */ u16 staticIndexMax;
} AnimationHeader; // size = 0x10
@@ -265,7 +265,7 @@ typedef struct SkelAnime {
/* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph
/* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph
/* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton
/* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace.
/* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace.
/* 0x36 */ s16 prevRot; // Previous rotation in worldspace.
/* 0x38 */ Vec3s prevTransl; // Previous modelspace translation.
/* 0x3E */ Vec3s baseTransl; // Base modelspace translation.