From bececbff99bd2bb208a811c100c8f79ebbecc77d Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Thu, 26 Dec 2024 07:14:55 -0800 Subject: main OK (#234) * main OK * gSegments -> SegmentBaseAddress * newline * format --- src/boot/idle.c | 2 +- src/code/c_keyframe.c | 26 ++--- src/code/m_actor.c | 12 +-- src/code/m_scene.c | 2 +- src/code/main.c | 120 +++++++++++++++++++++-- src/code/sys_stacks.c | 7 ++ src/overlays/actors/ovl_Dump/ac_dump.c | 2 +- src/overlays/actors/ovl_Goza/ac_goza.c | 2 +- src/overlays/actors/ovl_Kago/ac_kago.c | 2 +- src/overlays/actors/ovl_Koinobori/ac_koinobori.c | 8 +- src/overlays/actors/ovl_Mikuji/ac_mikuji.c | 2 +- src/overlays/actors/ovl_Radio/ac_radio.c | 2 +- src/overlays/actors/ovl_Tama/ac_tama.c | 2 +- src/overlays/actors/ovl_Toudai/ac_toudai.c | 6 +- src/overlays/actors/ovl_Weather/ac_weather.c | 4 +- src/overlays/gamestates/ovl_cpedit/m_cpedit.c | 2 +- src/overlays/gamestates/ovl_play/m_play.c | 10 +- 17 files changed, 160 insertions(+), 51 deletions(-) create mode 100644 src/code/sys_stacks.c (limited to 'src') diff --git a/src/boot/idle.c b/src/boot/idle.c index 003c44d..ba550c4 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -26,7 +26,7 @@ void Main_ThreadEntry(void* arg) { DmaMgr_RequestSyncDebug(SEGMENT_VRAM_START(code), SEGMENT_ROM_START(code), SEGMENT_ROM_SIZE_ALT(code), "../idle.c", 53); bzero(SEGMENT_BSS_START(code), SEGMENT_BSS_SIZE(code)); - func_800D66D0_jp(arg); + mainproc(arg); DmaMgr_Stop(); } diff --git a/src/code/c_keyframe.c b/src/code/c_keyframe.c index eec880c..ce90cef 100644 --- a/src/code/c_keyframe.c +++ b/src/code/c_keyframe.c @@ -718,13 +718,13 @@ void cKF_SkeletonInfo_R_init_reverse_setspeedandmorphandmode(SkeletonInfoR* skel void func_80053384_jp(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, UNK_PTR* arg6, UNK_PTR* arg7, UNK_PTR* arg8) { if (arg3 != 0) { - gSegments[arg0] = (uintptr_t)OS_K0_TO_PHYSICAL(arg6); + SegmentBaseAddress[arg0] = (uintptr_t)OS_K0_TO_PHYSICAL(arg6); } if (arg4 != 0) { - gSegments[arg1] = (uintptr_t)OS_K0_TO_PHYSICAL(arg7); + SegmentBaseAddress[arg1] = (uintptr_t)OS_K0_TO_PHYSICAL(arg7); } if (arg5 != 0) { - gSegments[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg8); + SegmentBaseAddress[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg8); } } @@ -887,14 +887,14 @@ s32 cKF_SkeletonInfo_R_combine_play(SkeletonInfoR* skeletonInfo1, SkeletonInfoR* joint = (!IS_ZERO(skeletonInfo1->morphCounter)) ? (s16*)skeletonInfo1->morphTable : (s16*)skeletonInfo1->jointTable; if (arg4 != 0) { - sp44 = OS_PHYSICAL_TO_K0(gSegments[arg2]); - gSegments[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg4); + sp44 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg2]); + SegmentBaseAddress[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg4); cKF_SkeletonInfo_R_combine_work_set(&combine3, skeletonInfo1); } if (arg5 != 0) { - sp40 = OS_PHYSICAL_TO_K0(gSegments[arg3]); - gSegments[arg3] = (uintptr_t)OS_K0_TO_PHYSICAL(arg5); + sp40 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg3]); + SegmentBaseAddress[arg3] = (uintptr_t)OS_K0_TO_PHYSICAL(arg5); cKF_SkeletonInfo_R_combine_work_set(&combine2, skeletonInfo2); cKF_SkeletonInfo_R_combine_work_set(&combine1, skeletonInfo2); } @@ -965,18 +965,18 @@ void cKF_SkeletonInfo_R_T_combine_play(s32* arg0, s32* arg1, s32* arg2, Skeleton spAC = (!IS_ZERO(skeletonInfo1->morphCounter)) ? (s16*)skeletonInfo1->morphTable : (s16*)skeletonInfo1->jointTable; if (arg9 != 0) { - sp48 = OS_PHYSICAL_TO_K0(gSegments[arg6]); - gSegments[arg6] = (uintptr_t)OS_K0_TO_PHYSICAL(arg9); + sp48 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg6]); + SegmentBaseAddress[arg6] = (uintptr_t)OS_K0_TO_PHYSICAL(arg9); cKF_SkeletonInfo_R_combine_work_set(&sp4C, skeletonInfo1); } if (argA != 0) { - sp44 = OS_PHYSICAL_TO_K0(gSegments[arg7]); - gSegments[arg7] = (uintptr_t)OS_K0_TO_PHYSICAL(argA); + sp44 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg7]); + SegmentBaseAddress[arg7] = (uintptr_t)OS_K0_TO_PHYSICAL(argA); cKF_SkeletonInfo_R_combine_work_set(&sp6C, skeletonInfo2); } if (argB != 0) { - sp40 = OS_PHYSICAL_TO_K0(gSegments[arg8]); - gSegments[arg8] = (uintptr_t)OS_K0_TO_PHYSICAL(argB); + sp40 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg8]); + SegmentBaseAddress[arg8] = (uintptr_t)OS_K0_TO_PHYSICAL(argB); cKF_SkeletonInfo_R_combine_work_set(&sp8C, skeletonInfo3); } diff --git a/src/code/m_actor.c b/src/code/m_actor.c index 8995617..e59d78f 100644 --- a/src/code/m_actor.c +++ b/src/code/m_actor.c @@ -192,7 +192,7 @@ void Actor_ct(Actor* actor, Game_Play* game_play) { Shape_Info_init(actor, 0.0f, NULL, 0.0f, 0.0f); if (Actor_data_bank_dma_end_check(actor, game_play) == 1) { - gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_a0->status[actor->unk_026].segment); + SegmentBaseAddress[6] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_a0->status[actor->unk_026].segment); actor->ct(actor, game_play); actor->ct = NULL; } @@ -263,7 +263,7 @@ void Actor_draw(Game_Play* game_play, Actor* actor) { { void* segment = game_play->objectExchangeBank.status[(void)0, actor->unk_026].segment; - gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(segment); + SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(segment); gSPSegment(POLY_OPA_DISP++, 0x06, segment); gSPSegment(POLY_XLU_DISP++, 0x06, segment); @@ -441,7 +441,7 @@ void Actor_info_call_actor(Game_Play* game_play, ActorInfo* actorInfo) { if (actor->ct != NULL) { if (Actor_data_bank_dma_end_check(actor, game_play) == 1) { - gSegments[6] = + SegmentBaseAddress[6] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->objectExchangeBank.status[actor->unk_026].segment); game_play->state.unk_9D = 0x98; @@ -478,7 +478,7 @@ void Actor_info_call_actor(Game_Play* game_play, ActorInfo* actorInfo) { actor->flags &= ~ACTOR_FLAG_1000000; if ((actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_10)) || (actor->part == ACTOR_PART_NPC)) { - gSegments[6] = + SegmentBaseAddress[6] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->objectExchangeBank.status[actor->unk_026].segment); game_play->state.unk_9D = 0xA1; actor->update(actor, game_play); @@ -833,9 +833,9 @@ Actor* Actor_info_make_actor(ActorInfo* actorInfo, Game_Play* game_play, s16 act { uintptr_t segmentTemp; - segmentTemp = gSegments[6]; + segmentTemp = SegmentBaseAddress[6]; Actor_ct(sp68, game_play); - gSegments[6] = segmentTemp; + SegmentBaseAddress[6] = segmentTemp; } return sp68; diff --git a/src/code/m_scene.c b/src/code/m_scene.c index f47457a..024d459 100644 --- a/src/code/m_scene.c +++ b/src/code/m_scene.c @@ -448,7 +448,7 @@ void mSc_data_bank_ct(Game_Play* game_play, ObjectExchangeBank* objectExchangeBa objectExchangeBank->unk1810[0] = temp_v0; objectExchangeBank->unk1810[1] = temp_v0; func_800C5B74_jp(objectExchangeBank, GAMEPLAY_KEEP); - gSegments[4] = (uintptr_t)OS_PHYSICAL_TO_K0(objectExchangeBank->status[0].segment); + SegmentBaseAddress[4] = (uintptr_t)OS_PHYSICAL_TO_K0(objectExchangeBank->status[0].segment); } void mSc_decide_exchange_bank(ObjectExchangeBank* objectExchangeBank) { diff --git a/src/code/main.c b/src/code/main.c index 3dd5e37..0cd4e26 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -1,13 +1,36 @@ #include "main.h" -#include "zurumode.h" -#include "fault.h" +#include "6FB340.h" +#include "6FD190.h" +#include "audioMgr.h" #include "code_variables.h" -#include "macros.h" +#include "fault.h" #include "game.h" -#include "audioMgr.h" +#include "getcurrentms.h" #include "graph.h" +#include "irqmgr.h" +#include "libu64/stackcheck.h" #include "m_debug.h" -#include "getcurrentms.h" +#include "m_flashrom.h" +#include "m_thread.h" +#include "macros.h" +#include "padmgr.h" +#include "segment_symbols.h" +#include "sys_initial_check.h" +#include "sys_stacks.h" +#include "system_heap.h" +#include "zurumode.h" + +OSThread graphThread; +StackEntry graphStackInfo; +StackEntry schedStackInfo; +StackEntry audioStackInfo; +StackEntry padmgrStackInfo; +StackEntry irqmgrStackInfo; +OSMesgQueue l_serialMsgQ; +OSMesg serialMsgBuf[1]; +size_t gSystemHeapSize; + +uintptr_t SegmentBaseAddress[NUM_SEGMENTS]; void func_800D64E0_jp(void) { u32 baseTime; @@ -35,8 +58,8 @@ void func_800D64E0_jp(void) { if ((graphReg != 0) || (audioReg != 0)) { FaultDrawer_SetDrawerFB(osViGetCurrentFramebuffer(), SCREEN_WIDTH, SCREEN_HEIGHT); - FaultDrawer_SetForeColor(65535); - FaultDrawer_SetBackColor(32769); + FaultDrawer_SetForeColor(GPACK_RGBA5551(255, 255, 255, 1)); + FaultDrawer_SetBackColor(GPACK_RGBA5551(128, 0, 0, 1)); FaultDrawer_SetCharPad(0, 0); if (graphReg != 0) { unk9D = (game_class_p != NULL) ? game_class_p->unk_9D : 0; @@ -44,16 +67,93 @@ void func_800D64E0_jp(void) { unk9C = (game_class_p != NULL) ? game_class_p->unk_9C : 0; FaultDrawer_DrawText(24, 16, "GRAPH INF.LOOP %2d %3d %3d %6lu", B_80145370_jp, unk9D, unk9C, graphTime); - fault_DrawStackTrace(&graphThread, 0x20, 0x1A, 0xA); + fault_DrawStackTrace(&graphThread, 32, 26, 10); } if (audioReg != 0) { FaultDrawer_DrawText(24, 126, "AUDIO INF.LOOP %2d %3d %6lu", audiomgr_class.unk_28A, D_80113854_jp, audioTime); - fault_DrawStackTrace(&audiomgr_class.thread, 0x20, 0x88, 0xA); + fault_DrawStackTrace(&audiomgr_class.thread, 32, 136, 10); } FaultDrawer_WritebackFBDCache(); } } } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/main/func_800D66D0_jp.s") +void mainproc(void* arg) { + IrqmgrClient client; + OSMesgQueue irqMsgQueue; + OSMesg irqMsgBuf[10]; + uintptr_t fb; + uintptr_t sysHeap; + s16* msg; + + ScreenWidth = SCREEN_WIDTH; + ScreenHeight = SCREEN_HEIGHT; + + fault_Init(); + Check_RegionIsSupported(); + + fb = func_800D94F0_jp(); + sysHeap = (uintptr_t)SEGMENT_VRAM_END(buffers); + gSystemHeapSize = fb - sysHeap; + SystemHeap_Init((void*)sysHeap, gSystemHeapSize); + + func_800D9524_jp(); + + func_800D955C_jp(0); + func_800D955C_jp(1); + func_800D955C_jp(2); + func_800D955C_jp(3); + + func_8008EE24_jp(); + + new_Debug_mode(); + SREG(0) = 0; + + osCreateMesgQueue(&l_serialMsgQ, serialMsgBuf, ARRAY_COUNT(serialMsgBuf)); + osSetEventMesg(OS_EVENT_SI, &l_serialMsgQ, NULL); + + osCreateMesgQueue(&irqMsgQueue, irqMsgBuf, ARRAY_COUNT(irqMsgBuf)); + StackCheck_Init(&irqmgrStackInfo, irqmgrStack, STACK_TOP(irqmgrStack), 0, 0x100, "irqmgr"); + CreateIRQManager(STACK_TOP(irqmgrStack), M_PRIORITY_IRQMGR, 1); + + StackCheck_Init(&schedStackInfo, schedStack, STACK_TOP(schedStack), 0, 0x100, "sched"); + func_800D87C0_jp(STACK_TOP(schedStack), M_PRIORITY_SCHED); + + irqmgr_AddClient(&client, &irqMsgQueue); + + StackCheck_Init(&audioStackInfo, audioStack, STACK_TOP(audioStack), 0, 0x100, "audio"); + func_800D2AD0_jp(STACK_TOP(audioStack), M_PRIORITY_AUDIOMGR, M_THREAD_ID_AUDIOMGR); + + StackCheck_Init(&padmgrStackInfo, padmgrStack, STACK_TOP(padmgrStack), 0, 0x100, "padmgr"); + padmgr_Init(&l_serialMsgQ, 7, M_PRIORITY_PADMGR, STACK_TOP(padmgrStack)); + + func_800D2AA0_jp(); + + StackCheck_Init(&graphStackInfo, &graphStack, STACK_TOP(graphStack), 0, 0x100, "graph"); + osCreateThread(&graphThread, M_THREAD_ID_GRAPH, graph_proc, arg, STACK_TOP(graphStack), M_PRIORITY_GRAPH); + osStartThread(&graphThread); + + osSetThreadPri(NULL, M_PRIORITY_MAIN_HIGH); + + while (true) { + msg = NULL; + + while (irqMsgQueue.validCount != 0) { + osRecvMesg(&irqMsgQueue, NULL, OS_MESG_NOBLOCK); + } + + osRecvMesg(&irqMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK); + if (msg == NULL) { + break; + } + + switch (*msg) { + case OS_SC_RETRACE_MSG: + if ((zurumode_flag != 0) && (fault_class.msgId == 0) && (D_8010F3E8_jp != 0)) { + func_800D64E0_jp(); + } + break; + } + } +} diff --git a/src/code/sys_stacks.c b/src/code/sys_stacks.c new file mode 100644 index 0000000..2a31d95 --- /dev/null +++ b/src/code/sys_stacks.c @@ -0,0 +1,7 @@ +#include "sys_stacks.h" + +STACK(graphStack, 0x1800); +STACK(schedStack, 0x600); +STACK(audioStack, 0x800); +STACK(padmgrStack, 0x500); +STACK(irqmgrStack, 0x500); diff --git a/src/overlays/actors/ovl_Dump/ac_dump.c b/src/overlays/actors/ovl_Dump/ac_dump.c index 9897276..a58e8d1 100644 --- a/src/overlays/actors/ovl_Dump/ac_dump.c +++ b/src/overlays/actors/ovl_Dump/ac_dump.c @@ -186,7 +186,7 @@ void aDUM_actor_draw(UNUSED Actor* thisx, Game_Play* game_play) { OPEN_POLY_OPA_DISP(gfxCtx); gSPSegment(__polyOpa++, 0x08, palette); - gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); + SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); gSPSegment(__polyOpa++, 0x06, object); Matrix_translate(-6000.0f, 0.0f, -10000.0f, 1); diff --git a/src/overlays/actors/ovl_Goza/ac_goza.c b/src/overlays/actors/ovl_Goza/ac_goza.c index 59adcc8..d3a4f37 100644 --- a/src/overlays/actors/ovl_Goza/ac_goza.c +++ b/src/overlays/actors/ovl_Goza/ac_goza.c @@ -150,7 +150,7 @@ void aGOZ_actor_draw(Actor* thisx UNUSED, Game_Play* game_play) { OPEN_SHADOW_DISP(gfxCtx); gSPSegment(__shadow_gfx++, G_MWO_SEGMENT_8, palette); - gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); + SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); gSPSegment(__shadow_gfx++, G_MWO_SEGMENT_6, object); gDPSetPrimColor(__shadow_gfx++, 0, 0x80, 255, 255, 255, 255); diff --git a/src/overlays/actors/ovl_Kago/ac_kago.c b/src/overlays/actors/ovl_Kago/ac_kago.c index 60867fb..de03554 100644 --- a/src/overlays/actors/ovl_Kago/ac_kago.c +++ b/src/overlays/actors/ovl_Kago/ac_kago.c @@ -125,7 +125,7 @@ void aKAG_actor_draw(Actor* thisx, Game_Play* game_play) { _texture_z_light_fog_prim(gfxCtx); OPEN_POLY_OPA_DISP(gfxCtx); gSPSegment(__polyOpa++, 0x08, palette); - gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); + SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); gSPSegment(__polyOpa++, 0x06, object); gSPMatrix(__polyOpa++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(__polyOpa++, model[this->structureActor.unk_2B4]); diff --git a/src/overlays/actors/ovl_Koinobori/ac_koinobori.c b/src/overlays/actors/ovl_Koinobori/ac_koinobori.c index c92b162..8b5511d 100644 --- a/src/overlays/actors/ovl_Koinobori/ac_koinobori.c +++ b/src/overlays/actors/ovl_Koinobori/ac_koinobori.c @@ -44,7 +44,8 @@ ShadowData aKOI_shadow_data = { 8, aKOI_shadow_vtx_fix_flg_table, 60.0f, obj_e_k void aKOI_actor_ct(Actor* thisx, Game_Play* game_play UNUSED) { Koinobori* this = THIS; - gSegments[6] = OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_KOINOBORI)); + SegmentBaseAddress[6] = + OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_KOINOBORI)); cKF_SkeletonInfo_R_ct(&this->structureActor.skeletonInfo, &cKF_bs_r_obj_e_koinobori, 0, this->structureActor.jointTable, this->structureActor.morphTable); aKOI_set_bgOffset(this, 1); @@ -101,7 +102,8 @@ void aKOI_actor_move(Actor* thisx, Game_Play* game_play) { return; } - gSegments[6] = OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_KOINOBORI)); + SegmentBaseAddress[6] = + OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_KOINOBORI)); cKF_SkeletonInfo_R_play(&this->structureActor.skeletonInfo); ((KoinoboriActionFunc)this->structureActor.process)(this, game_play); sAdo_OngenPos((uintptr_t)this, 0x35, &this->structureActor.actor.world.pos); @@ -137,7 +139,7 @@ void aKOI_actor_draw(Actor* thisx, Game_Play* game_play) { gSPSegment(__polyOpa++, 0x08, palette); gSPSegment(__polyOpa++, 0x09, Lib_SegmentedToVirtual(&obj_e_koinobori_b_pal)); gSPSegment(__polyOpa++, 0x0A, Lib_SegmentedToVirtual(&aKOI_obj_e_koinobori_a_pal)); - gSegments[6] = OS_K0_TO_PHYSICAL(object); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(object); gSPSegment(__polyOpa++, 0x06, object); CLOSE_POLY_OPA_DISP(gfxCtx); cKF_Si3_draw_R_SV(game_play, &this->structureActor.skeletonInfo, mtx, NULL, NULL, this); diff --git a/src/overlays/actors/ovl_Mikuji/ac_mikuji.c b/src/overlays/actors/ovl_Mikuji/ac_mikuji.c index bf34f3c..552acce 100644 --- a/src/overlays/actors/ovl_Mikuji/ac_mikuji.c +++ b/src/overlays/actors/ovl_Mikuji/ac_mikuji.c @@ -145,7 +145,7 @@ void aMIK_actor_draw(UNUSED Actor* actor, Game_Play* play) { _texture_z_light_fog_prim_npc(graph); OPEN_POLY_OPA_DISP(graph); gSPSegment(__polyOpa++, G_MWO_SEGMENT_8, pal); - gSegments[6] = OS_K0_TO_PHYSICAL(obj); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(obj); gSPSegment(__polyOpa++, G_MWO_SEGMENT_6, obj); gSPMatrix(__polyOpa++, cur, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Radio/ac_radio.c b/src/overlays/actors/ovl_Radio/ac_radio.c index 30108c9..3adca63 100644 --- a/src/overlays/actors/ovl_Radio/ac_radio.c +++ b/src/overlays/actors/ovl_Radio/ac_radio.c @@ -121,7 +121,7 @@ void aRAD_actor_draw(UNUSED Actor* thisx, Game_Play* game_play) { _texture_z_light_fog_prim_npc(gfxCtx); OPEN_POLY_OPA_DISP(gfxCtx); gSPSegment(__polyOpa++, 0x08, palette); - gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); + SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); gSPSegment(__polyOpa++, 0x06, object); gSPMatrix(__polyOpa++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(__polyOpa++, &aRAD_model); diff --git a/src/overlays/actors/ovl_Tama/ac_tama.c b/src/overlays/actors/ovl_Tama/ac_tama.c index bb1b2ec..dedd988 100644 --- a/src/overlays/actors/ovl_Tama/ac_tama.c +++ b/src/overlays/actors/ovl_Tama/ac_tama.c @@ -110,7 +110,7 @@ void aTAM_actor_draw(Actor* thisx, Game_Play* game_play) { OPEN_POLY_OPA_DISP(gfxCtx); gSPSegment(__polyOpa++, 0x08, palette); - gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); + SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object); gSPSegment(__polyOpa++, 0x06, object); Matrix_translate(0.0f, 0.0f, 4000.0f, 1); mtx = _Matrix_to_Mtx_new(gfxCtx); diff --git a/src/overlays/actors/ovl_Toudai/ac_toudai.c b/src/overlays/actors/ovl_Toudai/ac_toudai.c index 16cced7..3097bdb 100644 --- a/src/overlays/actors/ovl_Toudai/ac_toudai.c +++ b/src/overlays/actors/ovl_Toudai/ac_toudai.c @@ -52,7 +52,7 @@ void aTOU_actor_ct(Actor* thisx, Game_Play* game_play UNUSED) { static BaseSkeletonR* skl[] = { &cKF_bs_r_obj_s_toudai, &cKF_bs_r_obj_w_toudai }; s32 type = (common_data.time.season == WINTER); - gSegments[6] = OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_TOUDAI)); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_TOUDAI)); cKF_SkeletonInfo_R_ct(&this->structureActor.skeletonInfo, skl[type], NULL, this->structureActor.jointTable, this->structureActor.morphTable); aTOU_set_bgOffset(this, 1); @@ -190,7 +190,7 @@ void aTOU_setup_action(Toudai* this, s32 processIndex) { void aTOU_actor_move(Actor* thisx, Game_Play* game_play) { Toudai* this = THIS; - gSegments[6] = OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_TOUDAI)); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(common_data.clip.structureClip->getObjectSegment(STRUCTURE_TYPE_TOUDAI)); this->structureActor.unk_174 = cKF_SkeletonInfo_R_play(&this->structureActor.skeletonInfo); this->structureActor.unk_1E8 = this->structureActor.skeletonInfo.frameControl.currentFrame; ((ToudaiActionFunc)this->structureActor.process)(this, game_play); @@ -276,7 +276,7 @@ void aTOU_actor_draw(Actor* thisx, Game_Play* game_play) { _texture_z_light_fog_prim_npc(gfxCtx); OPEN_POLY_OPA_DISP(gfxCtx); gSPSegment(__polyOpa++, 0x8, palette); - gSegments[6] = OS_K0_TO_PHYSICAL(object); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(object); gSPSegment(__polyOpa++, 0x6, object); CLOSE_POLY_OPA_DISP(gfxCtx); diff --git a/src/overlays/actors/ovl_Weather/ac_weather.c b/src/overlays/actors/ovl_Weather/ac_weather.c index ebbc4d4..12fa5eb 100644 --- a/src/overlays/actors/ovl_Weather/ac_weather.c +++ b/src/overlays/actors/ovl_Weather/ac_weather.c @@ -494,7 +494,7 @@ void aWeather_DrawWeatherPrv(Actor* thisx, Game_Play* play) { s32 i; _texture_z_light_fog_prim_xlu(play->state.gfxCtx); - gSegments[6] = OS_K0_TO_PHYSICAL(this->segment); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(this->segment); OPEN_DISPS(play->state.gfxCtx); @@ -537,7 +537,7 @@ void aWeather_MoveWeatherPrv(Weather* this, Game_Play* play) { s32 i; if ((this->currentProfile != NULL) && (priv != NULL) && (this->currentProfile->mv != NULL)) { - gSegments[6] = OS_K0_TO_PHYSICAL(this->segment); + SegmentBaseAddress[6] = OS_K0_TO_PHYSICAL(this->segment); OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/gamestates/ovl_cpedit/m_cpedit.c b/src/overlays/gamestates/ovl_cpedit/m_cpedit.c index 7b8fa00..55dc518 100644 --- a/src/overlays/gamestates/ovl_cpedit/m_cpedit.c +++ b/src/overlays/gamestates/ovl_cpedit/m_cpedit.c @@ -34,7 +34,7 @@ void func_80804930_jp(Game_CPEdit* edit) { SET_NEXT_GAMESTATE((Game*)edit, trademark_init, sizeof(Game_Trademark)); } - gSegments[4] = OS_K0_TO_PHYSICAL(segment); + SegmentBaseAddress[4] = OS_K0_TO_PHYSICAL(segment); OPEN_DISPS(graph); diff --git a/src/overlays/gamestates/ovl_play/m_play.c b/src/overlays/gamestates/ovl_play/m_play.c index 1cbd4a2..44dea63 100644 --- a/src/overlays/gamestates/ovl_play/m_play.c +++ b/src/overlays/gamestates/ovl_play/m_play.c @@ -482,8 +482,8 @@ void Game_play_move(Game_Play* game_play) { game_play->state.unk_9D = 0x8D; game_play->state.unk_9C = 1; Game_play_Reset_destiny(); - gSegments[4] = (uintptr_t)OS_K0_TO_PHYSICAL(p->status[0].segment); - gSegments[2] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_010C); + SegmentBaseAddress[4] = (uintptr_t)OS_K0_TO_PHYSICAL(p->status[0].segment); + SegmentBaseAddress[2] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_010C); game_play->state.unk_9C = 2; if (zurumode_flag >= 2) { @@ -536,8 +536,8 @@ void Game_play_move(Game_Play* game_play) { void func_80803810_jp(Game_Play* game_play, GraphicsContext* gfxCtx) { void* temp_v0 = game_play->objectExchangeBank.status[0].segment; - gSegments[4] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_v0); - gSegments[2] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_010C); + SegmentBaseAddress[4] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_v0); + SegmentBaseAddress[2] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_010C); OPEN_DISPS(gfxCtx); @@ -861,7 +861,7 @@ void Gameplay_Scene_Read(Game_Play* game_play, s16 arg1) { game_play->unk_00E0 = arg1; game_play->unk_010C = func_80804138_jp(game_play, sp1C); sp1C->unk_13 = 0; - gSegments[2] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_010C); + SegmentBaseAddress[2] = (uintptr_t)OS_K0_TO_PHYSICAL(game_play->unk_010C); Gameplay_Scene_Init(game_play); sAdo_RoomType(mPl_SceneNo2SoundRoomType(common_data.save.sceneNo)); } -- cgit v1.2.3