From e48cdaf598fd400d2543d7738a0516e3e3ee533c Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 9 Feb 2024 00:40:08 +1100 Subject: [PATCH] Match Retail Kaleido Code Files (#1702) * OK * PR Review --- src/code/z_kaleido_manager.c | 3 ++- src/code/z_kaleido_scope_call.c | 8 +++++++- src/code/z_kaleido_setup.c | 25 +++++++++++-------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 35a6bc4a7c..6792b34f92 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -80,9 +80,10 @@ void KaleidoManager_Destroy(void) { void* KaleidoManager_GetRamAddr(void* vram) { KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl; KaleidoMgrOverlay* ovl = iter; - u32 i; if (ovl == NULL) { + u32 i; + iter = &gKaleidoMgrOverlayTable[0]; for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) { if (((uintptr_t)vram >= (uintptr_t)iter->vramStart) && ((uintptr_t)iter->vramEnd >= (uintptr_t)vram)) { diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 79d9242f4c..be1d9aa59e 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -56,19 +56,25 @@ void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; PauseContext* pauseCtx = &play->pauseCtx; - if (IS_PAUSED(pauseCtx)) { + if (IS_PAUSED(&play->pauseCtx)) { if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { if (Letterbox_GetSize() == 0) { +#if OOT_DEBUG R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; +#endif + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_1EC = 0; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER } } else if (pauseCtx->state == PAUSE_STATE_8) { +#if OOT_DEBUG R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; +#endif + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_1EC = 0; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 6585ea54f1..871adabf13 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -20,7 +20,7 @@ void KaleidoSetup_Update(PlayState* play) { (play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) { if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - if (BREG(0)) { + if (OOT_DEBUG && BREG(0)) { pauseCtx->debugState = 3; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { @@ -65,23 +65,20 @@ void KaleidoSetup_Update(PlayState* play) { void KaleidoSetup_Init(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; - u64 temp = 0; // Necessary to match pauseCtx->state = PAUSE_STATE_OFF; pauseCtx->debugState = 0; - pauseCtx->alpha = 0; - pauseCtx->unk_1EA = 0; - pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; - pauseCtx->mode = 0; - pauseCtx->pageIndex = PAUSE_ITEM; - pauseCtx->unk_1F4 = 160.0f; - pauseCtx->unk_1F8 = 160.0f; - pauseCtx->unk_1FC = 160.0f; - pauseCtx->unk_200 = 160.0f; + pauseCtx->eye.x = pauseCtx->eye.y = 0.0f; pauseCtx->eye.z = 64.0f; pauseCtx->unk_1F0 = 936.0f; - pauseCtx->eye.x = pauseCtx->eye.y = 0.0f; + pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f; + + pauseCtx->alpha = 0; + + // mainState = PAUSE_MAIN_STATE_IDLE , pageIndex = PAUSE_ITEM + pauseCtx->unk_1EA = pauseCtx->mainState = pauseCtx->mode = pauseCtx->pageIndex = 0; + pauseCtx->unk_204 = -314.0f; pauseCtx->cursorPoint[PAUSE_ITEM] = 0; @@ -94,8 +91,8 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->cursorY[PAUSE_ITEM] = 0; pauseCtx->cursorX[PAUSE_MAP] = 0; pauseCtx->cursorY[PAUSE_MAP] = 0; - pauseCtx->cursorX[PAUSE_QUEST] = temp; - pauseCtx->cursorY[PAUSE_QUEST] = temp; + pauseCtx->cursorX[PAUSE_QUEST] = 0; + pauseCtx->cursorY[PAUSE_QUEST] = 0; pauseCtx->cursorX[PAUSE_EQUIP] = 1; pauseCtx->cursorY[PAUSE_EQUIP] = 0;