From 2341c44a6c3e2c5a44b640dd884b3ac3eca3ee68 Mon Sep 17 00:00:00 2001 From: fig02 Date: Thu, 24 Apr 2025 14:53:18 -0400 Subject: [PATCH 1/8] Use official macros for Physical Address conversion (#2511) --- include/macros.h | 3 --- src/code/ucode_disas.c | 2 +- src/code/z_actor.c | 2 +- src/code/z_effect_soft_sprite_old_init.c | 2 +- src/code/z_jpeg.c | 8 ++++---- src/code/z_parameter.c | 2 +- src/code/z_play.c | 14 +++++++------- src/code/z_player_lib.c | 10 +++++----- src/code/z_room.c | 4 ++-- src/code/z_scene.c | 4 ++-- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c | 2 +- .../z_bg_spot01_objects2.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 16 ++++++++-------- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 4 ++-- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 4 ++-- src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c | 2 +- .../actors/ovl_Door_Killer/z_door_killer.c | 4 ++-- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 2 +- .../actors/ovl_En_G_Switch/z_en_g_switch.c | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 4 ++-- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 4 ++-- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 12 ++++++------ src/overlays/actors/ovl_En_Ko/z_en_ko.c | 12 ++++++------ .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 6 +++--- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 10 +++++----- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 4 ++-- src/overlays/actors/ovl_En_Viewer/z_en_viewer.c | 6 +++--- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 2 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 2 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c | 4 ++-- .../effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 4 ++-- .../ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c | 4 ++-- .../ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c | 4 ++-- .../ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c | 4 ++-- .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 2 +- 35 files changed, 85 insertions(+), 88 deletions(-) diff --git a/include/macros.h b/include/macros.h index 0cb1b4285d..d4fc7d9a92 100644 --- a/include/macros.h +++ b/include/macros.h @@ -16,9 +16,6 @@ #define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) -#define PHYSICAL_TO_VIRTUAL(addr) (void*)((uintptr_t)(addr) + 0x80000000) -#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - 0x80000000) - #define ABS(x) ((x) >= 0 ? (x) : -(x)) #define DECR(x) ((x) == 0 ? 0 : --(x)) #define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index 4ccbdcb590..eadb32188a 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -61,7 +61,7 @@ typedef void (*UcodeDisasCallback)(UCodeDisas*, u32); void* UCodeDisas_TranslateAddr(UCodeDisas* this, uintptr_t addr) { uintptr_t physical = this->segments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr); - return PHYSICAL_TO_VIRTUAL(physical); + return OS_PHYSICAL_TO_K0(physical); } F3dzexConst sUCodeDisasGeometryModes[] = { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index b4bbfd3e43..7ea5bb355f 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -931,7 +931,7 @@ void Actor_SetScale(Actor* actor, f32 scale) { } void Actor_SetObjectDependency(PlayState* play, Actor* actor) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); } void Actor_Init(Actor* actor, PlayState* play) { diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index c04e76128e..967640f280 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -70,7 +70,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { SkinMatrix_SetScale(&mfScale, scale, scale, scale); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 9ac9fcc1a4..575cb282e0 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -48,12 +48,12 @@ void Jpeg_ScheduleDecoderTask(JpegContext* ctx) { JpegWork* workBuf = ctx->workBuf; s32 pad[2]; - workBuf->taskData.address = VIRTUAL_TO_PHYSICAL(&workBuf->data); + workBuf->taskData.address = OS_K0_TO_PHYSICAL(&workBuf->data); workBuf->taskData.mode = ctx->mode; workBuf->taskData.mbCount = 4; - workBuf->taskData.qTableYPtr = VIRTUAL_TO_PHYSICAL(&workBuf->qTableY); - workBuf->taskData.qTableUPtr = VIRTUAL_TO_PHYSICAL(&workBuf->qTableU); - workBuf->taskData.qTableVPtr = VIRTUAL_TO_PHYSICAL(&workBuf->qTableV); + workBuf->taskData.qTableYPtr = OS_K0_TO_PHYSICAL(&workBuf->qTableY); + workBuf->taskData.qTableUPtr = OS_K0_TO_PHYSICAL(&workBuf->qTableU); + workBuf->taskData.qTableVPtr = OS_K0_TO_PHYSICAL(&workBuf->qTableV); sJpegTask.t.flags = 0; sJpegTask.t.ucode_boot = SysUcode_GetUCodeBoot(); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index a4a9acb6f6..5d0166b494 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2163,7 +2163,7 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l DO_ACTION_TEX_SIZE, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145); osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } else { - gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->doActionSegment); + gSegments[7] = OS_K0_TO_PHYSICAL(interfaceCtx->doActionSegment); func_80086D5C(SEGMENTED_TO_VIRTUAL(sDoActionTextures[loadOffset]), DO_ACTION_TEX_SIZE / 4); } } diff --git a/src/code/z_play.c b/src/code/z_play.c index 71cbb88384..0ca29c698a 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -584,9 +584,9 @@ void Play_Update(PlayState* this) { } #endif - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) { if ((this->transitionMode == TRANS_MODE_OFF) && (this->transitionTrigger != TRANS_TRIGGER_OFF)) { @@ -1145,9 +1145,9 @@ void Play_Draw(PlayState* this) { OPEN_DISPS(gfxCtx, "../z_play.c", 3907); - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); gSPSegment(POLY_OPA_DISP++, 0x00, NULL); gSPSegment(POLY_XLU_DISP++, 0x00, NULL); @@ -1606,7 +1606,7 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { ASSERT(this->sceneSegment != NULL, "this->sceneSegment != NULL", "../z_play.c", 4960); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); Play_InitScene(this, spawn); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index adefea26a7..1ac27fdb6c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1525,7 +1525,7 @@ void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 dr OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2401); - gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment); + gSegments[6] = OS_K0_TO_PHYSICAL(this->giObjectSegment); gSPSegment(POLY_OPA_DISP++, 0x06, this->giObjectSegment); gSPSegment(POLY_XLU_DISP++, 0x06, this->giObjectSegment); @@ -1879,9 +1879,9 @@ u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime) ptr = (void*)ALIGN16((uintptr_t)ptr + size); - gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); + gSegments[4] = OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); gSegments[6] = - VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); + OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.save.linkAge], &gPlayerAnim_link_normal_wait, 9, ptr, ptr, PLAYER_LIMB_MAX); @@ -2057,9 +2057,9 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* Vec3s* srcTable; s32 i; - gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); + gSegments[4] = OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); gSegments[6] = - VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); + OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); if (!LINK_IS_ADULT) { if (shield == PLAYER_SHIELD_DEKU) { diff --git a/src/code/z_room.c b/src/code/z_room.c index eae1c9187b..a8e9c5b23e 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -715,7 +715,7 @@ s32 Room_ProcessRoomRequest(PlayState* play, RoomContext* roomCtx) { if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->roomRequestAddr; - gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->curRoom.segment); + gSegments[3] = OS_K0_TO_PHYSICAL(roomCtx->curRoom.segment); Scene_ExecuteCommands(play, roomCtx->curRoom.segment); Player_SetBootData(play, GET_PLAYER(play)); @@ -730,7 +730,7 @@ s32 Room_ProcessRoomRequest(PlayState* play, RoomContext* roomCtx) { void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { - gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); + gSegments[3] = OS_K0_TO_PHYSICAL(room->segment); ASSERT(room->roomShape->base.type < ARRAY_COUNTU(sRoomDrawHandlers), "this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125); sRoomDrawHandlers[room->roomShape->base.type](play, room, flags); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 56b0d0886b..2d54147930 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -108,7 +108,7 @@ void Object_InitContext(PlayState* play, ObjectContext* objectCtx) { objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepSlot = Object_SpawnPersistent(objectCtx, OBJECT_GAMEPLAY_KEEP); - gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); + gSegments[4] = OS_K0_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); } void Object_UpdateEntries(ObjectContext* objectCtx) { @@ -264,7 +264,7 @@ BAD_RETURN(s32) Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { BAD_RETURN(s32) Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.keepObjectId); - gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); } if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) { diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index 6fa9814a1b..bf00812fc6 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -117,7 +117,7 @@ void BgMjin_Draw(Actor* thisx, PlayState* play) { s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params - 1]); if (objectSlot >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 064ab1ca48..af7dec9c5d 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -101,7 +101,7 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { PRINTF(T("-----バンク切り換え成功!!\n", "----- Successful bank switching!!\n")); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->dyna.actor.objectSlot = this->requiredObjectSlot; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 11c82f6dab..50d3ab595c 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -359,7 +359,7 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) { this->animObjectSlot = Object_GetSlot(&play->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); } static InitChainEntry sInitChain[] = { @@ -522,7 +522,7 @@ void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) { this->actionFunc = BossGanon_IntroCutscene; this->unk_198 = 1; this->animObjectSlot = animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToLoop(&this->skelAnime, &gGanondorfPlayOrganAnim, 0.0f); } else { this->actionFunc = BossGanon_SetupIntroCutscene; @@ -570,7 +570,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { f32 cos; Camera* mainCam; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); sCape->backPush = -2.0f; sCape->backSwayMagnitude = 0.25f; @@ -1117,7 +1117,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { if (this->csTimer == 50) { gSegments[6] = - VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment); + OS_K0_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment); if (!GET_EVENTCHKINF(EVENTCHKINF_BEGAN_GANONDORF_BATTLE)) { TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanondorfTitleCardTex), @@ -1207,7 +1207,7 @@ void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) { this->csTimer = this->csState = 0; this->unk_198 = 1; this->animObjectSlot = animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->unk_508 = 0.0f; @@ -1220,7 +1220,7 @@ void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) { this->animObjectSlot = animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->actionFunc = BossGanon_DeathAndTowerCutscene; @@ -1255,7 +1255,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 pad; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); this->csTimer++; SkelAnime_Update(&this->skelAnime); @@ -2834,7 +2834,7 @@ void BossGanon_Update(Actor* thisx, PlayState* play2) { if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) { BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); } else { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); } if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 037a5a251e..53bfa09e56 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -380,7 +380,7 @@ void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId s32 pad; s32 objectSlot = Object_GetSlot(&play->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); if (setRSPSegment) { OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790); @@ -1343,7 +1343,7 @@ void func_808FFDB0(BossGanon2* this, PlayState* play) { s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON2); if (Object_IsLoaded(&play->objectCtx, objectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f); this->actionFunc = func_808FFEBC; diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 66fa72d89c..0d4692d9ba 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -330,7 +330,7 @@ void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 662); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[drawObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment); if (!play) {} CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 670); @@ -339,7 +339,7 @@ void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { s32 animObjectSlot = this->animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); } CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) { diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index b1bc8c5880..27cb963a4b 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -103,7 +103,7 @@ void func_80977F80(DemoGeff* this, PlayState* play) { OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); // Necessary to match if (!play) {} diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index 8aeffa3c1d..15d92cb18a 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -472,9 +472,9 @@ void DoorKiller_Wait(DoorKiller* this, PlayState* play) { void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->texture = SEGMENTED_TO_VIRTUAL(this->texture); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); } /** diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index e62c3ba41f..f5d3f0b9dd 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -192,7 +192,7 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) { void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->actor.objectSlot = this->requiredObjectSlot; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.gravity = -2.0f; diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index cd17e29eae..8bca3e607a 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -221,7 +221,7 @@ void EnGSwitch_Break(EnGSwitch* this, PlayState* play) { void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = EnGSwitch_DrawPot; this->actionFunc = EnGSwitch_ArcheryPot; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index a3476a809a..4b6a979b58 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -118,7 +118,7 @@ void func_80A3D838(EnGm* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->gmObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); Animation_Change(&this->skelAnime, &object_gm_Anim_0002B8, 1.0f, 0.0f, Animation_GetLastFrame(&object_gm_Anim_0002B8), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGm_Draw; @@ -287,7 +287,7 @@ void func_80A3DF60(EnGm* this, PlayState* play) { } void func_80A3DFBC(EnGm* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); this->timer++; this->actionFunc(this, play); this->actor.focus.rot.x = this->actor.world.rot.x; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 7e8c7de9a9..474912abb6 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -94,7 +94,7 @@ void EnGuest_Update(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gHylianMan2Skel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); Animation_Change(&this->skelAnime, &gObjOsAnim_42AC, 1.0f, 0.0f, Animation_GetLastFrame(&gObjOsAnim_42AC), ANIMMODE_LOOP, 0.0f); @@ -172,7 +172,7 @@ void func_80A505CC(Actor* thisx, PlayState* play) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); SkelAnime_Update(&this->skelAnime); Actor_SetFocus(&this->actor, 60.0f); diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 3af23db48b..655ebd4789 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1162,12 +1162,12 @@ void EnHy_Destroy(Actor* thisx, PlayState* play) { void EnHy_WaitForObjects(EnHy* this, PlayState* play) { if (EnHy_IsOsAnimeObjectLoaded(this, play) && EnHy_AreSkelAndHeadObjectsLoaded(this, play)) { this->actor.objectSlot = this->objectSlotLowerSkel; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeletonInfo[sModelInfo[ENHY_GET_TYPE(&this->actor)].lowerSkelInfoIndex].skeleton, NULL, this->jointTable, this->morphTable, ENHY_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); @@ -1350,7 +1350,7 @@ void EnHy_Update(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; if (this->actionFunc != EnHy_WaitForObjects) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); SkelAnime_Update(&this->skelAnime); EnHy_UpdateEyes(this); @@ -1377,7 +1377,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (limbIndex == ENHY_LIMB_HEAD) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotHead].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment); headInfoIndex = sModelInfo[ENHY_GET_TYPE(&this->actor)].headInfoIndex; *dList = sHeadInfo[headInfoIndex].headDList; @@ -1386,7 +1386,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTex)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotLowerSkel].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotLowerSkel].segment); } if (limbIndex == ENHY_LIMB_HEAD) { @@ -1423,7 +1423,7 @@ void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (limbIndex == ENHY_LIMB_RIGHT_FOOT) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotUpperSkel].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotUpperSkel].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotUpperSkel].segment); } if (ENHY_GET_TYPE(&this->actor) == ENHY_TYPE_MAN_2_BALD && limbIndex == ENHY_LIMB_TORSO) { diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 19501f3be2..2ba0af36ef 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -1186,11 +1186,11 @@ void func_80A99048(EnKo* this, PlayState* play) { if (EnKo_IsOsAnimeLoaded(this, play) && EnKo_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.objectSlot = this->legsObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -1305,7 +1305,7 @@ void EnKo_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != func_80A99048) { if ((s32)this->modelAlpha != 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); SkelAnime_Update(&this->skelAnime); func_80A98DB4(this, play); EnKo_Blink(this); @@ -1338,7 +1338,7 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (limbIndex == 15) { gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->headObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->headObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->headObjectSlot].segment); headId = sModelInfo[ENKO_TYPE].headId; *dList = sHead[headId].dList; @@ -1346,7 +1346,7 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po eyeTexture = sHead[headId].eyeTextures[this->eyeTextureIndex]; gSPSegment((*gfx)++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTexture)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->legsObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->legsObjectSlot].segment); } if (limbIndex == 8) { limbRot = this->interactInfo.torsoRot; @@ -1374,7 +1374,7 @@ void EnKo_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, if (limbIndex == 7) { gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->bodyObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->bodyObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->bodyObjectSlot].segment); } if (limbIndex == 15) { Matrix_MultVec3f(&D_80A9A774, &this->actor.focus.pos); diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 6507c88004..2d00504577 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -171,9 +171,9 @@ void func_80AB9F24(EnNiwLady* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->aneObjectSlot) && Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->aneObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->aneObjectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); this->unk_27E = 1; this->actor.gravity = -3.0f; Actor_SetScale(&this->actor, 0.01f); @@ -534,7 +534,7 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { if (this->unk_276 == 0) { Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); if (this->osAnimeObjectSlot >= 0) { if (this->unk_27E != 0) { if (this->unk_26E != 0) { diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 62bee590e8..9d70c9019a 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -2025,7 +2025,7 @@ void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f, Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f); this->actor.draw = EnOssan_DrawKokiriShopkeeper; @@ -2036,7 +2036,7 @@ void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawGoronShopkeeper; @@ -2045,7 +2045,7 @@ void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawZoraShopkeeper; @@ -2228,7 +2228,7 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { } void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); } void EnOssan_MainActionFunc(EnOssan* this, PlayState* play) { @@ -2398,7 +2398,7 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(PlayState* play, s32 limbIndex, Gfx if (limbIndex == 15) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlot2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot2].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot2].segment); *dList = gKokiriShopkeeperHeadDL; gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sKokiriShopkeeperEyeTextures[this->eyeTextureIdx])); } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 739919dafb..9eb1679a56 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -158,7 +158,7 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) { s16* params; EnSth_SetupShapeColliderUpdate2AndDraw(this, play); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]); @@ -401,7 +401,7 @@ void EnSth_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2133); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 5db75cbfe2..3290bb3e85 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -140,7 +140,7 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* sk SkelAnime_Init(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 1.0f); @@ -151,7 +151,7 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* sk void EnViewer_InitAnimImpa(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 3.0f); } @@ -504,7 +504,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { void EnViewer_Update(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 66a7b7c402..cb120b20cc 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -596,7 +596,7 @@ void EnZl2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void func_80B4FCCC(EnZl2* this, PlayState* play) { s32 objectSlot = this->zl2Anime1ObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 47f2c3b699..3fbe1b5fb1 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -765,7 +765,7 @@ s32 func_80B54DD4(EnZl3* this) { void func_80B54DE0(EnZl3* this, PlayState* play) { s32 objectSlot = this->zl2Anime2ObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index b66766dd19..c32349e1fa 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -87,7 +87,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_ss_d_fire.c", 276); if (Object_GetSlot(&play->objectCtx, OBJECT_DODONGO) >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); scale = this->rScale / 100.0f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); @@ -103,7 +103,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIndex])); gSPDisplayList(POLY_XLU_DISP++, this->gfx); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index 3af854c502..c5cee8db21 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -39,7 +39,7 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { uintptr_t oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -71,7 +71,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_extra.c", 168); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index edf09c372e..60cad10d01 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -55,7 +55,7 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { prevSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->rObjectSlot = objectSlot; this->pos = initParams->pos; this->velocity = initParams->velocity; @@ -111,7 +111,7 @@ void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this) Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c index 9ee5cbe831..316f65258a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c @@ -53,7 +53,7 @@ u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initP Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EffectSsGMagma2InitParams* initParams = (EffectSsGMagma2InitParams*)initParamsx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->rObjectSlot = objectSlot; this->pos = initParams->pos; this->velocity = zeroVec; @@ -92,7 +92,7 @@ void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_eff_ss_g_magma2.c", 282); diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index ab30ad37da..1445e61d02 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -40,7 +40,7 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { uintptr_t prevSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->velocity, &initParams->velocity); Math_Vec3f_Copy(&this->accel, &initParams->accel); @@ -76,7 +76,7 @@ void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { if ((objectSlot >= 0) && Object_IsLoaded(&play2->objectCtx, objectSlot)) { gDPPipeSync(POLY_XLU_DISP++); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); gDPPipeSync(POLY_XLU_DISP++); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index f1bca98a69..d9d558f0c4 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -3662,7 +3662,7 @@ void KaleidoScope_Update(PlayState* play) { DMA_REQUEST_SYNC(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0, "../z_kaleido_scope_PAL.c", 3662); - gSegments[8] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment); + gSegments[8] = OS_K0_TO_PHYSICAL(pauseCtx->iconItemSegment); for (i = 0; i < ARRAY_COUNTU(gItemAgeReqs); i++) { if (!CHECK_AGE_REQ_ITEM(i)) { From d4528a0541603ca126bc9c734b9c56bb094211cf Mon Sep 17 00:00:00 2001 From: cadmic Date: Thu, 24 Apr 2025 16:35:01 -0700 Subject: [PATCH 2/8] Add macOS instructions for installing mips-linux-gnu-gcc (#2508) * Add macOS instructions for installing mips-linux-gnu-gcc * Add --with-system-zlib to fix binutils build on macOS 15.3.1 --- docs/BUILDING_MACOS.md | 45 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/BUILDING_MACOS.md b/docs/BUILDING_MACOS.md index d34035fcec..8d2f67458e 100644 --- a/docs/BUILDING_MACOS.md +++ b/docs/BUILDING_MACOS.md @@ -55,12 +55,12 @@ cd build-binutils Configure the build ```bash -../binutils-2.35/configure --target=mips-linux-gnu --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror +../binutils-2.35/configure --target=mips-linux-gnu --prefix=/opt/cross --with-system-zlib --disable-gprof --disable-gdb --disable-werror ``` Make and install binutils ```bash -make -j +make -j$(nproc) sudo make install ``` @@ -82,3 +82,44 @@ If this worked, you can now delete the temporary directory `~/binutils-tmp`. Apple's version of `make` is very out-of-date, so you should use the brew-installed `gmake` in place of `make` in this repo from now on. You should now be able to continue from [step 2](../README.md#2-clone-the-repository) of the Linux instructions. + + +## 4. Building GCC (optional) + +If you'd like to compile with GCC instead of IDO (e.g. for modding), you can build it from source similarly to how we built binutils: + +Install dependences +```bash +brew install gcc@14 gmp isl libmpc mpfr +``` + +Create and enter local working dir +```bash +mkdir ~/gcc-tmp +cd ~/gcc-tmp +``` + +Get and extract gcc source +```bash +curl -O https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz +tar xvf gcc-14.2.0.tar.xz +``` + +Create and enter a build directory +```bash +mkdir build-gcc +cd build-gcc +``` + +Configure the build +```bash +CC=gcc-14 CXX=g++-14 ../gcc-14.2.0/configure --target=mips-linux-gnu --prefix=/opt/cross --disable-nls --enable-languages=c --with-gmp=$(brew --prefix)/opt/gmp --with-mpfr=$(brew --prefix)/opt/mpfr --with-mpc=$(brew --prefix)/opt/libmpc --with-isl=$(brew --prefix)/opt/isl +``` + +Make and install gcc +```bash +CC=gcc-14 CXX=g++-14 make all-gcc -j$(nproc) +sudo make install-gcc +``` + +If this worked, you can now delete the temporary directory `~/gcc-tmp`. From 25b2fa4bca1f1d2d155db2610191af1075e813b3 Mon Sep 17 00:00:00 2001 From: fig02 Date: Fri, 25 Apr 2025 21:12:35 -0400 Subject: [PATCH 3/8] macros.h 3/5: Split various macros (#2512) * split out various macros * fix * fix2 * fix dw * libc path * fix macro * does this fix bss * fix bss --- include/avoid_ub.h | 13 ++++ include/color.h | 2 + include/fault.h | 11 ++- include/gfx.h | 38 +++++++++ include/language_array.h | 12 +++ include/macros.h | 77 ------------------- include/sys_matrix.h | 3 + include/z64.h | 1 + include/z64animation.h | 1 + include/z64math.h | 28 ++++++- include/z64scene.h | 1 + include/z64view.h | 1 + src/code/fault_gc.c | 5 +- src/code/fault_gc_drawer.c | 2 + src/code/fault_n64.c | 3 +- src/code/main.c | 2 +- src/code/sys_cfb.c | 1 + src/code/z_camera.c | 3 +- src/code/z_fbdemo_circle.c | 1 + src/code/z_jpeg.c | 7 +- src/code/z_lights.c | 1 + src/code/z_message.c | 1 + src/code/z_parameter.c | 1 + src/code/z_play.c | 1 + src/code/z_scene.c | 1 + src/code/z_skelanime.c | 1 + src/code/z_view.c | 1 + src/code/z_vimode.c | 1 + src/n64dd/z_n64dd.c | 3 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 1 + .../actors/ovl_player_actor/z_player.c | 1 + .../ovl_file_choose/z_file_choose.c | 1 + .../ovl_file_choose/z_file_nameset.c | 1 + .../misc/ovl_kaleido_scope/z_kaleido_map.c | 1 + .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 1 + 35 files changed, 137 insertions(+), 92 deletions(-) create mode 100644 include/avoid_ub.h create mode 100644 include/language_array.h diff --git a/include/avoid_ub.h b/include/avoid_ub.h new file mode 100644 index 0000000000..4706f50ecf --- /dev/null +++ b/include/avoid_ub.h @@ -0,0 +1,13 @@ +#ifndef AVOID_UB_H +#define AVOID_UB_H + +/** + * This macro is used when the return type of a function is incorrect + */ +#ifndef AVOID_UB +#define BAD_RETURN(type) type +#else +#define BAD_RETURN(type) void +#endif + +#endif diff --git a/include/color.h b/include/color.h index 816d38349d..73fa5d63a0 100644 --- a/include/color.h +++ b/include/color.h @@ -33,4 +33,6 @@ typedef union Color_RGBA16 { u16 rgba; } Color_RGBA16; +#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) + #endif diff --git a/include/fault.h b/include/fault.h index 7418246f46..af895927d0 100644 --- a/include/fault.h +++ b/include/fault.h @@ -1,9 +1,10 @@ #ifndef FAULT_H #define FAULT_H -#include "ultra64.h" -#include "attributes.h" +#include "libu64/debug.h" #include "libu64/pad.h" +#include "attributes.h" +#include "ultra64.h" #if !PLATFORM_N64 // These are the same as the 3-bit ansi color codes @@ -50,6 +51,12 @@ void Fault_Init(void); NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); NORETURN void Fault_AddHungupAndCrash(const char* file, int line); +#if PLATFORM_N64 || DEBUG_FEATURES +#define HUNGUP_AND_CRASH(file, line) Fault_AddHungupAndCrash(file, line) +#else +#define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line) +#endif + // Client Registration void Fault_AddClient(FaultClient* client, void* callback, void* arg0, void* arg1); diff --git a/include/gfx.h b/include/gfx.h index 290b630543..e534655964 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -7,6 +7,9 @@ #include "thga.h" #include "versions.h" +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 + // Texture memory size, 4 KiB #define TMEM_SIZE 0x1000 @@ -124,4 +127,39 @@ void Graph_ThreadEntry(void*); extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" extern u64 gMojiFontTex[]; // original name: "font_ff" +/** + * `x` vertex x + * `y` vertex y + * `z` vertex z + * `s` texture s coordinate + * `t` texture t coordinate + * `crnx` red component of color vertex, or x component of normal vertex + * `cgny` green component of color vertex, or y component of normal vertex + * `cbnz` blue component of color vertex, or z component of normal vertex + * `a` alpha + */ +#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } } + +#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } + +#define gDPSetTileCustom(pkt, fmt, siz, uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPPipeSync(pkt); \ + gDPTileSync(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \ + G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, \ + shifts); \ + gDPTileSync(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ +}) + #endif diff --git a/include/language_array.h b/include/language_array.h new file mode 100644 index 0000000000..b93dbd4e0e --- /dev/null +++ b/include/language_array.h @@ -0,0 +1,12 @@ +#ifndef LANGUAGE_ARRAY_H +#define LANGUAGE_ARRAY_H + +#include "versions.h" + +#if OOT_NTSC +#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { jpn, eng } +#else +#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { eng, ger, fra } +#endif + +#endif diff --git a/include/macros.h b/include/macros.h index d4fc7d9a92..7c964150e7 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,87 +1,10 @@ #ifndef MACROS_H #define MACROS_H -#include "versions.h" - -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 - -#ifndef AVOID_UB -#define BAD_RETURN(type) type -#else -#define BAD_RETURN(type) void -#endif - #define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) -#define ABS(x) ((x) >= 0 ? (x) : -(x)) -#define DECR(x) ((x) == 0 ? 0 : --(x)) -#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 SWAP(type, a, b) \ - { \ - type _temp = (a); \ - (a) = (b); \ - (b) = _temp; \ - } \ - (void)0 - -#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) - #define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask)) -#if PLATFORM_N64 || DEBUG_FEATURES -#define HUNGUP_AND_CRASH(file, line) Fault_AddHungupAndCrash(file, line) -#else -#define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line) -#endif - -#define MATRIX_FINALIZE_AND_LOAD(pkt, gfxCtx, file, line) \ - gSPMatrix(pkt, MATRIX_FINALIZE(gfxCtx, file, line), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW) - -#if OOT_NTSC -#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { jpn, eng } -#else -#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { eng, ger, fra } -#endif - -/** - * `x` vertex x - * `y` vertex y - * `z` vertex z - * `s` texture s coordinate - * `t` texture t coordinate - * `crnx` red component of color vertex, or x component of normal vertex - * `cgny` green component of color vertex, or y component of normal vertex - * `cbnz` blue component of color vertex, or z component of normal vertex - * `a` alpha - */ -#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } } - -#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } - -#define gDPSetTileCustom(pkt, fmt, siz, uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ -_DW({ \ - gDPPipeSync(pkt); \ - gDPTileSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \ - G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPTileSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, \ - (uls) << G_TEXTURE_IMAGE_FRAC, \ - (ult) << G_TEXTURE_IMAGE_FRAC, \ - (lrs) << G_TEXTURE_IMAGE_FRAC, \ - (lrt) << G_TEXTURE_IMAGE_FRAC); \ -}) - #endif diff --git a/include/sys_matrix.h b/include/sys_matrix.h index 11d494c8c8..2708af81ee 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -64,6 +64,9 @@ Mtx* Matrix_Finalize(struct GraphicsContext* gfxCtx); #endif +#define MATRIX_FINALIZE_AND_LOAD(pkt, gfxCtx, file, line) \ + gSPMatrix(pkt, MATRIX_FINALIZE(gfxCtx, file, line), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW) + /* Vector operations */ void Matrix_MultVec3f(Vec3f* src, Vec3f* dest); diff --git a/include/z64.h b/include/z64.h index 2560c745d5..8a259e70f3 100644 --- a/include/z64.h +++ b/include/z64.h @@ -4,6 +4,7 @@ // TODO: This file still exists ONLY to provide neccesary headers to extracted assets. // After assets are modified to include the headers they need directly, delete this file. +#include "gfx.h" #include "sequence.h" #include "sys_matrix.h" #include "ultra64.h" diff --git a/include/z64animation.h b/include/z64animation.h index 17b42e1a0f..9db7b260dc 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -1,6 +1,7 @@ #ifndef Z64_ANIMATION_H #define Z64_ANIMATION_H +#include "avoid_ub.h" #include "ultra64.h" #include "z64dma.h" #include "z64math.h" diff --git a/include/z64math.h b/include/z64math.h index 95a494a693..187d95b250 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -1,11 +1,8 @@ #ifndef Z64MATH_H #define Z64MATH_H -#include "ultra64.h" #include "math.h" - -#define SQ(x) ((x)*(x)) -#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z) +#include "ultra64.h" typedef union FloatInt { f32 f; @@ -95,6 +92,27 @@ typedef VecSphGeo VecSph; // Pitch is 0 along the xz-plane (horizon) typedef VecSphGeo VecGeo; +/** + * Macros + */ + +// General number macros +#define SQ(x) ((x)*(x)) +#define ABS(x) ((x) >= 0 ? (x) : -(x)) +#define DECR(x) ((x) == 0 ? 0 : --(x)) +#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 SWAP(type, a, b) \ + { \ + type _temp = (a); \ + (a) = (b); \ + (b) = _temp; \ + } \ + (void)0 + +// LERP macros #define LERP(x, y, scale) (((y) - (x)) * (scale) + (x)) #define LERP32(x, y, scale) ((s32)(((y) - (x)) * (scale)) + (x)) #define LERP16(x, y, scale) ((s16)(((y) - (x)) * (scale)) + (x)) @@ -110,6 +128,7 @@ typedef VecSphGeo VecGeo; (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ } +// Floating point macros #define IS_ZERO(f) (fabsf(f) < 0.008f) // Casting a float to an integer, when the float value is larger than what the integer type can hold, @@ -145,6 +164,7 @@ typedef VecSphGeo VecGeo; #define CAM_BINANG_TO_DEG(binang) ((f32)(binang) * (360.0001525f / 65535.0f)) // Vector macros +#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z) #define SQXZ(vec) ((vec).x * (vec).x + (vec).z * (vec).z) #define DOTXZ(vec1, vec2) ((vec1).x * (vec2).x + (vec1).z * (vec2).z) #define SQXYZ(vec) ((vec).x * (vec).x + (vec).y * (vec).y + (vec).z * (vec).z) diff --git a/include/z64scene.h b/include/z64scene.h index eacd62ed8a..7453f48bae 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -1,6 +1,7 @@ #ifndef Z64SCENE_H #define Z64SCENE_H +#include "avoid_ub.h" #include "macros.h" #include "ultra64.h" #include "z64bgcheck.h" diff --git a/include/z64view.h b/include/z64view.h index 3832eb5f6f..b007129f97 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -1,6 +1,7 @@ #ifndef Z64VIEW_H #define Z64VIEW_H +#include "avoid_ub.h" #include "macros.h" #include "ultra64.h" #include "z64math.h" diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 815570a966..9965a6ec06 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -41,13 +41,14 @@ * DPad-Down disables sending fault pages over osSyncPrintf. */ -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \ - "gc-us-mq:192 ique-cn:192" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160" \ + "gc-us-mq:160 ique-cn:160" #include "libc64/sleep.h" #include "libc64/sprintf.h" #include "alloca.h" #include "controller.h" +#include "gfx.h" #include "padmgr.h" #include "fault.h" #include "stack.h" diff --git a/src/code/fault_gc_drawer.c b/src/code/fault_gc_drawer.c index ab95a433a6..a0e409df7f 100644 --- a/src/code/fault_gc_drawer.c +++ b/src/code/fault_gc_drawer.c @@ -6,6 +6,8 @@ */ #include "fault.h" + +#include "gfx.h" #include "terminal.h" #include "global.h" diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index d83814b9b6..c6c5796762 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -3,6 +3,7 @@ #include "libc64/sprintf.h" #include "controller.h" #include "fault.h" +#include "gfx.h" #include "padmgr.h" #include "segmented_address.h" #include "stack.h" @@ -13,7 +14,7 @@ #include "global.h" -#pragma increment_block_number "ntsc-1.0:176 ntsc-1.1:176 ntsc-1.2:176 pal-1.0:176 pal-1.1:176" +#pragma increment_block_number "ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" typedef struct FaultMgr { OSThread thread; diff --git a/src/code/main.c b/src/code/main.c index 43556b52b7..6a5dae80e2 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -45,7 +45,7 @@ extern struct IrqMgr gIrqMgr; #include "global.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:0 ntsc-1.0:35 ntsc-1.1:35 ntsc-1.2:35 pal-1.0:33 pal-1.1:33" + "ique-cn:0 ntsc-1.0:34 ntsc-1.1:34 ntsc-1.2:34 pal-1.0:32 pal-1.1:32" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 2e075daf35..8877c92ce6 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -2,6 +2,7 @@ #include "libu64/debug.h" #include "attributes.h" +#include "gfx.h" #include "line_numbers.h" #include "printf.h" #include "translation.h" diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3bd468d490..3880931164 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -5,6 +5,7 @@ #include "attributes.h" #include "controller.h" #include "db_camera.h" +#include "gfx.h" #include "letterbox.h" #include "one_point_cutscene.h" #include "quake.h" @@ -3660,7 +3661,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:128 ntsc-1.0:86 ntsc-1.1:86 ntsc-1.2:86 pal-1.0:86 pal-1.1:86" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 2ba1864fe8..699526ce79 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,5 +1,6 @@ #include "transition_circle.h" +#include "color.h" #include "gfx.h" #include "sfx.h" diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 575cb282e0..29a5404ed6 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -1,11 +1,12 @@ -#include "global.h" -#include "ultra64.h" -#include "attributes.h" #include "jpeg.h" + +#include "attributes.h" +#include "gfx.h" #include "printf.h" #include "sys_ucode.h" #include "terminal.h" #include "translation.h" +#include "ultra64.h" #include "macros.h" diff --git a/src/code/z_lights.c b/src/code/z_lights.c index e9f5338503..d0b003f77c 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -1,3 +1,4 @@ +#include "avoid_ub.h" #include "buffers.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index ab333a8754..d4de077ed9 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -4,6 +4,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "gfxalloc.h" +#include "language_array.h" #include "memory_utils.h" #include "message_data_static.h" #if PLATFORM_N64 diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 5d0166b494..9446123484 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3,6 +3,7 @@ #include "flag_set.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "language_array.h" #include "main.h" #include "map.h" #include "printf.h" diff --git a/src/code/z_play.c b/src/code/z_play.c index 0ca29c698a..60a20e0ed8 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -2,6 +2,7 @@ #include "libc64/qrand.h" #include "libu64/debug.h" #include "buffers.h" +#include "color.h" #include "controller.h" #include "fault.h" #include "file_select_state.h" diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 2d54147930..da2ddf6486 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,3 +1,4 @@ +#include "avoid_ub.h" #include "printf.h" #include "regs.h" #include "romfile.h" diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index c48983550c..9e79abcbfe 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,4 +1,5 @@ #include "libu64/debug.h" +#include "avoid_ub.h" #include "gfx.h" #include "printf.h" #include "regs.h" diff --git a/src/code/z_view.c b/src/code/z_view.c index 9c6be44abd..6fe82aaeb3 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -2,6 +2,7 @@ #include "libc64/malloc.h" #include "libu64/debug.h" +#include "avoid_ub.h" #include "gfx.h" #include "letterbox.h" #include "main.h" diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index e28e9c4ae2..877a789c6b 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -3,6 +3,7 @@ #include "libu64/debug.h" #include "ultra64/viint.h" #include "controller.h" +#include "gfx.h" #include "main.h" #include "printf.h" #include "regs.h" diff --git a/src/n64dd/z_n64dd.c b/src/n64dd/z_n64dd.c index 9d6e54ea72..f05e1b1358 100644 --- a/src/n64dd/z_n64dd.c +++ b/src/n64dd/z_n64dd.c @@ -2,6 +2,7 @@ // threads and provides functions to submit commands to them. #include "libc64/sleep.h" #include "fault.h" +#include "gfx.h" #include "irqmgr.h" #include "line_numbers.h" #include "n64dd.h" @@ -12,7 +13,7 @@ #include "z64audio.h" #include "z64thread.h" -#pragma increment_block_number "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" +#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" typedef struct struct_801D9C30 { /* 0x000 */ s32 unk_000; // disk start diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 2873f70fb5..35c2d35ca7 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -6,6 +6,7 @@ #include "z_en_mag.h" +#include "avoid_ub.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index cc92a6b501..673855f560 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -18,6 +18,7 @@ #include "libc64/qrand.h" #include "libu64/debug.h" +#include "avoid_ub.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 95ea7c7b22..63b1e2401f 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -5,6 +5,7 @@ #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "language_array.h" #include "letterbox.h" #include "macros.h" #include "main.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index cbc5810fd4..c5eedab9cd 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -4,6 +4,7 @@ #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "language_array.h" #include "printf.h" #include "regs.h" #include "rumble.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c index ac366ffd48..d6a8af68f5 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -2,6 +2,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "language_array.h" #include "map.h" #include "printf.h" #include "regs.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index d9d558f0c4..34c3b46a4d 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -4,6 +4,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "gfxalloc.h" +#include "language_array.h" #include "map.h" #if PLATFORM_N64 #include "n64dd.h" From bed76a3bf3cd89456e3331b2c2b50dbc5f79fe48 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 26 Apr 2025 18:17:02 -0400 Subject: [PATCH 4/8] add array_count.h (#2514) --- include/array_count.h | 8 ++++++++ include/macros.h | 4 ---- include/z64.h | 1 + src/audio/data.c | 4 ++-- src/audio/general.c | 3 ++- src/audio/lib/load.c | 1 + src/audio/lib/seqplayer.c | 1 + src/audio/lib/thread.c | 1 + src/audio/sequence.c | 7 +++---- src/audio/session_init.c | 1 + src/audio/sfx.c | 1 + src/boot/idle.c | 1 + src/boot/z_std_dma.c | 1 + src/code/audio_stop_all_sfx.c | 3 ++- src/code/audio_thread_manager.c | 1 + src/code/db_camera.c | 1 + src/code/fault_gc.c | 1 + src/code/fault_gc_drawer.c | 1 + src/code/fault_n64.c | 1 + src/code/game.c | 1 + src/code/graph.c | 2 +- src/code/irqmgr.c | 1 + src/code/main.c | 1 + src/code/object_table.c | 1 + src/code/padmgr.c | 4 +++- src/code/sched.c | 1 + src/code/speed_meter.c | 1 + src/code/sys_math_atan.c | 2 ++ src/code/ucode_disas.c | 7 ++++--- src/code/z_actor.c | 1 + src/code/z_bgcheck.c | 1 + src/code/z_camera.c | 4 ++-- src/code/z_camera_data.inc.c | 2 ++ src/code/z_collision_btltbls.c | 1 + src/code/z_debug.c | 1 + src/code/z_demo.c | 5 ++++- src/code/z_eff_shield_particle.c | 1 + src/code/z_eff_spark.c | 1 + src/code/z_effect_soft_sprite.c | 1 + src/code/z_effect_soft_sprite_old_init.c | 1 + src/code/z_env_flags.c | 1 + src/code/z_game_over.c | 1 + src/code/z_horse.c | 1 + src/code/z_jpeg.c | 2 ++ src/code/z_kaleido_manager.c | 1 + src/code/z_kankyo.c | 1 + src/code/z_message.c | 1 + src/code/z_onepointdemo.c | 4 +++- src/code/z_parameter.c | 1 + src/code/z_play.c | 1 + src/code/z_quake.c | 1 + src/code/z_room.c | 1 + src/code/z_scene.c | 1 + src/code/z_sfx_source.c | 1 + src/code/z_skin_awb.c | 4 +++- src/code/z_sram.c | 1 + src/code/z_vr_box.c | 1 + src/libleo/leo/leofunc.c | 4 +++- src/libleo/leo/leoutil.c | 3 ++- src/libultra/io/contpfs.c | 2 ++ src/libultra/io/contreaddata.c | 2 ++ src/libultra/io/controller.c | 2 ++ src/libultra/io/piacs.c | 2 ++ src/libultra/io/siacs.c | 2 ++ src/libultra/io/vimgr.c | 6 ++++-- src/n64dd/n64dd_801C8000.c | 3 +++ src/n64dd/n64dd_801CA0B0.c | 2 ++ src/n64dd/z_n64dd.c | 5 ++++- src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 1 + .../actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c | 1 + src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 1 + .../actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 1 + .../actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c | 1 + .../actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c | 1 + src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c | 1 + .../actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 1 + src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 1 + .../actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c | 1 + src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c | 1 + .../actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c | 1 + .../actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c | 1 + .../ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c | 1 + src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 1 + .../actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c | 1 + .../actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 1 + .../ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c | 1 + .../actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 1 + src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 1 + src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 1 + src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 1 + src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c | 1 + src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 1 + src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c | 1 + src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c | 1 + src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 1 + src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 1 + src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 1 + src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 1 + src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 1 + src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c | 1 + src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c | 1 + src/overlays/actors/ovl_En_Anubice/z_en_anubice.c | 1 + src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c | 1 + src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 1 + src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c | 1 + src/overlays/actors/ovl_En_Door/z_en_door.c | 1 + src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c | 1 + src/overlays/actors/ovl_En_Fr/z_en_fr.c | 1 + src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c | 1 + src/overlays/actors/ovl_En_Gb/z_en_gb.c | 1 + src/overlays/actors/ovl_En_Go2/z_en_go2.c | 1 + src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c | 1 + src/overlays/actors/ovl_En_Horse/z_en_horse.c | 1 + .../ovl_En_Horse_Link_Child/z_en_horse_link_child.c | 1 + .../actors/ovl_En_Horse_Normal/z_en_horse_normal.c | 1 + src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c | 1 + src/overlays/actors/ovl_En_Ik/z_en_ik.c | 1 + src/overlays/actors/ovl_En_In/z_en_in.c | 1 + src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 1 + src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c | 1 + src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c | 1 + src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c | 1 + src/overlays/actors/ovl_En_Kanban/z_en_kanban.c | 1 + src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 1 + src/overlays/actors/ovl_En_Mag/z_en_mag.c | 1 + src/overlays/actors/ovl_En_Nb/z_en_nb.c | 1 + src/overlays/actors/ovl_En_Niw/z_en_niw.c | 1 + src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c | 1 + src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 1 + src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 1 + src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 1 + src/overlays/actors/ovl_En_St/z_en_st.c | 1 + src/overlays/actors/ovl_En_Ta/z_en_ta.c | 1 + src/overlays/actors/ovl_En_Tk/z_en_tk.c | 1 + src/overlays/actors/ovl_En_Viewer/z_en_viewer.c | 1 + src/overlays/actors/ovl_En_Wf/z_en_wf.c | 1 + src/overlays/actors/ovl_En_Xc/z_en_xc.c | 1 + src/overlays/actors/ovl_En_Zf/z_en_zf.c | 1 + src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 1 + src/overlays/actors/ovl_En_Zo/z_en_zo.c | 1 + src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c | 1 + src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c | 1 + src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c | 1 + src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c | 1 + src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 1 + src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 1 + src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c | 1 + src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c | 1 + src/overlays/actors/ovl_player_actor/z_player.c | 1 + src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c | 1 + src/overlays/gamestates/ovl_file_choose/z_file_nameset.c | 1 + src/overlays/gamestates/ovl_select/z_select.c | 3 ++- src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c | 1 + src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c | 2 ++ 154 files changed, 200 insertions(+), 28 deletions(-) create mode 100644 include/array_count.h diff --git a/include/array_count.h b/include/array_count.h new file mode 100644 index 0000000000..9e5f6ed4ca --- /dev/null +++ b/include/array_count.h @@ -0,0 +1,8 @@ +#ifndef ARRAY_COUNT_H +#define ARRAY_COUNT_H + +#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) +#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) +#define ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) + +#endif diff --git a/include/macros.h b/include/macros.h index 7c964150e7..98efe590c5 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,10 +1,6 @@ #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 ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) - #define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask)) #endif diff --git a/include/z64.h b/include/z64.h index 8a259e70f3..bb2518e6ec 100644 --- a/include/z64.h +++ b/include/z64.h @@ -4,6 +4,7 @@ // TODO: This file still exists ONLY to provide neccesary headers to extracted assets. // After assets are modified to include the headers they need directly, delete this file. +#include "array_count.h" #include "gfx.h" #include "sequence.h" #include "sys_matrix.h" diff --git a/src/audio/data.c b/src/audio/data.c index bd072257b2..6c5528f347 100644 --- a/src/audio/data.c +++ b/src/audio/data.c @@ -1,7 +1,7 @@ +#include "array_count.h" +#include "sfx.h" #include "ultra64.h" #include "z64audio.h" -#include "macros.h" -#include "sfx.h" // sSfxRequests ring buffer endpoints. read index <= write index, wrapping around mod 256. u8 gSfxRequestWriteIndex = 0; diff --git a/src/audio/general.c b/src/audio/general.c index c3286554e0..abdbcade0d 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -1,5 +1,5 @@ #include "libu64/gfxprint.h" -#include "ultra64.h" +#include "array_count.h" #include "attributes.h" #include "audiothread_cmd.h" #include "controller.h" @@ -8,6 +8,7 @@ #include "seqcmd.h" #include "sequence.h" #include "sfx.h" +#include "ultra64.h" #include "versions.h" #include "z64audio.h" #include "z64ocarina.h" diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 4a447ddc0f..f05850c69e 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "attributes.h" #include "buffers.h" #include "segment_symbols.h" diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c index e238418a69..c906e6728f 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -14,6 +14,7 @@ * Otherwise, each set of instructions has its own command interpreter */ #include "audio/aseq.h" +#include "array_count.h" #include "assert.h" #include "attributes.h" #include "macros.h" diff --git a/src/audio/lib/thread.c b/src/audio/lib/thread.c index b79c1d97dc..43cb6d498b 100644 --- a/src/audio/lib/thread.c +++ b/src/audio/lib/thread.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "audiothread_cmd.h" #include "macros.h" #include "ultra64.h" diff --git a/src/audio/sequence.c b/src/audio/sequence.c index f3b815a284..a311e4e73d 100644 --- a/src/audio/sequence.c +++ b/src/audio/sequence.c @@ -17,15 +17,14 @@ * Nor are these commands to be confused with the internal audio commands used to transfer requests from * the graph thread to the audio thread. */ +#include "array_count.h" #include "audiothread_cmd.h" -#include "ultra64.h" -#include "ultra64/abi.h" #include "seqcmd.h" #include "sfx.h" +#include "ultra64.h" +#include "ultra64/abi.h" #include "z64audio.h" -#include "macros.h" - // Direct audio command (skips the queueing system) #define SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, duration, volume) \ Audio_ProcessSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | \ diff --git a/src/audio/session_init.c b/src/audio/session_init.c index d04a955bca..e7248907e9 100644 --- a/src/audio/session_init.c +++ b/src/audio/session_init.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "buffers.h" #include "z64audio.h" diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 3d837676df..9c6d7c6eb6 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "audiothread_cmd.h" #include "macros.h" #include "printf.h" diff --git a/src/boot/idle.c b/src/boot/idle.c index 6a4de30df5..2acfe2ddbf 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "buffers.h" #include "build.h" #include "idle.h" diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 0dc1d9c3b1..ac91d0d828 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -21,6 +21,7 @@ #include "libc64/sleep.h" #include "libc64/sprintf.h" #include "libu64/debug.h" +#include "array_count.h" #include "attributes.h" #include "carthandle.h" #include "fault.h" diff --git a/src/code/audio_stop_all_sfx.c b/src/code/audio_stop_all_sfx.c index 5ae65705c6..2702f8a579 100644 --- a/src/code/audio_stop_all_sfx.c +++ b/src/code/audio_stop_all_sfx.c @@ -1,6 +1,7 @@ +#include "array_count.h" #include "sfx.h" - #include "ultra64.h" + #include "macros.h" u8 sSfxBankIds[] = { diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index 5c7ff901e3..5e0cbfc28a 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -5,6 +5,7 @@ * and sending the audio rsp tasks generated by the driver to the task scheduler. */ +#include "array_count.h" #include "audiomgr.h" #include "printf.h" #include "regs.h" diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 7276008491..a275cae523 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,4 +1,5 @@ #include "libu64/gfxprint.h" +#include "array_count.h" #include "attributes.h" #include "controller.h" #include "db_camera.h" diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 9965a6ec06..75104362d5 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -47,6 +47,7 @@ #include "libc64/sleep.h" #include "libc64/sprintf.h" #include "alloca.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "padmgr.h" diff --git a/src/code/fault_gc_drawer.c b/src/code/fault_gc_drawer.c index a0e409df7f..044b9561bc 100644 --- a/src/code/fault_gc_drawer.c +++ b/src/code/fault_gc_drawer.c @@ -5,6 +5,7 @@ * the crash screen implemented by fault.c */ +#include "array_count.h" #include "fault.h" #include "gfx.h" diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index c6c5796762..5e071d87b6 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -1,6 +1,7 @@ #include "libc64/os_malloc.h" #include "libc64/sleep.h" #include "libc64/sprintf.h" +#include "array_count.h" #include "controller.h" #include "fault.h" #include "gfx.h" diff --git a/src/code/game.c b/src/code/game.c index e3ffb53819..536013aa97 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -2,6 +2,7 @@ #include "libc64/os_malloc.h" #include "libu64/debug.h" #include "libu64/gfxprint.h" +#include "array_count.h" #include "audiomgr.h" #include "buffers.h" #include "controller.h" diff --git a/src/code/graph.c b/src/code/graph.c index 62453359a4..8fbb1b02fc 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,7 +1,7 @@ #include "libc64/malloc.h" #include "libc64/sprintf.h" #include "libu64/debug.h" - +#include "array_count.h" #include "buffers.h" #include "console_logo_state.h" #include "controller.h" diff --git a/src/code/irqmgr.c b/src/code/irqmgr.c index 2915e1c832..fe6b3a12fd 100644 --- a/src/code/irqmgr.c +++ b/src/code/irqmgr.c @@ -33,6 +33,7 @@ * @see sched.c */ #include "libu64/debug.h" +#include "array_count.h" #include "irqmgr.h" #include "printf.h" #include "stackcheck.h" diff --git a/src/code/main.c b/src/code/main.c index 6a5dae80e2..584e098e6e 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -19,6 +19,7 @@ extern struct IrqMgr gIrqMgr; #include "libc64/malloc.h" #include "libu64/rcp_utils.h" #include "libu64/runtime.h" +#include "array_count.h" #include "audiomgr.h" #include "debug_arena.h" #include "fault.h" diff --git a/src/code/object_table.c b/src/code/object_table.c index 904683596b..0de131824a 100644 --- a/src/code/object_table.c +++ b/src/code/object_table.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "segment_symbols.h" #include "romfile.h" #include "ultra64.h" diff --git a/src/code/padmgr.c b/src/code/padmgr.c index 6d88b34c13..ddea9b2549 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -30,7 +30,7 @@ */ #include "libu64/debug.h" #include "libu64/padsetup.h" -#include "macros.h" +#include "array_count.h" #include "padmgr.h" #include "printf.h" #include "fault.h" @@ -38,6 +38,8 @@ #include "translation.h" #include "line_numbers.h" +#include "macros.h" + #define PADMGR_LOG(controllerNum, msg) \ if (DEBUG_FEATURES) { \ PRINTF_COLOR_YELLOW(); \ diff --git a/src/code/sched.c b/src/code/sched.c index d8fea59fa4..b009dff357 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -41,6 +41,7 @@ */ #include "libu64/debug.h" #include "libu64/rcp_utils.h" +#include "array_count.h" #include "fault.h" #include "irqmgr.h" #include "main.h" diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index bf8a247ac3..bb3624fa86 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -2,6 +2,7 @@ "pal-1.0:0 pal-1.1:0" #include "libc64/malloc.h" #include "libu64/debug.h" +#include "array_count.h" #include "gfx.h" #include "printf.h" #include "regs.h" diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c index 8dabed7d72..e2b70a3612 100644 --- a/src/code/sys_math_atan.c +++ b/src/code/sys_math_atan.c @@ -1,5 +1,7 @@ +#include "array_count.h" #include "sys_math.h" #include "z64math.h" + #include "macros.h" static u16 sAtan2Tbl[] = { diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index eadb32188a..7626ed6201 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -1,10 +1,11 @@ -#include "ucode_disas.h" -#include "ultra64.h" -#include "ultra64/gs2dex.h" #include "libu64/mtxuty-cvt.h" +#include "ultra64/gs2dex.h" +#include "array_count.h" #include "printf.h" #include "segmented_address.h" #include "translation.h" +#include "ucode_disas.h" +#include "ultra64.h" #include "macros.h" diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 7ea5bb355f..8ea0eb113f 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1,5 +1,6 @@ #include "libc64/math64.h" #include "libu64/overlay.h" +#include "array_count.h" #include "fault.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 51d7e8ad16..945051552a 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,4 +1,5 @@ #include "libu64/debug.h" +#include "array_count.h" #include "attributes.h" #include "line_numbers.h" #include "printf.h" diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3880931164..cf18c3634a 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,7 +1,6 @@ #include "libc64/math64.h" #include "libc64/qrand.h" -#include "ultra64.h" - +#include "array_count.h" #include "attributes.h" #include "controller.h" #include "db_camera.h" @@ -15,6 +14,7 @@ #include "sys_math3d.h" #include "terminal.h" #include "translation.h" +#include "ultra64.h" #include "z_lib.h" #include "zelda_arena.h" #include "z64audio.h" diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 07a527afe8..18b071b1d6 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" + #include "global.h" typedef struct CameraModeValue { diff --git a/src/code/z_collision_btltbls.c b/src/code/z_collision_btltbls.c index 34e25b2ff3..a49a71d056 100644 --- a/src/code/z_collision_btltbls.c +++ b/src/code/z_collision_btltbls.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "printf.h" #include "translation.h" #include "z64collision_check.h" diff --git a/src/code/z_debug.c b/src/code/z_debug.c index a43c76cfb6..65f8eb60ad 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,6 +1,7 @@ #include "libc64/malloc.h" #include "libu64/gfxprint.h" #include "libu64/pad.h" +#include "array_count.h" #include "color.h" #include "controller.h" #include "gfx.h" diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 68f2fbc2f7..f45fd1933f 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,7 +1,8 @@ #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ique-cn:128 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" -#include "global.h" + #include "libu64/gfxprint.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "gfxalloc.h" @@ -29,6 +30,8 @@ #include "z64player.h" #include "z64save.h" +#include "global.h" + #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/overworld/ganon_tou/ganon_tou_scene.h" diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index 3516767916..bc71d8c4fd 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -1,4 +1,5 @@ #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index 4296359560..dc3ebf9d16 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -1,4 +1,5 @@ #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 696a185045..061b6d70da 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -1,4 +1,5 @@ #include "libu64/overlay.h" +#include "array_count.h" #include "printf.h" #include "sfx.h" #include "terminal.h" diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 967640f280..1654ab3d0d 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -1,4 +1,5 @@ #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "rand.h" diff --git a/src/code/z_env_flags.c b/src/code/z_env_flags.c index 9ad7e7a024..164ff1dde4 100644 --- a/src/code/z_env_flags.c +++ b/src/code/z_env_flags.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "ultra64.h" #include "z64cutscene_flags.h" #include "z64play.h" diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 20814a4c74..e05bcff26d 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "letterbox.h" #include "regs.h" #include "rumble.h" diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 9d185d1e3b..d61af32e7e 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "terminal.h" #include "z_lib.h" #include "printf.h" diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 29a5404ed6..86c896e629 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -1,5 +1,6 @@ #include "jpeg.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "printf.h" @@ -8,6 +9,7 @@ #include "translation.h" #include "ultra64.h" +#include "global.h" #include "macros.h" #define MARKER_ESCAPE 0x00 diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 87a7c0fa12..efecef6468 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,5 +1,6 @@ #include "libu64/debug.h" #include "libu64/overlay.h" +#include "array_count.h" #include "kaleido_manager.h" #include "printf.h" #include "segment_symbols.h" diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index d87f908be3..88dcd5e59b 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -3,6 +3,7 @@ #include "libc64/qrand.h" #include "libu64/gfxprint.h" +#include "array_count.h" #include "buffers.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index d4de077ed9..38153dff02 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1,4 +1,5 @@ #include "libu64/gfxprint.h" +#include "array_count.h" #include "attributes.h" #include "controller.h" #include "gfx.h" diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 700353cb8e..94c3bc9e11 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -1,6 +1,8 @@ +#include "one_point_cutscene.h" + #include "libc64/math64.h" #include "libc64/qrand.h" -#include "one_point_cutscene.h" +#include "array_count.h" #include "printf.h" #include "quake.h" #include "sfx.h" diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 9446123484..0785675102 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "attributes.h" #include "controller.h" #include "flag_set.h" diff --git a/src/code/z_play.c b/src/code/z_play.c index 60a20e0ed8..31dbc765ca 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,6 +1,7 @@ #include "libc64/malloc.h" #include "libc64/qrand.h" #include "libu64/debug.h" +#include "array_count.h" #include "buffers.h" #include "color.h" #include "controller.h" diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 690dbc81d6..cacb5a213f 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,4 +1,5 @@ #include "libc64/qrand.h" +#include "array_count.h" #include "macros.h" #include "printf.h" #include "quake.h" diff --git a/src/code/z_room.c b/src/code/z_room.c index a8e9c5b23e..7bc9e4801d 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,5 +1,6 @@ #include "libu64/debug.h" #include "ultra64/gs2dex.h" +#include "array_count.h" #include "buffers.h" #include "fault.h" #include "gfx.h" diff --git a/src/code/z_scene.c b/src/code/z_scene.c index da2ddf6486..feef5ffc62 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "avoid_ub.h" #include "printf.h" #include "regs.h" diff --git a/src/code/z_sfx_source.c b/src/code/z_sfx_source.c index 3d793c6174..9dda34ce3d 100644 --- a/src/code/z_sfx_source.c +++ b/src/code/z_sfx_source.c @@ -1,5 +1,6 @@ #include "z64sfx_source.h" +#include "array_count.h" #include "sfx.h" #include "z64play.h" #include "z64skin_matrix.h" diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 8a175ed15f..196ce9aae4 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -1,4 +1,4 @@ -#include "overlays/actors/ovl_En_fHG/z_en_fhg.h" +#include "array_count.h" #include "segmented_address.h" #include "zelda_arena.h" #include "z64actor.h" @@ -6,6 +6,8 @@ #include "z64skin.h" #include "z64skin_matrix.h" +#include "overlays/actors/ovl_En_fHG/z_en_fhg.h" + /** * Initialises the Vtx buffers used for limb at index `limbIndex` */ diff --git a/src/code/z_sram.c b/src/code/z_sram.c index d253627047..456e7a8227 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -1,5 +1,6 @@ #include "z64sram.h" +#include "array_count.h" #include "file_select_state.h" #include "controller.h" #include "memory_utils.h" diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index ab39d3ca63..f0ef9b0082 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -1,5 +1,6 @@ #include "z64skybox.h" +#include "array_count.h" #include "printf.h" #include "segment_symbols.h" #include "terminal.h" diff --git a/src/libleo/leo/leofunc.c b/src/libleo/leo/leofunc.c index d6f7dddcca..8aaf794fdb 100644 --- a/src/libleo/leo/leofunc.c +++ b/src/libleo/leo/leofunc.c @@ -1,7 +1,9 @@ -#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "array_count.h" +#include "ultra64.h" + #include "macros.h" static s32 __leoResetCalled = false; diff --git a/src/libleo/leo/leoutil.c b/src/libleo/leo/leoutil.c index 0a52e820e0..44240b0556 100644 --- a/src/libleo/leo/leoutil.c +++ b/src/libleo/leo/leoutil.c @@ -1,7 +1,8 @@ -#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "array_count.h" +#include "ultra64.h" #include "macros.h" diff --git a/src/libultra/io/contpfs.c b/src/libultra/io/contpfs.c index d92bc3eaec..c99c316825 100644 --- a/src/libultra/io/contpfs.c +++ b/src/libultra/io/contpfs.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" + #include "macros.h" s32 __osPfsInodeCacheChannel = -1; diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index a0b2898121..56ebf0a09a 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" + #include "macros.h" s32 osContStartReadData(OSMesgQueue* mq) { diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index 1ea5ecacd2..97a33dc00f 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" + #include "macros.h" OSPifRam __osContPifRam; diff --git a/src/libultra/io/piacs.c b/src/libultra/io/piacs.c index 23fe343147..3b9af6d40a 100644 --- a/src/libultra/io/piacs.c +++ b/src/libultra/io/piacs.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" + #include "macros.h" u32 __osPiAccessQueueEnabled = false; diff --git a/src/libultra/io/siacs.c b/src/libultra/io/siacs.c index dd54180837..480efd31ac 100644 --- a/src/libultra/io/siacs.c +++ b/src/libultra/io/siacs.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" + #include "macros.h" static OSMesg siAccessBuf[1]; diff --git a/src/libultra/io/vimgr.c b/src/libultra/io/vimgr.c index b8eb522e92..1caf997d47 100644 --- a/src/libultra/io/vimgr.c +++ b/src/libultra/io/vimgr.c @@ -1,6 +1,8 @@ -#include "ultra64.h" -#include "stack.h" #include "ultra64/internal.h" +#include "array_count.h" +#include "stack.h" +#include "ultra64.h" + #include "macros.h" static OSThread viThread; diff --git a/src/n64dd/n64dd_801C8000.c b/src/n64dd/n64dd_801C8000.c index 8c6c91a9ce..2212fe43fb 100644 --- a/src/n64dd/n64dd_801C8000.c +++ b/src/n64dd/n64dd_801C8000.c @@ -1,5 +1,8 @@ // Does some command processing + #include "n64dd.h" + +#include "array_count.h" #include "versions.h" #include "z_locale.h" diff --git a/src/n64dd/n64dd_801CA0B0.c b/src/n64dd/n64dd_801CA0B0.c index d564d46caa..a986346220 100644 --- a/src/n64dd/n64dd_801CA0B0.c +++ b/src/n64dd/n64dd_801CA0B0.c @@ -1,6 +1,8 @@ #include "n64dd.h" + #include "libc64/aprintf.h" #include "attributes.h" +#include "array_count.h" #include "global.h" diff --git a/src/n64dd/z_n64dd.c b/src/n64dd/z_n64dd.c index f05e1b1358..a8ce0674c7 100644 --- a/src/n64dd/z_n64dd.c +++ b/src/n64dd/z_n64dd.c @@ -1,11 +1,14 @@ // Main interface for the 64DD from the rest of the game. Starts background // threads and provides functions to submit commands to them. + +#include "n64dd.h" + #include "libc64/sleep.h" +#include "array_count.h" #include "fault.h" #include "gfx.h" #include "irqmgr.h" #include "line_numbers.h" -#include "n64dd.h" #include "stack.h" #include "stackcheck.h" #include "sys_freeze.h" diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 15adb7bf94..6ef8c9250c 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -7,6 +7,7 @@ #include "z_bg_dodoago.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index eebb7536c0..1df0e5b730 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -7,6 +7,7 @@ #include "z_bg_ganon_otyuka.h" #include "overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index ac28324e5d..90aeee4b87 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -7,6 +7,7 @@ #include "z_bg_heavy_block.h" #include "libu64/debug.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 62120c933f..d20bccdb71 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_hamstep.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 715ecc5fba..0b64a4ff6b 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_rsekizou.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 1c86d7d851..452c88f5f4 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_sekizou.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 20b3717087..f166f9f4d8 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_sima.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index f19f5f9baf..b9350da300 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -8,6 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "ichain.h" #include "sfx.h" #include "z_lib.h" diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 4e9d88d7ce..a72f245e22 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -8,6 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index e4620934a6..e9cfd701a2 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -6,6 +6,7 @@ #include "z_bg_jya_zurerukabe.h" +#include "array_count.h" #include "ichain.h" #include "printf.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index d4b512c76f..7dc55fbe02 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index 8708b601a7..6bd947c3a0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -6,6 +6,7 @@ #include "z_bg_mori_hashigo.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 56af066d9d..dccddcf49a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -6,6 +6,7 @@ #include "z_bg_mori_rakkatenjo.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index b54226cec8..aa8d28b960 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -8,6 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "ichain.h" #include "sfx.h" #include "z_lib.h" diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 60686aaa1c..57b76c4147 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -6,6 +6,7 @@ #include "z_bg_spot09_obj.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index 1af76df476..574c2533d0 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index a1404fdd26..eb89d5f06a 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -6,6 +6,7 @@ #include "z_bg_spot15_rrbox.h" +#include "array_count.h" #include "ichain.h" #include "printf.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 2136318470..759d2184e3 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -3,6 +3,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 1e88e7c4e8..66d8e2d509 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -1,6 +1,7 @@ #include "z_bg_spot18_basket.h" #include "libc64/qrand.h" +#include "array_count.h" #include "ichain.h" #include "one_point_cutscene.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 94ef74bb73..d44a14de50 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -7,6 +7,7 @@ #include "z_bg_spot18_obj.h" +#include "array_count.h" #include "ichain.h" #include "printf.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index a38078e490..c66883ddd8 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -12,6 +12,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 703eec89cc..856f9e34ea 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 50d3ab595c..0ca8e3c843 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -6,6 +6,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 53bfa09e56..e2742e3bef 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -4,6 +4,7 @@ #include "overlays/actors/ovl_En_Zl3/z_en_zl3.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 86466f1cd4..848707f002 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -13,6 +13,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 55934e67b8..bfd115b535 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -11,6 +11,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 2a9995ddc4..1113a3926a 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -9,6 +9,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "controller.h" #include "gfx.h" diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 48a203c4d6..e2d6eeb3a8 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -3,6 +3,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "controller.h" #include "gfx.h" diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 920846e743..aec25c7cf2 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Boom/z_en_boom.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 0d4692d9ba..7528a2a6a2 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -6,6 +6,7 @@ #include "z_demo_ec.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 237ba6883a..6bc60ac276 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index 257657520c..af3ddeb000 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -1,5 +1,6 @@ #include "z_demo_ik.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index e2f3609668..05eec20ffa 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -7,6 +7,7 @@ #include "z_door_shutter.h" #include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index b624e0edd9..5c03ab9632 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -9,6 +9,7 @@ #include "overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index a321a43a0e..4243bbdf79 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -1,5 +1,6 @@ #include "z_en_bigokuta.h" +#include "array_count.h" #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 3af6e87eca..7ce476d4ef 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index ab7b8e4285..df9b566f87 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1,6 +1,7 @@ #include "z_en_dekubaba.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index b3f71481d9..9f5bd8723e 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -7,6 +7,7 @@ #include "z_en_door.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 815d8c654d..b124094a2c 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -1,5 +1,6 @@ #include "z_en_fd_fire.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "rand.h" diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 64d5c4f52b..15ce257340 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -1,5 +1,6 @@ #include "z_en_fr.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index ca06391dcf..d40a9a446d 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -6,6 +6,7 @@ #include "z_en_ganon_mant.h" +#include "array_count.h" #include "gfx.h" #include "rand.h" #include "segmented_address.h" diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 0bc9d51d95..9565ceba98 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -7,6 +7,7 @@ #include "z_en_gb.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 9c15e9e7a3..61c3d5f6e1 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 98185e4b03..0736896895 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -7,6 +7,7 @@ #include "z_en_heishi1.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 08f58dbce2..dded516560 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -9,6 +9,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 7a3307bc05..1610147130 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -6,6 +6,7 @@ #include "z_en_horse_link_child.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 1ddc46944b..300711ff37 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 059f88c3ae..fb59c5b84a 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -7,6 +7,7 @@ #include "z_en_horse_zelda.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index e180d52573..9b49e35f78 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -7,6 +7,7 @@ #include "z_en_ik.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index c97c842213..521b8dcbfa 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "letterbox.h" diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 191c2142d7..bcf59dfbe7 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -9,6 +9,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 2d0ed48af9..13ebc48f3e 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -7,6 +7,7 @@ #include "z_en_jsjutan.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "segmented_address.h" diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index d0cd245391..d2d807cd28 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -6,6 +6,7 @@ #include "z_en_kakasi.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index dd1e33696a..8f4d21e36d 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -6,6 +6,7 @@ #include "z_en_kakasi3.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 2afea4fcb3..844a7ee2a8 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index f0d8d67486..aa955365dd 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -9,6 +9,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "ichain.h" #include "printf.h" #include "rand.h" diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 35c2d35ca7..5c1e68f77d 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -6,6 +6,7 @@ #include "z_en_mag.h" +#include "array_count.h" #include "avoid_ub.h" #include "controller.h" #include "gfx.h" diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index d44f76c23a..e0d2edddf3 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 0480b266a1..6be5e39db0 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -9,6 +9,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 0f24ad4d0d..ba165bd3ad 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -6,6 +6,7 @@ #include "z_en_po_sisters.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 0cc263345d..85ef778479 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index ee3499a57b..db44d32ed0 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -7,6 +7,7 @@ #include "z_en_ru2.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 46c4d7559a..43a59dce46 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -1,5 +1,6 @@ #include "z_en_ssh.h" +#include "array_count.h" #include "gfx.h" #include "segmented_address.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 3b36545dba..7f8bf6497a 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -7,6 +7,7 @@ #include "z_en_st.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index eee6976eeb..68335d64b2 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Niw/z_en_niw.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index c6b1b0906e..4f697c29b8 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "rand.h" diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 3290bb3e85..165065d714 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -9,6 +9,7 @@ #include "overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 493b07fc81..4014597de7 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 7607fe615e..764791e0df 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 843669b4ec..b49481e881 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -7,6 +7,7 @@ #include "z_en_zf.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 3fbe1b5fb1..28cf2833bb 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 5332ab6788..95a9f6e07c 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -7,6 +7,7 @@ #include "z_en_zo.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "segmented_address.h" diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 0dfabfee4c..d2912c7ea5 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -6,6 +6,7 @@ #include "z_magic_dark.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index b64077a0a5..57761244ba 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -7,6 +7,7 @@ #include "z_magic_wind.h" #include "libu64/debug.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 9563d5d2b4..c6d7b1da3f 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -8,6 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "ichain.h" #include "rand.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index f7ec91ca08..39d6de7d65 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -7,6 +7,7 @@ #include "z_obj_hamishi.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index d4624e2110..0a5866d1d1 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -8,6 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" +#include "array_count.h" #include "ichain.h" #include "printf.h" #include "quake.h" diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 036045087a..8c62e888f3 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -7,6 +7,7 @@ #include "z_obj_oshihiki.h" #include "overlays/actors/ovl_Obj_Switch/z_obj_switch.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index ac688638d0..b21c99e2ea 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -6,6 +6,7 @@ #include "z_obj_switch.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index bdf1ff693c..c170279758 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -7,6 +7,7 @@ #include "z_object_kankyo.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "segmented_address.h" diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 673855f560..258e237e05 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -18,6 +18,7 @@ #include "libc64/qrand.h" #include "libu64/debug.h" +#include "array_count.h" #include "avoid_ub.h" #include "controller.h" #include "gfx.h" diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index a6f909b56a..2ab88a16b1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c @@ -7,6 +7,7 @@ #include "z_eff_ss_bomb.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "segmented_address.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index c5eedab9cd..77de467bf3 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -1,6 +1,7 @@ #include "file_select.h" #include "file_select_state.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index dfef3133fe..79f76c8614 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -6,8 +6,8 @@ #include "libc64/qrand.h" #include "libu64/gfxprint.h" -#include "ultra64.h" #include "alloca.h" +#include "array_count.h" #include "console_logo_state.h" #include "controller.h" #include "gfx.h" @@ -24,6 +24,7 @@ #include "sfx.h" #include "terminal.h" #include "translation.h" +#include "ultra64.h" #include "z64play.h" #include "z64save.h" #include "z64sram.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index e67dd05e8d..2729bf54ee 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -1,5 +1,6 @@ #include "z_kaleido_scope.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "printf.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 34c3b46a4d..d07720d120 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -1,5 +1,7 @@ #include "z_kaleido_scope.h" + #include "libc64/sleep.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" From ea22c2ac38bb8cbb459210ce868398c5e7bdcda4 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 26 Apr 2025 19:07:52 -0400 Subject: [PATCH 5/8] create ACTOR_FLAGS_CHECK_ALL (#2515) --- include/macros.h | 2 -- include/z64actor.h | 2 ++ include/z64save.h | 11 ++++------- src/code/z_actor.c | 6 +++--- src/code/z_bg_collect.c | 2 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 4 ++-- .../ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c | 2 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 2 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 2 +- .../z_bg_menkuri_nisekabe.c | 2 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 10 +++++----- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 4 ++-- .../actors/ovl_En_Floormas/z_en_floormas.c | 2 +- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 2 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.c | 4 ++-- src/overlays/actors/ovl_En_Si/z_en_si.c | 4 ++-- src/overlays/actors/ovl_En_Test/z_en_test.c | 2 +- .../actors/ovl_player_actor/z_player.c | 18 +++++++++--------- 19 files changed, 40 insertions(+), 43 deletions(-) diff --git a/include/macros.h b/include/macros.h index 98efe590c5..9cb702f0b4 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,6 +1,4 @@ #ifndef MACROS_H #define MACROS_H -#define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask)) - #endif diff --git a/include/z64actor.h b/include/z64actor.h index 2709356b99..1a8b503297 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -160,6 +160,8 @@ typedef struct ActorShape { // Flag controlling the use of `Actor.sfx`. Do not use directly. See Actor_PlaySfx_FlaggedTimer #define ACTOR_FLAG_SFX_TIMER (1 << 28) +#define ACTOR_FLAGS_CHECK_ALL(thisx, mask) (((thisx)->flags & (mask)) == (mask)) + #define COLORFILTER_GET_COLORINTENSITY(colorFilterParams) (((colorFilterParams) & 0x1F00) >> 5) #define COLORFILTER_GET_DURATION(colorFilterParams) ((colorFilterParams) & 0xFF) diff --git a/include/z64save.h b/include/z64save.h index af03e8ca6f..71b1414052 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -592,14 +592,11 @@ typedef enum LinkAge { (EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_0_RESCUED) | EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_1_RESCUED) | \ EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_2_RESCUED) | EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_3_RESCUED)) -#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED() \ - CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED], \ - EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) +#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED() \ + ((gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) == (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK)) -#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2() \ - CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & \ - (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK | 0xF0), \ - EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) +#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2() \ + ((gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK | 0xF0) & EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) == (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK)) #define ENDAIKU_CARPENTER_RESCUED_MASK(carpenterType) (1 << (carpenterType)) diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 8ea0eb113f..202b2e2327 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -596,7 +596,7 @@ void Attention_Update(Attention* attention, Player* player, Actor* playerFocusAc attention->reticleFadeAlphaControl = 0; } - lockOnSfxId = CHECK_FLAG_ALL(playerFocusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) + lockOnSfxId = ACTOR_FLAGS_CHECK_ALL(playerFocusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) ? NA_SE_SY_LOCK_ON : NA_SE_SY_LOCK_ON_HUMAN; Sfx_PlaySfxCentered(lockOnSfxId); @@ -3468,9 +3468,9 @@ void Attention_FindActorInCategory(PlayState* play, ActorContext* actorCtx, Play while (actor != NULL) { if ((actor->update != NULL) && ((Player*)actor != player) && - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED)) { + ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_ATTENTION_ENABLED)) { if ((actorCategory == ACTORCAT_ENEMY) && - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) && + ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) && (actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sBgmEnemyDistSq)) { actorCtx->attention.bgmEnemy = actor; sBgmEnemyDistSq = actor->xyzDistToPlayerSq; diff --git a/src/code/z_bg_collect.c b/src/code/z_bg_collect.c index f4d63087b7..68966b74fc 100644 --- a/src/code/z_bg_collect.c +++ b/src/code/z_bg_collect.c @@ -82,7 +82,7 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) { if (dynaActor != NULL) { DynaPolyActor_SetActorOnTop(dynaActor); - if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_CAN_PRESS_SWITCHES)) { + if (ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_CAN_PRESS_SWITCHES)) { DynaPolyActor_SetSwitchPressed(dynaActor); } } diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index f9c6f71d25..9ca642d4e9 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -176,7 +176,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (this->collider.elem.atHitElem->acElemFlags & ACELEM_HOOKABLE) { ArmsHook_AttachToActor(this, touchedActor); - if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)) { + if (ACTOR_FLAGS_CHECK_ALL(touchedActor, ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)) { ArmsHook_PullPlayer(this); } } @@ -202,7 +202,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (attachedActor != NULL) { if ((attachedActor->update == NULL) || - !CHECK_FLAG_ALL(attachedActor->flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + !ACTOR_FLAGS_CHECK_ALL(attachedActor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { attachedActor = NULL; this->attachedActor = NULL; } else if (this->actor.child != NULL) { diff --git a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index ab2b0ce919..98824a94e0 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -58,7 +58,7 @@ void BgGndNisekabe_Draw(Actor* thisx, PlayState* play) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; u32 index = PARAMS_GET_U(this->actor.params, 0, 8); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, dLists[index]); } else { Gfx_DrawDListOpa(play, dLists[index]); diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 9ef689694f..a209637949 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -355,7 +355,7 @@ void BgHakaGate_Draw(Actor* thisx, PlayState* play) { BgHakaGate* this = (BgHakaGate*)thisx; MtxF currentMtxF; - if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(thisx, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, object_haka_objects_DL_00F1B0); } else { Gfx_SetupDL_25Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 3d67136b73..a09195d6fe 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -133,7 +133,7 @@ void BgHakaMegane_Update(Actor* thisx, PlayState* play) { void BgHakaMegane_Draw(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; - if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(thisx, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, sDLists[thisx->params]); } else { Gfx_DrawDListOpa(play, sDLists[thisx->params]); diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 0bc0649065..ff13454557 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -54,7 +54,7 @@ void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; u32 index = PARAMS_GET_U(this->actor.params, 0, 8); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, sDLists[index]); } else { Gfx_DrawDListOpa(play, sDLists[index]); diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 75b72adde9..89ba5fab34 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -917,7 +917,7 @@ void BossSst_HeadVulnerable(BossSst* this, PlayState* play) { Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[LEFT].x, 200.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].x, -200.0f, 20.0f); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { this->timer += 2; this->timer = CLAMP_MAX(this->timer, 50); } else { @@ -2713,7 +2713,7 @@ void BossSst_UpdateHead(Actor* thisx, PlayState* play2) { } BossSst_MoveAround(this); - if ((!this->vVanish || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) && + if ((!this->vVanish || ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) && ((this->actionFunc == BossSst_HeadReadyCharge) || (this->actionFunc == BossSst_HeadCharge) || (this->actionFunc == BossSst_HeadFrozenHand) || (this->actionFunc == BossSst_HeadStunned) || (this->actionFunc == BossSst_HeadVulnerable) || (this->actionFunc == BossSst_HeadDamage))) { @@ -2818,7 +2818,7 @@ s32 BossSst_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* Gfx** gfx) { BossSst* this = (BossSst*)thisx; - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) && this->vVanish) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS) && this->vVanish) { *dList = NULL; } else if (this->actionFunc == BossSst_HeadThrash) { // Animation modifications for death cutscene s32 shakeAmp = (this->timer / 10) + 1; @@ -2897,7 +2897,7 @@ void BossSst_DrawHead(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 6810); - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x80, sBodyColor.r, sBodyColor.g, sBodyColor.b, 255); if (!sBodyStatic) { @@ -2924,7 +2924,7 @@ void BossSst_DrawHead(Actor* thisx, PlayState* play) { Matrix_RotateY(-randYaw, MTXMODE_APPLY); } - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, this, POLY_OPA_DISP); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index d45fd27314..c4ef15919a 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -640,7 +640,7 @@ void EnBox_Draw(Actor* thisx, PlayState* play) { and cleared by Open */ if ((this->alpha == 255 && !(this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6)) || - (!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_REACT_TO_LENS) && + (!ACTOR_FLAGS_CHECK_ALL(&this->dyna.actor, ACTOR_FLAG_REACT_TO_LENS) && (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 26848dd956..475c476bb5 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -244,7 +244,7 @@ s32 EnFd_SpawnCore(EnFd* this, PlayState* play) { this->actor.child->colChkInfo.health = 8; } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Actor_SwapHookshotAttachment(play, &this->actor, this->actor.child); } @@ -684,7 +684,7 @@ void EnFd_Update(Actor* thisx, PlayState* play) { EnFd_SpawnDot(this, play); } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { if (EnFd_SpawnCore(this, play)) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->invincibilityTimer = 30; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index d365822f59..a9d9036e9f 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -293,7 +293,7 @@ void EnFloormas_SetupLand(EnFloormas* this) { void EnFloormas_SetupSplit(EnFloormas* this) { Actor_SetScale(&this->actor, 0.004f); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { this->actor.draw = EnFloormas_DrawHighlighted; } else { this->actor.draw = EnFloormas_Draw; diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index b9a678d699..ba002aefbe 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -376,7 +376,7 @@ void EnFw_Update(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; SkelAnime_Update(&this->skelAnime); - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index 57ef9a85b6..282d6249f1 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -226,7 +226,7 @@ s32 EnPoDesert_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec mtxScale = this->actionTimer / 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); } - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { *dList = NULL; } return false; @@ -246,7 +246,7 @@ void EnPoDesert_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* color.r = (s16)(rand * 30.0f) + 225; color.g = (s16)(rand * 100.0f) + 155; color.b = (s16)(rand * 160.0f) + 95; - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { gDPPipeSync((*gfxP)++); gDPSetEnvColor((*gfxP)++, color.r, color.g, color.b, 255); MATRIX_FINALIZE_AND_LOAD((*gfxP)++, play->state.gfxCtx, "../z_en_po_desert.c", 523); diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index d1597d0827..b5bf27be16 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -88,7 +88,7 @@ s32 func_80AFB748(EnSi* this, PlayState* play) { void func_80AFB768(EnSi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { this->actionFunc = func_80AFB89C; } else { Math_SmoothStepToF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); @@ -121,7 +121,7 @@ void func_80AFB89C(EnSi* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Item_Give(play, ITEM_SKULL_TOKEN); player->actor.freezeTimer = 10; Message_StartTextbox(play, 0xB4, NULL); diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index 0f9a9aa228..61628f342c 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1853,7 +1853,7 @@ s32 EnTest_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* } if ((this->actor.params == STALFOS_TYPE_INVISIBLE) && - !CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + !ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 258e237e05..5f93be1107 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1739,7 +1739,7 @@ BAD_RETURN(s32) func_80832224(Player* this) { s32 Player_IsTalking(PlayState* play) { Player* this = GET_PLAYER(play); - return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK); + return ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_TALK); } void Player_AnimPlayOnce(PlayState* play, Player* this, LinkAnimationHeader* anim) { @@ -2558,7 +2558,7 @@ s32 Player_FriendlyLockOnOrParallel(Player* this) { */ s32 Player_UpdateHostileLockOn(Player* this) { if ((this->focusActor != NULL) && - CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { + ACTOR_FLAGS_CHECK_ALL(this->focusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags1 |= PLAYER_STATE1_HOSTILE_LOCK_ON; return true; @@ -4003,7 +4003,7 @@ void Player_UpdateZTargeting(Player* this, PlayState* play) { // is hostile. This is a special case to allow Player to have more freedom of movement and be able // to throw a carried actor at the lock-on actor, even if it is hostile. if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || - !CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { + !ACTOR_FLAGS_CHECK_ALL(this->focusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags1 |= PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS; } } else { @@ -6177,7 +6177,7 @@ s32 Player_ActionHandler_Talk(Player* this, PlayState* play) { canTalkToLockOnWithCUp = (lockOnActor != NULL) && - (CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || + (ACTOR_FLAGS_CHECK_ALL(lockOnActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || (lockOnActor->naviEnemyId != NAVI_ENEMY_NONE)); if (canTalkToLockOnWithCUp || (this->naviTextId != 0)) { @@ -6292,7 +6292,7 @@ s32 Player_ActionHandler_0(Player* this, PlayState* play) { } if ((this->focusActor != NULL) && - (CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || + (ACTOR_FLAGS_CHECK_ALL(this->focusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || (this->focusActor->naviEnemyId != NAVI_ENEMY_NONE))) { this->stateFlags2 |= PLAYER_STATE2_21; } else if ((this->naviTextId == 0) && !Player_CheckHostileLockOn(this) && @@ -11378,7 +11378,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } else if (this->stateFlags2 & PLAYER_STATE2_8) { camMode = CAM_MODE_PUSH_PULL; } else if ((focusActor = this->focusActor) != NULL) { - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_TALK)) { camMode = CAM_MODE_TALK; } else if (this->stateFlags1 & PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS) { if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) { @@ -12000,7 +12000,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_UpdateShapeYaw(this, play); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_TALK)) { this->talkActorDistance = 0.0f; } else { this->talkActor = NULL; @@ -12564,7 +12564,7 @@ void Player_Action_Talk(Player* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_TALK; - if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { + if (!ACTOR_FLAGS_CHECK_ALL(this->talkActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } @@ -16155,7 +16155,7 @@ void Player_StartTalking(PlayState* play, Actor* actor) { s32 pad; if ((this->talkActor != NULL) || (actor == this->naviActor) || - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP)) { + ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP)) { actor->flags |= ACTOR_FLAG_TALK; } From f7a270655bd974242a286856bd56b490a998ac44 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sun, 27 Apr 2025 12:48:11 -0400 Subject: [PATCH 6/8] Delete macros.h; Delete global.h (#2516) --- include/buffers.h | 1 - include/global.h | 6 ------ include/macros.h | 4 ---- include/z64animation.h | 1 - include/z64scene.h | 1 - include/z64view.h | 1 - src/audio/general.c | 2 -- src/audio/lib/load.c | 2 -- src/audio/lib/playback.c | 1 - src/audio/lib/seqplayer.c | 1 - src/audio/lib/thread.c | 1 - src/audio/session_init.c | 2 -- src/audio/sfx.c | 1 - src/boot/boot_main.c | 2 -- src/boot/cic6105.c | 2 -- src/boot/idle.c | 2 -- src/boot/viconfig.c | 2 -- src/boot/z_locale.c | 3 --- src/boot/z_std_dma.c | 2 -- src/buffers/zbuffer.c | 1 - src/code/PreRender.c | 3 --- src/code/audio_stop_all_sfx.c | 2 -- src/code/audio_thread_manager.c | 2 -- src/code/debug_malloc.c | 2 -- src/code/fault_gc.c | 2 -- src/code/fault_gc_drawer.c | 3 --- src/code/fault_n64.c | 2 -- src/code/game.c | 3 --- src/code/gamealloc.c | 2 -- src/code/graph.c | 3 --- src/code/irqmgr.c | 2 -- src/code/main.c | 2 -- src/code/mempak.c | 2 -- src/code/object_table.c | 2 -- src/code/padmgr.c | 2 -- src/code/sched.c | 3 --- src/code/shrink_window.c | 2 -- src/code/sys_cfb.c | 2 -- src/code/sys_freeze.c | 2 -- src/code/sys_math3d.c | 2 -- src/code/sys_math_atan.c | 2 -- src/code/sys_matrix.c | 1 - src/code/title_setup.c | 2 -- src/code/ucode_disas.c | 2 -- src/code/z_DLF.c | 2 -- src/code/z_actor.c | 2 -- src/code/z_actor_dlftbls.c | 2 -- src/code/z_camera_data.inc.c | 2 -- src/code/z_collision_btltbls.c | 2 -- src/code/z_collision_check.c | 1 - src/code/z_cutscene_spline.c | 1 - src/code/z_debug.c | 2 -- src/code/z_demo.c | 2 -- src/code/z_eff_blure.c | 3 --- src/code/z_eff_shield_particle.c | 3 --- src/code/z_eff_spark.c | 3 --- src/code/z_fbdemo.c | 2 -- src/code/z_fbdemo_circle.c | 2 -- src/code/z_fbdemo_fade.c | 2 -- src/code/z_fbdemo_triforce.c | 1 - src/code/z_fcurve_data.c | 1 - src/code/z_frame_advance.c | 1 - src/code/z_game_over.c | 3 --- src/code/z_jpeg.c | 3 --- src/code/z_kaleido_manager.c | 2 -- src/code/z_kaleido_scope_call.c | 2 -- src/code/z_kanfont.c | 2 -- src/code/z_lib.c | 1 - src/code/z_malloc.c | 2 -- src/code/z_map_exp.c | 2 -- src/code/z_map_mark.c | 2 -- src/code/z_message.c | 2 -- src/code/z_moji.c | 3 --- src/code/z_parameter.c | 2 -- src/code/z_play.c | 2 -- src/code/z_prenmi.c | 3 --- src/code/z_prenmi_buff.c | 1 - src/code/z_quake.c | 1 - src/code/z_sfx_source.c | 2 -- src/code/z_skelanime.c | 2 -- src/code/z_skin_matrix.c | 2 -- src/code/z_sram.c | 2 -- src/code/z_ss_sram.c | 3 --- src/code/z_vimode.c | 3 --- src/code/z_viscvg.c | 2 -- src/code/z_vismono.c | 2 -- src/code/z_viszbuf.c | 2 -- src/code/z_vr_box.c | 2 -- src/libc64/__osMalloc_gc.c | 2 -- src/libc64/__osMalloc_n64.c | 2 -- src/libc64/malloc.c | 2 -- src/libc64/math64.c | 1 - src/libleo/leo/leofunc.c | 2 -- src/libleo/leo/leoutil.c | 2 -- src/libu64/debug.c | 2 -- src/libu64/gfxprint.c | 2 -- src/libu64/load_gc.c | 2 -- src/libu64/loadfragment2_gc.c | 2 -- src/libu64/loadfragment2_n64.c | 2 -- src/libu64/rcp_utils.c | 2 -- src/libu64/relocation_gc.c | 2 -- src/libu64/stackcheck.c | 2 -- src/libultra/io/contpfs.c | 2 -- src/libultra/io/contreaddata.c | 2 -- src/libultra/io/controller.c | 2 -- src/libultra/io/piacs.c | 2 -- src/libultra/io/siacs.c | 2 -- src/libultra/io/vimgr.c | 2 -- src/n64dd/n64dd_801C8940.c | 2 -- src/n64dd/n64dd_801C9440.c | 1 - src/n64dd/n64dd_801CA0B0.c | 2 -- src/n64dd/n64dd_data_buffer.c | 1 - src/n64dd/n64dd_error_bodies.c | 1 - src/n64dd/n64dd_error_headers.c | 1 - src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 1 - src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 2 -- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 -- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 4 ---- src/overlays/gamestates/ovl_file_choose/z_file_choose.c | 3 --- src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c | 2 -- src/overlays/gamestates/ovl_file_choose/z_file_nameset.c | 3 --- src/overlays/gamestates/ovl_select/z_select.c | 2 -- src/overlays/gamestates/ovl_title/z_title.c | 2 -- src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c | 2 -- src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c | 2 -- src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c | 2 -- src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c | 2 -- tools/ZAPD/ZAPD/ZFile.cpp | 1 - 128 files changed, 256 deletions(-) delete mode 100644 include/global.h delete mode 100644 include/macros.h diff --git a/include/buffers.h b/include/buffers.h index e74719c440..2a690d2730 100644 --- a/include/buffers.h +++ b/include/buffers.h @@ -2,7 +2,6 @@ #define BUFFERS_H #include "gfx.h" -#include "macros.h" #include "ultra64.h" extern u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; // 0x25800 bytes diff --git a/include/global.h b/include/global.h deleted file mode 100644 index 0b9114f96d..0000000000 --- a/include/global.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GLOBAL_H -#define GLOBAL_H - -#include "macros.h" - -#endif diff --git a/include/macros.h b/include/macros.h deleted file mode 100644 index 9cb702f0b4..0000000000 --- a/include/macros.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MACROS_H -#define MACROS_H - -#endif diff --git a/include/z64animation.h b/include/z64animation.h index 9db7b260dc..a085da5ddd 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -5,7 +5,6 @@ #include "ultra64.h" #include "z64dma.h" #include "z64math.h" -#include "macros.h" struct PlayState; struct Actor; diff --git a/include/z64scene.h b/include/z64scene.h index 7453f48bae..09b342c047 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -2,7 +2,6 @@ #define Z64SCENE_H #include "avoid_ub.h" -#include "macros.h" #include "ultra64.h" #include "z64bgcheck.h" #include "z64environment.h" diff --git a/include/z64view.h b/include/z64view.h index b007129f97..83bdf0fe84 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -2,7 +2,6 @@ #define Z64VIEW_H #include "avoid_ub.h" -#include "macros.h" #include "ultra64.h" #include "z64math.h" diff --git a/src/audio/general.c b/src/audio/general.c index abdbcade0d..f04f203a1f 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -13,8 +13,6 @@ #include "z64audio.h" #include "z64ocarina.h" -#include "global.h" - #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) #if !PLATFORM_N64 diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index f05850c69e..ebd968ae9b 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -6,8 +6,6 @@ #include "versions.h" #include "z64audio.h" -#include "global.h" - #define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \ (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (loadStatus)) #define ASYNC_TBLTYPE(v) ((u8)(v >> 16)) diff --git a/src/audio/lib/playback.c b/src/audio/lib/playback.c index 03e749437b..327e271d06 100644 --- a/src/audio/lib/playback.c +++ b/src/audio/lib/playback.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "macros.h" #include "z64audio.h" void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c index c906e6728f..c43ae4848e 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -17,7 +17,6 @@ #include "array_count.h" #include "assert.h" #include "attributes.h" -#include "macros.h" #include "ultra64.h" #include "z64audio.h" diff --git a/src/audio/lib/thread.c b/src/audio/lib/thread.c index 43cb6d498b..b47efa3267 100644 --- a/src/audio/lib/thread.c +++ b/src/audio/lib/thread.c @@ -1,6 +1,5 @@ #include "array_count.h" #include "audiothread_cmd.h" -#include "macros.h" #include "ultra64.h" #include "versions.h" #include "z64audio.h" diff --git a/src/audio/session_init.c b/src/audio/session_init.c index e7248907e9..3c3d9c4aeb 100644 --- a/src/audio/session_init.c +++ b/src/audio/session_init.c @@ -2,8 +2,6 @@ #include "buffers.h" #include "z64audio.h" -#include "global.h" - #include "assets/audio/sequence_sizes.h" #include "assets/audio/soundfont_sizes.h" diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 9c6d7c6eb6..65309942a6 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -1,6 +1,5 @@ #include "array_count.h" #include "audiothread_cmd.h" -#include "macros.h" #include "printf.h" #include "sfx.h" #include "terminal.h" diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index 811c75d35a..2f948b9d6a 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -12,8 +12,6 @@ #include "z_locale.h" #include "z64thread.h" -#include "global.h" - #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:128" StackEntry sBootThreadInfo; diff --git a/src/boot/cic6105.c b/src/boot/cic6105.c index 81c0af99cd..fadae3a181 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -7,8 +7,6 @@ #include "regs.h" #include "sched.h" -#include "global.h" - s32 func_80001714(void); OSTask D_800067C0_unknown = { diff --git a/src/boot/idle.c b/src/boot/idle.c index 2acfe2ddbf..743219d94c 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -14,8 +14,6 @@ #include "z64thread.h" #include "z64dma.h" -#include "global.h" - #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c index 1340e850b4..0381f57f30 100644 --- a/src/boot/viconfig.c +++ b/src/boot/viconfig.c @@ -2,8 +2,6 @@ #include "terminal.h" #include "idle.h" -#include "global.h" - s8 D_80009430 = 1; vu8 gViConfigBlack = true; u8 gViConfigAdditionalScanLines = 0; diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index 0e3df93e48..a517f561ce 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -11,9 +11,6 @@ #include "vi_mode.h" #include "z_locale.h" -#include "macros.h" -#include "global.h" - s32 gCurrentRegion = 0; typedef struct LocaleCartInfo { diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index ac91d0d828..de2a19e57c 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -45,8 +45,6 @@ #include "z64dma.h" #include "z64thread.h" -#include "global.h" - #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:66" \ "pal-1.0:64 pal-1.1:64" diff --git a/src/buffers/zbuffer.c b/src/buffers/zbuffer.c index 0eda889219..69c445b633 100644 --- a/src/buffers/zbuffer.c +++ b/src/buffers/zbuffer.c @@ -1,6 +1,5 @@ #include "alignment.h" #include "buffers.h" -#include "macros.h" #include "ultra64/ultratypes.h" ALIGNED(64) u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index c6cf72c59c..ddf6b473ea 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -13,9 +13,6 @@ #include "printf.h" #include "regs.h" -#include "macros.h" -#include "global.h" - void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; this->heightSave = height; diff --git a/src/code/audio_stop_all_sfx.c b/src/code/audio_stop_all_sfx.c index 2702f8a579..b1b526e8ec 100644 --- a/src/code/audio_stop_all_sfx.c +++ b/src/code/audio_stop_all_sfx.c @@ -2,8 +2,6 @@ #include "sfx.h" #include "ultra64.h" -#include "macros.h" - u8 sSfxBankIds[] = { BANK_PLAYER, BANK_ITEM, BANK_ENV, BANK_ENEMY, BANK_SYSTEM, BANK_OCARINA, BANK_VOICE, }; diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index 5e0cbfc28a..57f530a4b8 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -13,8 +13,6 @@ #include "translation.h" #include "z64dma.h" -#include "macros.h" - void AudioMgr_NotifyTaskDone(AudioMgr* audioMgr) { AudioTask* task = audioMgr->rspTask; diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index 6204e674f4..ad7c786f34 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -3,8 +3,6 @@ #include "printf.h" #include "translation.h" -#include "macros.h" - #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 #define LOG_SEVERITY_VERBOSE 3 diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 75104362d5..b2bb9d13d4 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -58,8 +58,6 @@ #include "translation.h" #include "z64thread.h" -#include "global.h" - void Fault_Init(void); void Fault_SetOsSyncPrintfEnabled(u32 enabled); void Fault_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color); diff --git a/src/code/fault_gc_drawer.c b/src/code/fault_gc_drawer.c index 044b9561bc..9c2470b9b8 100644 --- a/src/code/fault_gc_drawer.c +++ b/src/code/fault_gc_drawer.c @@ -7,12 +7,9 @@ #include "array_count.h" #include "fault.h" - #include "gfx.h" #include "terminal.h" -#include "global.h" - #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" typedef struct FaultDrawer { diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index 5e071d87b6..75fc704b91 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -13,8 +13,6 @@ #include "z64thread.h" #include "translation.h" -#include "global.h" - #pragma increment_block_number "ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" typedef struct FaultMgr { diff --git a/src/code/game.c b/src/code/game.c index 536013aa97..7f63d4d641 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -32,9 +32,6 @@ #include "z64play.h" #include "z64vis.h" -#include "macros.h" -#include "global.h" - #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" SpeedMeter D_801664D0; diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index 33ad848a17..506ef7721e 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -3,8 +3,6 @@ #include "gamealloc.h" #include "printf.h" -#include "macros.h" - void GameAlloc_Log(GameAlloc* this) { GameAllocEntry* iter; diff --git a/src/code/graph.c b/src/code/graph.c index 8fbb1b02fc..86543cc50d 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -30,9 +30,6 @@ #include "z64save.h" #include "z64play.h" -#include "macros.h" -#include "global.h" - #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 diff --git a/src/code/irqmgr.c b/src/code/irqmgr.c index fe6b3a12fd..ced883f7a0 100644 --- a/src/code/irqmgr.c +++ b/src/code/irqmgr.c @@ -42,8 +42,6 @@ #include "versions.h" #include "z64thread.h" -#include "macros.h" - vu32 gIrqMgrResetStatus = IRQ_RESET_STATUS_IDLE; volatile OSTime sIrqMgrResetTime = 0; volatile OSTime gIrqMgrRetraceTime = 0; diff --git a/src/code/main.c b/src/code/main.c index 584e098e6e..cb936b2176 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -43,8 +43,6 @@ extern struct IrqMgr gIrqMgr; #include "z64debug.h" #include "z64thread.h" -#include "global.h" - #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ique-cn:0 ntsc-1.0:34 ntsc-1.1:34 ntsc-1.2:34 pal-1.0:32 pal-1.1:32" diff --git a/src/code/mempak.c b/src/code/mempak.c index 19c11b31d2..850c478b93 100644 --- a/src/code/mempak.c +++ b/src/code/mempak.c @@ -11,8 +11,6 @@ #include "padmgr.h" #include "printf.h" -#include "macros.h" - #define MEMPAK_MAX_FILES 11 OSPfs sMempakPfsHandle; diff --git a/src/code/object_table.c b/src/code/object_table.c index 0de131824a..9ed6a1f44d 100644 --- a/src/code/object_table.c +++ b/src/code/object_table.c @@ -4,8 +4,6 @@ #include "ultra64.h" #include "z64object.h" -#include "macros.h" - s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; u32 gObjectTableSize = ARRAY_COUNT(gObjectTable); diff --git a/src/code/padmgr.c b/src/code/padmgr.c index ddea9b2549..01a952c876 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -38,8 +38,6 @@ #include "translation.h" #include "line_numbers.h" -#include "macros.h" - #define PADMGR_LOG(controllerNum, msg) \ if (DEBUG_FEATURES) { \ PRINTF_COLOR_YELLOW(); \ diff --git a/src/code/sched.c b/src/code/sched.c index b009dff357..c573bf97f6 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -54,9 +54,6 @@ #include "vi_mode.h" #include "z64thread.h" -#include "macros.h" -#include "global.h" - #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 #define NOTIFY_MSG 670 // original name: ENTRY_MSG diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index a485d81684..3c92ede0e1 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -2,8 +2,6 @@ #include "printf.h" #include "regs.h" -#include "macros.h" - typedef enum LetterboxState { /* 0 */ LETTERBOX_STATE_IDLE, /* 1 */ LETTERBOX_STATE_GROWING, diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 8877c92ce6..38fc9c65d8 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -7,8 +7,6 @@ #include "printf.h" #include "translation.h" -#include "global.h" - #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "pal-1.1:128" diff --git a/src/code/sys_freeze.c b/src/code/sys_freeze.c index 427fca3895..2957155559 100644 --- a/src/code/sys_freeze.c +++ b/src/code/sys_freeze.c @@ -4,8 +4,6 @@ #include "sys_freeze.h" #include "terminal.h" -#include "macros.h" - NORETURN void func_800D31A0(void) { PRINTF(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST); for (;;) { diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 35f15bdafd..1ce651e9c9 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -7,8 +7,6 @@ #include "z_lib.h" #include "z64math.h" -#include "macros.h" - #pragma increment_block_number "gc-eu:77 gc-eu-mq:77 gc-jp:77 gc-jp-ce:77 gc-jp-mq:77 gc-us:77 gc-us-mq:77 ique-cn:67" \ "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c index e2b70a3612..0c99eaced4 100644 --- a/src/code/sys_math_atan.c +++ b/src/code/sys_math_atan.c @@ -2,8 +2,6 @@ #include "sys_math.h" #include "z64math.h" -#include "macros.h" - static u16 sAtan2Tbl[] = { 0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, 0x007A, 0x0084, 0x008F, 0x0099, 0x00A3, 0x00AD, 0x00B7, 0x00C2, 0x00CC, 0x00D6, 0x00E0, 0x00EA, 0x00F4, 0x00FF, 0x0109, 0x0113, diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 3dc86d25de..2ca4882601 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -3,7 +3,6 @@ #if DEBUG_FEATURES #include "fault.h" #endif -#include "macros.h" #include "printf.h" #include "sys_matrix.h" #include "ultra64.h" diff --git a/src/code/title_setup.c b/src/code/title_setup.c index 64e30ecaa4..0272022474 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -4,8 +4,6 @@ #include "translation.h" #include "z64save.h" -#include "global.h" - void Setup_InitImpl(SetupState* this) { PRINTF(T("ゼルダ共通データ初期化\n", "Zelda common data initialization\n")); SaveContext_Init(); diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index 7626ed6201..8d1ff6cd77 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -7,8 +7,6 @@ #include "ucode_disas.h" #include "ultra64.h" -#include "macros.h" - #if DEBUG_FEATURES typedef struct F3dzexConst { diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 2dbcb115b3..ad2cdff118 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -6,8 +6,6 @@ #include "ultra64.h" #include "z_game_dlftbls.h" -#include "macros.h" - void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { if (overlayEntry->loadedRamAddr != NULL) { PRINTF(T("既にリンクされています\n", "Already linked\n")); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 202b2e2327..721087332e 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -28,8 +28,6 @@ #include "z64save.h" #include "z64skin_matrix.h" -#include "global.h" - #include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index f489e614c3..1e3c6c96ba 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -3,8 +3,6 @@ #include "segment_symbols.h" #include "z_actor_dlftbls.h" -#include "macros.h" - // Linker symbol declarations (used in the table below) #define DEFINE_ACTOR(name, _1, _2, _3) DECLARE_OVERLAY_SEGMENT(name) #define DEFINE_ACTOR_INTERNAL(_0, _1, _2, _3) diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 18b071b1d6..9a9795f453 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -1,8 +1,6 @@ #include "array_count.h" #include "ultra64.h" -#include "global.h" - typedef struct CameraModeValue { s16 val; s16 dataType; diff --git a/src/code/z_collision_btltbls.c b/src/code/z_collision_btltbls.c index a49a71d056..5c2a210bcc 100644 --- a/src/code/z_collision_btltbls.c +++ b/src/code/z_collision_btltbls.c @@ -3,8 +3,6 @@ #include "translation.h" #include "z64collision_check.h" -#include "macros.h" - static DamageTable sDamageTablePresets[] = { { { // 0 diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 2c77d94413..dcf07766e6 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,5 +1,4 @@ #include "gfx.h" -#include "macros.h" #include "printf.h" #include "regs.h" #include "sfx.h" diff --git a/src/code/z_cutscene_spline.c b/src/code/z_cutscene_spline.c index d95b2ca7fd..137f9f544c 100644 --- a/src/code/z_cutscene_spline.c +++ b/src/code/z_cutscene_spline.c @@ -2,7 +2,6 @@ #include "z64math.h" #include "z64camera.h" #include "z64cutscene_spline.h" -#include "macros.h" // The code in this file is very similar to a spline system used in Super Mario 64 for cutscene camera movement diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 65f8eb60ad..d5804cd7ee 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -11,8 +11,6 @@ #include "ultra64.h" #include "z64debug.h" -#include "macros.h" - typedef struct DebugCamTextBufferEntry { /* 0x0 */ u8 x; /* 0x1 */ u8 y; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index f45fd1933f..d5135b99d1 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -30,8 +30,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/overworld/ganon_tou/ganon_tou_scene.h" diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index a956d34688..614cfa5b5b 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -9,9 +9,6 @@ #include "z64effect.h" #include "z64skin_matrix.h" -#include "macros.h" -#include "global.h" - #include "z64.h" // required for gameplay keep, the header doesnt include any external dependencies #include "assets/objects/gameplay_keep/gameplay_keep.h" diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index bc71d8c4fd..865bd8ec93 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -10,9 +10,6 @@ #include "z64play.h" #include "z64skin_matrix.h" -#include "macros.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" static Vtx sVertices[5] = { diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index dc3ebf9d16..57ce3d9ba1 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -9,9 +9,6 @@ #include "z64play.h" #include "z64skin_matrix.h" -#include "macros.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" // original name: "spark" diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index 482fa99d6d..2621f1c129 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -19,8 +19,6 @@ #include "z64math.h" #include "z64transition_instances.h" -#include "macros.h" - // color framebuffer extern u16 D_0F000000[]; diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 699526ce79..499867d570 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -4,8 +4,6 @@ #include "gfx.h" #include "sfx.h" -#include "global.h" - typedef enum TransitionCircleDirection { /* 0 */ TRANS_CIRCLE_DIR_IN, /* 1 */ TRANS_CIRCLE_DIR_OUT diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index c789cfd6c1..1be97d5f51 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -9,8 +9,6 @@ #include "z64save.h" #include "z64transition_instances.h" -#include "macros.h" - typedef enum TransitionFadeDirection { /* 0 */ TRANS_FADE_DIR_IN, /* 1 */ TRANS_FADE_DIR_OUT diff --git a/src/code/z_fbdemo_triforce.c b/src/code/z_fbdemo_triforce.c index c120290353..d844644a29 100644 --- a/src/code/z_fbdemo_triforce.c +++ b/src/code/z_fbdemo_triforce.c @@ -1,6 +1,5 @@ #include "transition_triforce.h" -#include "global.h" #include "printf.h" #include "assets/code/fbdemo_triforce/z_fbdemo_triforce.c" diff --git a/src/code/z_fcurve_data.c b/src/code/z_fcurve_data.c index a1c03a9278..a1950a568b 100644 --- a/src/code/z_fcurve_data.c +++ b/src/code/z_fcurve_data.c @@ -2,7 +2,6 @@ * File: z_fcurve_data.c * Description: Interpolation functions for use with Curve SkelAnime */ -#include "global.h" #include "z64curve.h" #define FCURVE_INTERP_CUBIC 0 // Interpolate using a Hermite cubic spline diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c index 5c8f685f22..6ca410a759 100644 --- a/src/code/z_frame_advance.c +++ b/src/code/z_frame_advance.c @@ -4,7 +4,6 @@ #include "controller.h" #include "libu64/pad.h" -#include "macros.h" void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { frameAdvCtx->timer = 0; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index e05bcff26d..f73616116d 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -8,9 +8,6 @@ #include "z64play.h" #include "z64save.h" -#include "macros.h" -#include "global.h" - void GameOver_Init(PlayState* play) { play->gameOverCtx.state = GAMEOVER_INACTIVE; } diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 86c896e629..4413e8ae69 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -9,9 +9,6 @@ #include "translation.h" #include "ultra64.h" -#include "global.h" -#include "macros.h" - #define MARKER_ESCAPE 0x00 #define MARKER_SOI 0xD8 #define MARKER_SOF 0xC0 diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index efecef6468..d9bca732e5 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -8,8 +8,6 @@ #include "translation.h" #include "z64play.h" -#include "macros.h" - #define KALEIDO_OVERLAY(name, nameString) \ { NULL, ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, 0, nameString, } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index b50cc0f86c..2707db8265 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -10,8 +10,6 @@ #include "translation.h" #include "z64play.h" -#include "global.h" - void (*sKaleidoScopeUpdateFunc)(PlayState* play); void (*sKaleidoScopeDrawFunc)(PlayState* play); f32 gBossMarkScale; diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index 0996a1a6e7..89f5bbd3b7 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -8,8 +8,6 @@ #include "z64font.h" #include "z64message.h" -#include "macros.h" - /** * Loads a texture from kanji for the requested `character` into the character texture buffer * at `codePointIndex`. The value of `character` is the SHIFT-JIS encoding of the character. diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 741c982e06..e4d56b8dad 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -3,7 +3,6 @@ #include "ichain.h" #include "printf.h" #include "regs.h" -#include "macros.h" #include "sys_math.h" #include "rand.h" #include "sfx.h" diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 6751bcbeeb..513a61b31e 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -2,8 +2,6 @@ #include "printf.h" #include "translation.h" -#include "global.h" - #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 #define LOG_SEVERITY_VERBOSE 3 diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index ee93a9a29e..e46c70bd10 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -17,8 +17,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/textures/parameter_static/parameter_static.h" diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 1bccd2921a..402d942d66 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -16,8 +16,6 @@ #include "assets/textures/parameter_static/parameter_static.h" -#include "global.h" - typedef struct MapMarkInfo { /* 0x00 */ void* texture; /* 0x04 */ u32 imageFormat; diff --git a/src/code/z_message.c b/src/code/z_message.c index 38153dff02..046d3ff886 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -24,8 +24,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:32" \ diff --git a/src/code/z_moji.c b/src/code/z_moji.c index 2114996cb5..e26ce68e7f 100644 --- a/src/code/z_moji.c +++ b/src/code/z_moji.c @@ -3,10 +3,7 @@ */ #include "gfx.h" - -#include "macros.h" #include "printf.h" -#include "global.h" // how big to draw the characters on screen #define DISP_CHAR_WIDTH 8 diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 0785675102..1498db0fba 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -25,8 +25,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/do_action_static/do_action_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" diff --git a/src/code/z_play.c b/src/code/z_play.c index 31dbc765ca..d4d28422c3 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -47,8 +47,6 @@ #include "z64save.h" #include "z64vis.h" -#include "global.h" - #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:224" \ "ntsc-1.0:240 ntsc-1.1:240 ntsc-1.2:240 pal-1.0:240 pal-1.1:240" diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c index 6d50f41066..6bf73b0577 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -7,9 +7,6 @@ #include "versions.h" #include "vi_mode.h" -#include "macros.h" -#include "global.h" - void func_80092320(PreNMIState* this) { this->state.running = false; this->state.init = NULL; diff --git a/src/code/z_prenmi_buff.c b/src/code/z_prenmi_buff.c index 17ef0b78c9..3c45d7e540 100644 --- a/src/code/z_prenmi_buff.c +++ b/src/code/z_prenmi_buff.c @@ -1,5 +1,4 @@ #include "prenmi_buff.h" -#include "global.h" #define COLD_RESET 0 #define NMI 1 diff --git a/src/code/z_quake.c b/src/code/z_quake.c index cacb5a213f..d3ba17810d 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,6 +1,5 @@ #include "libc64/qrand.h" #include "array_count.h" -#include "macros.h" #include "printf.h" #include "quake.h" #include "terminal.h" diff --git a/src/code/z_sfx_source.c b/src/code/z_sfx_source.c index 9dda34ce3d..785afcde35 100644 --- a/src/code/z_sfx_source.c +++ b/src/code/z_sfx_source.c @@ -5,8 +5,6 @@ #include "z64play.h" #include "z64skin_matrix.h" -#include "global.h" - void SfxSource_InitAll(PlayState* play) { SfxSource* sources = &play->sfxSources[0]; s32 i; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9e79abcbfe..4e4fd97e9a 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -14,8 +14,6 @@ #include "z64animation_legacy.h" #include "z64play.h" -#include "macros.h" - #define ANIM_INTERP 1 s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 5e9edf45e2..36d7a02791 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -6,8 +6,6 @@ #include "translation.h" #include "z_lib.h" -#include "macros.h" - // clang-format off MtxF sMtxFClear = { 1.0f, 0.0f, 0.0f, 0.0f, diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 456e7a8227..2eef6db036 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -17,8 +17,6 @@ #include "z64scene.h" #include "z64ss_sram.h" -#include "global.h" - #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c index 809786245f..94e97639aa 100644 --- a/src/code/z_ss_sram.c +++ b/src/code/z_ss_sram.c @@ -2,9 +2,6 @@ #include "printf.h" #include "z64ss_sram.h" -#include "macros.h" -#include "global.h" - typedef struct SsSramContext { /* 0x00 */ OSPiHandle piHandle; /* 0x74 */ OSIoMesg ioMesg; diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index 877a789c6b..6eceeaa7e7 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -9,9 +9,6 @@ #include "regs.h" #include "versions.h" -#include "global.h" -#include "macros.h" - void ViMode_LogPrint(OSViMode* osViMode) { LOG_ADDRESS("osvimodep", osViMode, "../z_vimode.c", 87); LOG_HEX32("osvimodep->comRegs.ctrl", osViMode->comRegs.ctrl, "../z_vimode.c", 88); diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index 5fff1a460f..51fc6f8e5d 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -23,8 +23,6 @@ #include "gfx.h" #include "z64vis.h" -#include "macros.h" - /** * Draws only coverage: does not retain any of the original pixel RGB, primColor is used as background color. */ diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index e3cecda5c1..517f2ada60 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -15,8 +15,6 @@ #include "gfxalloc.h" #include "z64vis.h" -#include "macros.h" - // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into // the half of TMEM dedicated to color-indexed data. diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 8f8265bfda..431d7f6d9a 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -35,8 +35,6 @@ #include "gfx.h" #include "z64vis.h" -#include "macros.h" - // Height of the fragments the z-buffer is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM. #define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index f0ef9b0082..2fa2122acf 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -10,8 +10,6 @@ #include "z64play.h" #include "z64save.h" -#include "global.h" - typedef struct SkyboxFaceParams { /* 0x000 */ s32 xStart; /* 0x004 */ s32 yStart; diff --git a/src/libc64/__osMalloc_gc.c b/src/libc64/__osMalloc_gc.c index a14894cfe9..d6e4e17d13 100644 --- a/src/libc64/__osMalloc_gc.c +++ b/src/libc64/__osMalloc_gc.c @@ -6,8 +6,6 @@ #include "terminal.h" #include "translation.h" -#include "global.h" - #define FILL_ALLOC_BLOCK_FLAG (1 << 0) #define FILL_FREE_BLOCK_FLAG (1 << 1) #define CHECK_FREE_BLOCK_FLAG (1 << 2) diff --git a/src/libc64/__osMalloc_n64.c b/src/libc64/__osMalloc_n64.c index bb7945a5a2..6b81212963 100644 --- a/src/libc64/__osMalloc_n64.c +++ b/src/libc64/__osMalloc_n64.c @@ -4,8 +4,6 @@ #include "fault.h" #include "translation.h" -#include "global.h" - #define NODE_MAGIC 0x7373 #define NODE_IS_VALID(node) ((node)->magic == NODE_MAGIC) diff --git a/src/libc64/malloc.c b/src/libc64/malloc.c index 545c86a621..8b9c9b6705 100644 --- a/src/libc64/malloc.c +++ b/src/libc64/malloc.c @@ -5,8 +5,6 @@ #include "translation.h" #include "ultra64.h" -#include "macros.h" - #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 #define LOG_SEVERITY_VERBOSE 3 diff --git a/src/libc64/math64.c b/src/libc64/math64.c index f2a6edba9a..b51eb333ed 100644 --- a/src/libc64/math64.c +++ b/src/libc64/math64.c @@ -1,6 +1,5 @@ #include "libc64/math64.h" #include "z64math.h" -#include "macros.h" #if !PLATFORM_N64 s32 gUseAtanContFrac; diff --git a/src/libleo/leo/leofunc.c b/src/libleo/leo/leofunc.c index 8aaf794fdb..35ba14005f 100644 --- a/src/libleo/leo/leofunc.c +++ b/src/libleo/leo/leofunc.c @@ -4,8 +4,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - static s32 __leoResetCalled = false; static s32 __leoQueuesCreated = false; diff --git a/src/libleo/leo/leoutil.c b/src/libleo/leo/leoutil.c index 44240b0556..e90ea1f678 100644 --- a/src/libleo/leo/leoutil.c +++ b/src/libleo/leo/leoutil.c @@ -4,8 +4,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - u16 leoLba_to_phys(u32 lba) { u16 vzone_num; u16 zone_slba; diff --git a/src/libu64/debug.c b/src/libu64/debug.c index 1278206960..e1ed15fe45 100644 --- a/src/libu64/debug.c +++ b/src/libu64/debug.c @@ -3,8 +3,6 @@ #include "terminal.h" #include "translation.h" -#include "global.h" - #if PLATFORM_N64 || DEBUG_FEATURES f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max) { diff --git a/src/libu64/gfxprint.c b/src/libu64/gfxprint.c index 579e011f77..c47d52a3a5 100644 --- a/src/libu64/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -3,8 +3,6 @@ #include "attributes.h" #include "translation.h" -#include "macros.h" - u16 sGfxPrintFontTLUT[64] = { 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, diff --git a/src/libu64/load_gc.c b/src/libu64/load_gc.c index b39593d789..340780a130 100644 --- a/src/libu64/load_gc.c +++ b/src/libu64/load_gc.c @@ -4,8 +4,6 @@ #include "translation.h" #include "z64dma.h" -#include "macros.h" - size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) { s32 pad[3]; uintptr_t end; diff --git a/src/libu64/loadfragment2_gc.c b/src/libu64/loadfragment2_gc.c index e20fcefffa..5ad556e506 100644 --- a/src/libu64/loadfragment2_gc.c +++ b/src/libu64/loadfragment2_gc.c @@ -2,8 +2,6 @@ #include "libu64/overlay.h" #include "printf.h" -#include "macros.h" - void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) { void* allocatedRamAddr = SYSTEM_ARENA_MALLOC_R((intptr_t)vramEnd - (intptr_t)vramStart, "../loadfragment2.c", 31); diff --git a/src/libu64/loadfragment2_n64.c b/src/libu64/loadfragment2_n64.c index 76ca03046f..be0e5295d9 100644 --- a/src/libu64/loadfragment2_n64.c +++ b/src/libu64/loadfragment2_n64.c @@ -11,8 +11,6 @@ #include "translation.h" #include "z64dma.h" -#include "macros.h" - s32 gOverlayLogSeverity = 2; // Extract MIPS register rs from an instruction word diff --git a/src/libu64/rcp_utils.c b/src/libu64/rcp_utils.c index f3a6ae32cd..27e929f7d1 100644 --- a/src/libu64/rcp_utils.c +++ b/src/libu64/rcp_utils.c @@ -2,8 +2,6 @@ #include "ultra64.h" #include "printf.h" -#include "global.h" - #if PLATFORM_N64 || DEBUG_FEATURES #define RCP_UTILS_PRINTF osSyncPrintf #elif IDO_PRINTF_WORKAROUND diff --git a/src/libu64/relocation_gc.c b/src/libu64/relocation_gc.c index 049c961fd1..91d7eaf790 100644 --- a/src/libu64/relocation_gc.c +++ b/src/libu64/relocation_gc.c @@ -11,8 +11,6 @@ #include "printf.h" #include "ultra64.h" -#include "macros.h" - // Extract MIPS register rs from an instruction word #define MIPS_REG_RS(insn) (((insn) >> 0x15) & 0x1F) diff --git a/src/libu64/stackcheck.c b/src/libu64/stackcheck.c index 8c65d87d18..69fe224ee8 100644 --- a/src/libu64/stackcheck.c +++ b/src/libu64/stackcheck.c @@ -5,8 +5,6 @@ #include "terminal.h" #include "translation.h" -#include "macros.h" - StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; diff --git a/src/libultra/io/contpfs.c b/src/libultra/io/contpfs.c index c99c316825..0506ca5d5a 100644 --- a/src/libultra/io/contpfs.c +++ b/src/libultra/io/contpfs.c @@ -1,8 +1,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - s32 __osPfsInodeCacheChannel = -1; u8 __osPfsInodeCacheBank = 250; diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 56ebf0a09a..bafb2ad40a 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -1,8 +1,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - s32 osContStartReadData(OSMesgQueue* mq) { s32 ret; diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index 97a33dc00f..588e2ae9ac 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -1,8 +1,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - OSPifRam __osContPifRam; u8 __osContLastCmd; u8 __osMaxControllers; // always 4 diff --git a/src/libultra/io/piacs.c b/src/libultra/io/piacs.c index 3b9af6d40a..84cc4246be 100644 --- a/src/libultra/io/piacs.c +++ b/src/libultra/io/piacs.c @@ -1,8 +1,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - u32 __osPiAccessQueueEnabled = false; static OSMesg piAccessBuf[1]; OSMesgQueue __osPiAccessQueue; diff --git a/src/libultra/io/siacs.c b/src/libultra/io/siacs.c index 480efd31ac..8359c1bdda 100644 --- a/src/libultra/io/siacs.c +++ b/src/libultra/io/siacs.c @@ -1,8 +1,6 @@ #include "array_count.h" #include "ultra64.h" -#include "macros.h" - static OSMesg siAccessBuf[1]; OSMesgQueue __osSiAccessQueue; u32 __osSiAccessQueueEnabled = false; diff --git a/src/libultra/io/vimgr.c b/src/libultra/io/vimgr.c index 1caf997d47..b4857c334a 100644 --- a/src/libultra/io/vimgr.c +++ b/src/libultra/io/vimgr.c @@ -3,8 +3,6 @@ #include "stack.h" #include "ultra64.h" -#include "macros.h" - static OSThread viThread; static STACK(viThreadStack, 0x1000); static OSMesgQueue viEventQueue; diff --git a/src/n64dd/n64dd_801C8940.c b/src/n64dd/n64dd_801C8940.c index a0f975c237..132222b689 100644 --- a/src/n64dd/n64dd_801C8940.c +++ b/src/n64dd/n64dd_801C8940.c @@ -4,8 +4,6 @@ #include "libc64/sleep.h" #include "attributes.h" -#include "global.h" - s32 D_801D2EA0 = 0; u8* D_801D2EA4 = NULL; s32 D_801D2EA8 = 0; diff --git a/src/n64dd/n64dd_801C9440.c b/src/n64dd/n64dd_801C9440.c index 2d0b1b5c01..ecab855d4a 100644 --- a/src/n64dd/n64dd_801C9440.c +++ b/src/n64dd/n64dd_801C9440.c @@ -1,5 +1,4 @@ // Some text-handling functions -#include "global.h" #include "n64dd.h" #include "versions.h" diff --git a/src/n64dd/n64dd_801CA0B0.c b/src/n64dd/n64dd_801CA0B0.c index a986346220..e3ba1be18d 100644 --- a/src/n64dd/n64dd_801CA0B0.c +++ b/src/n64dd/n64dd_801CA0B0.c @@ -4,8 +4,6 @@ #include "attributes.h" #include "array_count.h" -#include "global.h" - // Draws text to framebuffer typedef struct struct_801CA704 { /* 0x00 */ PrintCallback callback; diff --git a/src/n64dd/n64dd_data_buffer.c b/src/n64dd/n64dd_data_buffer.c index 6aacae2d57..d4dfeb3363 100644 --- a/src/n64dd/n64dd_data_buffer.c +++ b/src/n64dd/n64dd_data_buffer.c @@ -1,4 +1,3 @@ -#include "global.h" #include "n64dd.h" // Buffer used for reading from the disk? diff --git a/src/n64dd/n64dd_error_bodies.c b/src/n64dd/n64dd_error_bodies.c index 757e1afb6b..9c990d76bf 100644 --- a/src/n64dd/n64dd_error_bodies.c +++ b/src/n64dd/n64dd_error_bodies.c @@ -1,4 +1,3 @@ -#include "global.h" #include "n64dd.h" const char* D_801D2EE0[2][8][4] = { diff --git a/src/n64dd/n64dd_error_headers.c b/src/n64dd/n64dd_error_headers.c index b14d80fba5..ee7d611c21 100644 --- a/src/n64dd/n64dd_error_headers.c +++ b/src/n64dd/n64dd_error_headers.c @@ -1,4 +1,3 @@ -#include "global.h" #include "n64dd.h" // Padding in .rodata suggests that these are in a separate file diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 6ef8c9250c..3764381c19 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -11,7 +11,6 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" -#include "macros.h" #include "one_point_cutscene.h" #include "rand.h" #include "rumble.h" diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 1113a3926a..c8e6e15450 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -34,8 +34,6 @@ #include "z64save.h" #include "z64skin_matrix.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_mo/object_mo.h" diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 15ce257340..2d741172b2 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -23,8 +23,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #include "assets/objects/object_fr/object_fr.h" diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index cb120b20cc..0d03f72301 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -23,10 +23,6 @@ #include "z64player.h" #include "z64save.h" -#if PLATFORM_N64 -#include "global.h" -#endif - #include "assets/objects/object_zl2/object_zl2.h" #include "assets/objects/object_zl2_anime1/object_zl2_anime1.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 63b1e2401f..c3d9302ee8 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -7,7 +7,6 @@ #include "gfx_setupdl.h" #include "language_array.h" #include "letterbox.h" -#include "macros.h" #include "main.h" #include "map_select_state.h" #include "memory_utils.h" @@ -34,8 +33,6 @@ #include "z64ss_sram.h" #include "z64view.h" -#include "global.h" - #if OOT_PAL_N64 #include "assets/objects/object_mag/object_mag.h" #endif diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index dc3987acd0..03fb5d0f12 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -9,8 +9,6 @@ #include "z64save.h" #include "z64sram.h" -#include "macros.h" - // In iQue versions, this file contains many workarounds for EGCS internal // compiler errors (see docs/compilers.md) diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index 77de467bf3..bc7ae7edc1 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -16,9 +16,6 @@ #include "z64audio.h" #include "z64save.h" -#include "macros.h" -#include "global.h" - #include "assets/textures/title_static/title_static.h" #include "assets/overlays/ovl_file_choose/ovl_file_choose.h" diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 79f76c8614..84b1cb69ae 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -29,8 +29,6 @@ #include "z64save.h" #include "z64sram.h" -#include "macros.h" - void MapSelect_LoadTitle(MapSelectState* this) { this->state.running = false; SET_NEXT_GAMESTATE(&this->state, ConsoleLogo_Init, ConsoleLogoState); diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index bf5029cb2e..588588b243 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -29,8 +29,6 @@ #include "z64environment.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" #if DEBUG_FEATURES diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 2729bf54ee..2f086413bc 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -10,8 +10,6 @@ #include "z64play.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c index d6a8af68f5..c090b77fb9 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -12,8 +12,6 @@ #include "z64play.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #if OOT_NTSC #include "assets/textures/icon_item_jpn_static/icon_item_jpn_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index d07720d120..2e4bda50cb 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -27,8 +27,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/icon_item_static/icon_item_static.h" #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #if OOT_NTSC diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 126ceca4f1..ec2c566ece 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -7,8 +7,6 @@ #include "z_lib.h" #include "z64play.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.h" typedef struct PauseMapMarkInfo { diff --git a/tools/ZAPD/ZAPD/ZFile.cpp b/tools/ZAPD/ZAPD/ZFile.cpp index e59c50e67a..281e6132f7 100644 --- a/tools/ZAPD/ZAPD/ZFile.cpp +++ b/tools/ZAPD/ZAPD/ZFile.cpp @@ -810,7 +810,6 @@ void ZFile::GenerateSourceFiles() sourceOutput += "#include \"ultra64.h\"\n"; sourceOutput += "#include \"z64.h\"\n"; - sourceOutput += "#include \"macros.h\"\n"; sourceOutput += GetHeaderInclude(); bool hasZRoom = false; From a9b5aaadf0275dcfba9918ce8d7df46d73c8b6f7 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Mon, 28 Apr 2025 11:28:34 +0100 Subject: [PATCH 7/8] Add makefile dependencies for all build objects (#2517) * Add makefile dependencies for all build objects * Fix generating encoded message headers --- Makefile | 71 +++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index fb6be04879..6eae7800c0 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,6 @@ COMPILER ?= ido VERSION ?= gc-eu-mq-dbg # Number of threads to extract and compress with. N_THREADS ?= $(shell nproc) -# Check code syntax with host compiler. -RUN_CC_CHECK ?= 1 # If DEBUG_OBJECTS is 1, produce additional debugging files such as objdump output or raw binaries for assets DEBUG_OBJECTS ?= 0 # Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk! @@ -368,8 +366,8 @@ CPPFLAGS += -P -xc -fno-dollars-in-identifiers $(CPP_DEFINES) ASFLAGS += -march=vr4300 -32 -no-pad-sections -Iinclude -I$(EXTRACTED_DIR) ifeq ($(COMPILER),gcc) - CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) - CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections + CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc -MD $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) + CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc -MD $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections MIPS_VERSION := -mips3 else # Suppress warnings for wrong number of macro arguments (to fake variadic @@ -387,7 +385,7 @@ endif ifeq ($(COMPILER),ido) # Have CC_CHECK pretend to be a MIPS compiler MIPS_BUILTIN_DEFS := -D_MIPS_ISA_MIPS2=2 -D_MIPS_ISA=_MIPS_ISA_MIPS2 -D_ABIO32=1 -D_MIPS_SIM=_ABIO32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 - CC_CHECK = gcc -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D_LANGUAGE_C $(CPP_DEFINES) $(MIPS_BUILTIN_DEFS) $(GBI_DEFINES) $(INC) $(CHECK_WARNINGS) + CC_CHECK = gcc -nostdinc -MD -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D_LANGUAGE_C $(CPP_DEFINES) $(MIPS_BUILTIN_DEFS) $(GBI_DEFINES) $(INC) $(CHECK_WARNINGS) ifeq ($(shell getconf LONG_BIT), 32) # Work around memory allocation bug in QEMU export QEMU_GUEST_BASE := 1 @@ -396,7 +394,7 @@ ifeq ($(COMPILER),ido) CC_CHECK += -m32 endif else - RUN_CC_CHECK := 0 + CC_CHECK = @: endif OBJDUMP_FLAGS := -d -r -z -Mreg-names=32 @@ -468,7 +466,7 @@ SOUNDFONT_EXTRACT_XMLS := $(foreach dir,$(SOUNDFONT_EXTRACT_DIRS),$(wildcard $(d SOUNDFONT_BUILD_XMLS := $(foreach f,$(SOUNDFONT_XMLS),$(BUILD_DIR)/$f) $(foreach f,$(SOUNDFONT_EXTRACT_XMLS),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) SOUNDFONT_O_FILES := $(foreach f,$(SOUNDFONT_BUILD_XMLS),$(f:.xml=.o)) SOUNDFONT_HEADERS := $(foreach f,$(SOUNDFONT_BUILD_XMLS),$(f:.xml=.h)) -SOUNDFONT_DEP_FILES := $(foreach f,$(SOUNDFONT_O_FILES),$(f:.o=.d)) +SOUNDFONT_DEP_FILES := $(foreach f,$(SOUNDFONT_O_FILES),$(f:.o=.c.d)) SEQUENCE_FILES := $(foreach dir,$(SEQUENCE_DIRS),$(wildcard $(dir)/*.seq)) SEQUENCE_EXTRACT_FILES := $(foreach dir,$(SEQUENCE_EXTRACT_DIRS),$(wildcard $(dir)/*.seq)) @@ -502,7 +500,7 @@ OVL_RELOC_FILES := $(filter %_reloc.o,$(SPEC_O_FILES)) # Automatic dependency files # (Only asm_processor dependencies and reloc dependencies are handled for now) -DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) +DEP_FILES := $(O_FILES:.o=.d) $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) $(BUILD_DIR)/spec.d TEXTURE_FILES_PNG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.png)) TEXTURE_FILES_PNG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.png)) @@ -860,7 +858,7 @@ $(O_FILES): | asset_files .PHONY: o_files asset_files $(BUILD_DIR)/spec: $(SPEC) $(SPEC_INCLUDES) - $(CPP) $(CPPFLAGS) -I. $< | $(BUILD_DIR_REPLACE) > $@ + $(CPP) $(CPPFLAGS) -MD -MF $@.d -MT $@ -I. $< | $(BUILD_DIR_REPLACE) > $@ $(LDSCRIPT): $(BUILD_DIR)/spec $(MKLDSCRIPT) $< $@ @@ -872,7 +870,7 @@ $(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/% $(OBJCOPY) -I binary -O elf32-big $< $@ $(BUILD_DIR)/data/%.o: data/%.s - $(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@ + $(CPP) $(CPPFLAGS) -MD -MF $(@:.o=.d) -MT $@ -Iinclude $< | $(AS) $(ASFLAGS) -o $@ ifeq ($(PLATFORM),IQUE) NES_CHARMAP := assets/text/charmap.chn.txt @@ -881,24 +879,23 @@ else endif $(BUILD_DIR)/assets/text/%.enc.nes.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h $(NES_CHARMAP) - $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@ + $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) -MD -MF $(@:.o=.d) -MT $@ $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@ $(BUILD_DIR)/assets/text/%.enc.jpn.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.jpn.txt - $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@ + $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) -MD -MF $(@:.o=.d) -MT $@ $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@ -# Dependencies for files including message data headers -# TODO remove when full header dependencies are used. +# Dependencies for encoded message headers. These dependencies are not automatic as these headers are generated +# as part of the build. A clean build must know to generate them before the relevant .d files are created. $(BUILD_DIR)/assets/text/jpn_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.jpn.h $(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h $(BUILD_DIR)/assets/text/ger_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h $(BUILD_DIR)/assets/text/fra_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h $(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.nes.h -$(BUILD_DIR)/src/code/z_message.o: assets/text/message_data.h assets/text/message_data_staff.h $(BUILD_DIR)/assets/text/%.o: assets/text/%.c ifneq ($(COMPILER),gcc) # Preprocess text with modern cpp for varargs macros - $(CPP) -undef -D_LANGUAGE_C -D__sgi $(CPPFLAGS) $(INC) $< -o $(@:.o=.c) + $(CPP) -undef -D_LANGUAGE_C -D__sgi $(CPPFLAGS) -MD -MT $@ $(INC) $< -o $(@:.o=.c) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(@:.o=.c) else $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< @@ -906,17 +903,19 @@ endif $(OBJCOPY) -O binary --only-section .rodata $@ $@.bin $(BUILD_DIR)/assets/%.o: assets/%.c + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(OBJCOPY_CMD) $(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(OBJCOPY_CMD) # Assemble the ROM header with GNU AS always $(BUILD_DIR)/src/makerom/rom_header.o: src/makerom/rom_header.s ifeq ($(COMPILER),ido) - $(CPP) $(CPPFLAGS) $(MIPS_BUILTIN_DEFS) $(INC) $< | $(AS) $(ASFLAGS) -o $@ + $(CPP) $(CPPFLAGS) $(MIPS_BUILTIN_DEFS) $(INC) -MD -MF $(@:.o=.d) -MT $@ $< | $(AS) $(ASFLAGS) -o $@ else $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $< endif @@ -927,12 +926,15 @@ $(BUILD_DIR)/src/makerom/ipl3.o: $(EXTRACTED_DIR)/incbin/ipl3 $(BUILD_DIR)/src/%.o: src/%.s ifeq ($(COMPILER),ido) +# For header dependencies + $(CPP) $(MIPS_BUILTIN_DEFS) -x assembler-with-cpp $(INC) -MD -MF $(@:.o=.d) -MT $@ $< -o /dev/null $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $(@:.o=.tmp.o) $< # IDO generates bad symbol tables, fix the symbol table with strip.. $(STRIP) $(@:.o=.tmp.o) -N dummy-symbol-name # but strip doesn't know about file-relative offsets in .mdebug and doesn't relocate them, ld will # segfault unless .mdebug is removed $(OBJCOPY) --remove-section .mdebug $(@:.o=.tmp.o) $@ + @$(RM) $(@:.o=.tmp.o) else $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $< endif @@ -944,6 +946,8 @@ $(BUILD_DIR)/src/code/z_message_z_game_over.o: $(BUILD_DIR)/src/code/z_message.o $(LD) -r -G 0 -T linker_scripts/data_with_rodata.ld -o $@ $^ $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ +DEP_FILES += $(BUILD_DIR)/src/code/z_message.d $(BUILD_DIR)/src/code/z_game_over.d + $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR)/spec $(MKDMADATA) $< $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt @@ -951,34 +955,18 @@ $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR) $(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata_table_spec.h -# Dependencies for files including from include/tables/ -# TODO remove when full header dependencies are used. -$(BUILD_DIR)/src/code/graph.o: include/tables/gamestate_table.h -$(BUILD_DIR)/src/code/object_table.o: include/tables/object_table.h -$(BUILD_DIR)/src/code/z_actor.o: include/tables/actor_table.h # so uses of ACTOR_ID_MAX update when the table length changes -$(BUILD_DIR)/src/code/z_actor_dlftbls.o: include/tables/actor_table.h -$(BUILD_DIR)/src/code/z_effect_soft_sprite_dlftbls.o: include/tables/effect_ss_table.h -$(BUILD_DIR)/src/code/z_game_dlftbls.o: include/tables/gamestate_table.h -$(BUILD_DIR)/src/code/z_scene_table.o: include/tables/scene_table.h include/tables/entrance_table.h -$(BUILD_DIR)/src/audio/general.o: $(SEQUENCE_TABLE) include/tables/sfx/*.h -$(BUILD_DIR)/src/audio/sfx_params.o: include/tables/sfx/*.h - $(BUILD_DIR)/src/%.o: src/%.c -ifneq ($(RUN_CC_CHECK),0) - $(CC_CHECK) $< -endif + $(CC_CHECK) $< -o $@ $(PREPROCESS) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(POSTPROCESS_OBJ) $@ $(OBJDUMP_CMD) $(BUILD_DIR)/src/audio/session_init.o: src/audio/session_init.c $(BUILD_DIR)/assets/audio/soundfont_sizes.h $(BUILD_DIR)/assets/audio/sequence_sizes.h -ifneq ($(RUN_CC_CHECK),0) - $(CC_CHECK) $< -endif + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $< $(LD) -r -T linker_scripts/data_with_rodata.ld -o $@ $(@:.o=.tmp) $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ - @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) + $(OBJDUMP_CMD) ifeq ($(PLATFORM),IQUE) ifneq ($(NON_MATCHING),1) @@ -1075,11 +1063,12 @@ $(BUILD_DIR)/assets/audio/soundfonts/%.xml: $(EXTRACTED_DIR)/assets/audio/soundf $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.h $(BUILD_DIR)/assets/audio/soundfonts/%.name: $(BUILD_DIR)/assets/audio/soundfonts/%.xml | $(SAMPLEBANK_BUILD_XMLS) $(AIFC_FILES) # This rule can be triggered for either the .c or .h file, so $@ may refer to either the .c or .h file. A simple # substitution $(@:.c=.h) will fail ~50% of the time with -j. Instead, don't assume anything about the suffix of $@. - $(SFC) $(SFCFLAGS) --makedepend $(basename $@).d $< $(basename $@).c $(basename $@).h $(basename $@).name + $(SFC) $(SFCFLAGS) --makedepend $(basename $@).c.d $< $(basename $@).c $(basename $@).h $(basename $@).name -include $(SOUNDFONT_DEP_FILES) $(BUILD_DIR)/assets/audio/soundfonts/%.o: $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.name + $(CC_CHECK) -I include/audio $< -o $@ # compile c to unlinked object $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -I include/audio -o $(@:.o=.tmp) $< # partial link @@ -1100,11 +1089,11 @@ endif # then assemble the sequences... $(BUILD_DIR)/assets/audio/sequences/%.o: assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS) - $(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@ + $(SEQ_CPP) $(SEQ_CPPFLAGS) -MD -MT $@ $< -o $(@:.o=.s) $(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@ $(BUILD_DIR)/assets/audio/sequences/%.o: $(EXTRACTED_DIR)/assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS) - $(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@ + $(SEQ_CPP) $(SEQ_CPPFLAGS) -MD -MT $@ $< -o $(@:.o=.s) $(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@ ifeq ($(AUDIO_BUILD_DEBUG),1) $(OBJCOPY) -O binary -j.data $@ $(@:.o=.aseq) @@ -1138,9 +1127,7 @@ $(BUILD_DIR)/src/audio/tables/sequence_table.o: src/audio/tables/sequence_table. $(BUILD_DIR)/src/audio/tables/sequence_table.o: CFLAGS += -I include/tables $(BUILD_DIR)/src/audio/tables/%.o: src/audio/tables/%.c -ifneq ($(RUN_CC_CHECK),0) - $(CC_CHECK) $< -endif + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $< $(LD) -r -T linker_scripts/data_with_rodata.ld $(@:.o=.tmp) -o $@ $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ From cfd23f9cd253f431c65d540608e4e42d10212417 Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Mon, 28 Apr 2025 22:08:55 +0100 Subject: [PATCH 8/8] Use cpp for soundfont dependencies (#2519) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6eae7800c0..83ea16fb6f 100644 --- a/Makefile +++ b/Makefile @@ -927,7 +927,7 @@ $(BUILD_DIR)/src/makerom/ipl3.o: $(EXTRACTED_DIR)/incbin/ipl3 $(BUILD_DIR)/src/%.o: src/%.s ifeq ($(COMPILER),ido) # For header dependencies - $(CPP) $(MIPS_BUILTIN_DEFS) -x assembler-with-cpp $(INC) -MD -MF $(@:.o=.d) -MT $@ $< -o /dev/null + $(CPP) $(MIPS_BUILTIN_DEFS) $(CPPFLAGS) -x assembler-with-cpp $(INC) -MD -MF $(@:.o=.d) -MT $@ $< -o /dev/null $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $(@:.o=.tmp.o) $< # IDO generates bad symbol tables, fix the symbol table with strip.. $(STRIP) $(@:.o=.tmp.o) -N dummy-symbol-name @@ -1068,7 +1068,7 @@ $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%. -include $(SOUNDFONT_DEP_FILES) $(BUILD_DIR)/assets/audio/soundfonts/%.o: $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.name - $(CC_CHECK) -I include/audio $< -o $@ + $(CPP) $(MIPS_BUILTIN_DEFS) $(CPPFLAGS) -x assembler-with-cpp $(INC) -I include/audio -MD -MF $(@:.o=.d) -MT $@ $< -o /dev/null # compile c to unlinked object $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -I include/audio -o $(@:.o=.tmp) $< # partial link