diff --git a/include/macros.h b/include/macros.h index dde994eb3b..7c964150e7 100644 --- a/include/macros.h +++ b/include/macros.h @@ -5,9 +5,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 CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask)) #endif 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 84ccf10d8e..29a5404ed6 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -49,12 +49,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 dd0c19cc9f..9446123484 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2164,7 +2164,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 abbf987733..60a20e0ed8 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -585,9 +585,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)) { @@ -1146,9 +1146,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); @@ -1607,7 +1607,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 63b5d7f760..da2ddf6486 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -109,7 +109,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) { @@ -265,7 +265,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 0cddaa3888..34c3b46a4d 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -3663,7 +3663,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)) {