diff options
| author | Random <28494085+Random06457@users.noreply.github.com> | 2020-06-17 21:23:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-17 15:23:42 -0400 |
| commit | 494062167935a814744202e9a508489b2e109e28 (patch) | |
| tree | 2fe17aa8274515cf12f5b378b4307602ef03785d /src/code | |
| parent | dcdaf850b6ba68a05f90cd40d4b328a526986949 (diff) | |
Decompile pausemgr.c (#211)
* Decompile pausemgr.c
* rename pausemgr to z_kaleido_setup
* replace 0x4b with SCENE_BOWLING
* fix conflict
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_8006EA30.c | 11 | ||||
| -rw-r--r-- | src/code/game.c | 2 | ||||
| -rw-r--r-- | src/code/sys_cfb.c | 2 | ||||
| -rw-r--r-- | src/code/z_kaleido_scope_call.c | 6 | ||||
| -rw-r--r-- | src/code/z_kaleido_setup.c | 147 | ||||
| -rw-r--r-- | src/code/z_msgevent.c | 2 | ||||
| -rw-r--r-- | src/code/z_play.c | 2 | ||||
| -rw-r--r-- | src/code/z_vismono.c | 3 |
8 files changed, 154 insertions, 21 deletions
diff --git a/src/code/code_8006EA30.c b/src/code/code_8006EA30.c deleted file mode 100644 index 41104fea7..000000000 --- a/src/code/code_8006EA30.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <ultra64.h> -#include <global.h> - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006EA30.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006ECF4.s") - -void func_8006EE48(UNK_TYPE arg0) { -} - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006EE50.s") diff --git a/src/code/game.c b/src/code/game.c index 42000f78a..2aa4bf6ea 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -426,7 +426,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g startTime = endTime; GameState_InitArena(gameState, 0x100000); - SREG(30) = 3; + R_UPDATE_RATE = 3; init(gameState); endTime = osGetTime(); diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 421037c38..5ee8e857f 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -23,7 +23,7 @@ void SysCfb_Init(s32 n64dd) { osSyncPrintf("RAM4M mode\n"); sSysCfbEnd = 0x80400000; } else { - LogUtils_HungupThread("../sys_cfb.c", 0x162); + LogUtils_HungupThread("../sys_cfb.c", 354); } screenSize = SCREEN_WIDTH * SCREEN_HEIGHT; diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 0a1bf96c8..8ceeb6334 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -35,13 +35,13 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) { LOG_ADDRESS("kaleido_scope_move_func", sKaleidoScopeUpdateFunc, "../z_kaleido_scope_call.c", 99); LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw, "../z_kaleido_scope_call.c", 100); LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc, "../z_kaleido_scope_call.c", 101); - func_8006ECF4(globalCtx); + KaleidoSetup_Init(globalCtx); } void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) { - // Kaleidoscope replacement + // Kaleidoscope replacement destruction osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n"); - func_8006EE48(globalCtx); + KaleidoSetup_Destroy(globalCtx); } // regalloc diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c new file mode 100644 index 000000000..3d6e5739e --- /dev/null +++ b/src/code/z_kaleido_setup.c @@ -0,0 +1,147 @@ +#include <global.h> + +s16 sKaleidoSetupKscpPos0[] = { + 2, + 3, + 0, + 1, +}; +f32 sKaleidoSetupEyeX0[] = { + 0.0f, + 64.0f, + 0.0f, + -64.0f, +}; +f32 sKaleidoSetupEyeZ0[] = { + -64.0f, + 0.0f, + 64.0f, + 0.0f, +}; + +s16 sKaleidoSetupKscpPos1[] = { + 1, + 2, + 3, + 0, +}; +f32 sKaleidoSetupEyeX1[] = { + -64.0f, + 0.0f, + 64.0f, + 0.0f, +}; +f32 sKaleidoSetupEyeZ1[] = { + 0.0f, + -64.0f, + 0.0f, + 64.0f, +}; + +void KaleidoSetup_Update(GlobalContext* globalCtx) { + PauseContext* pauseCtx = &globalCtx->pauseCtx; + Input* input = &globalCtx->state.input[0]; + + if (pauseCtx->state == 0 && pauseCtx->flag == 0 && globalCtx->unk_10A20 == 0 && globalCtx->sceneLoadFlag == 0 && + globalCtx->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 && + gSaveContext.nextCutsceneIndex < 0xFFF0 && !Gameplay_InCsMode(globalCtx) && globalCtx->unk_11E5C < 2 && + gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 && + (globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) { + + if (CHECK_PAD(input->cur, L_TRIG) && CHECK_PAD(input->press, U_CBUTTONS)) { + if (BREG(0)) { + pauseCtx->flag = 3; + } + } else if (CHECK_PAD(input->press, START_BUTTON)) { + gSaveContext.unk_13EE = gSaveContext.unk_13EA; + WREG(16) = -0xAF; + WREG(17) = 0x9B; + pauseCtx->unk_1EA = 0; + pauseCtx->unk_1E4 = 1; + if (ZREG(48) == 0) { + pauseCtx->eye.x = sKaleidoSetupEyeX0[pauseCtx->kscpPos]; + pauseCtx->eye.z = sKaleidoSetupEyeZ0[pauseCtx->kscpPos]; + pauseCtx->kscpPos = sKaleidoSetupKscpPos0[pauseCtx->kscpPos]; + } else { + pauseCtx->eye.x = sKaleidoSetupEyeX1[pauseCtx->kscpPos]; + pauseCtx->eye.z = sKaleidoSetupEyeZ1[pauseCtx->kscpPos]; + pauseCtx->kscpPos = sKaleidoSetupKscpPos1[pauseCtx->kscpPos]; + } + + pauseCtx->mode = (u16)(pauseCtx->kscpPos * 2) + 1; // cast required + pauseCtx->state = 1; + osSyncPrintf("Mode=%d eye.x=%f, eye.z=%f kscp_pos=%d\n", pauseCtx->mode, (f64)pauseCtx->eye.x, + (f64)pauseCtx->eye.z, pauseCtx->kscpPos); + } + + if (pauseCtx->state == 1) { + WREG(2) = -0x1860; + R_UPDATE_RATE = 2; + if (func_800B3898()) { + func_800B3840(0); + } + func_800F64E0(1); + } + } +} + +#ifdef NON_MATCHING +// regalloc +void KaleidoSetup_Init(GlobalContext* globalCtx) { + + PauseContext* pauseCtx = &globalCtx->pauseCtx; + s32 temp; + pauseCtx->state = 0; + pauseCtx->flag = 0; + pauseCtx->unk_208 = 0; + pauseCtx->unk_1EA = 0; + pauseCtx->unk_1E4 = 0; + pauseCtx->mode = 0; + pauseCtx->kscpPos = 0; + pauseCtx->unk_218 = 0; + pauseCtx->unk_1F4 = 160.0f; + pauseCtx->unk_1F8 = 160.0f; + pauseCtx->unk_1FC = 160.0f; + pauseCtx->unk_200 = 160.0f; + pauseCtx->eye.z = 64.0f; + pauseCtx->unk_1F0 = 936.0f; + pauseCtx->eye.x = pauseCtx->eye.y = 0.0f; + pauseCtx->unk_204 = -314.0f; + pauseCtx->unk_21A = VREG(30) + 3; + pauseCtx->unk_21C = 0; + pauseCtx->unk_21E = 1; + temp = pauseCtx->unk_21E; + pauseCtx->unk_220 = 10; + pauseCtx->unk_222 = 0; + pauseCtx->unk_22C = 0; + pauseCtx->unk_224 = 0; + pauseCtx->unk_22E = 0; + pauseCtx->unk_226 = 0; + pauseCtx->unk_230 = 0; + pauseCtx->unk_228 = 1; + pauseCtx->unk_232 = 0; + pauseCtx->unk_23E = 999; + pauseCtx->unk_240 = VREG(30) + 3; + pauseCtx->unk_242 = 999; + pauseCtx->unk_244 = 59; + pauseCtx->unk_246 = 0; + pauseCtx->unk_248 = (VREG(30) + 3) & 0xFFFF; + pauseCtx->unk_24A = 0; + pauseCtx->unk_25A = -40; + pauseCtx->unk_25C = 0; + pauseCtx->unk_25E = 0; + pauseCtx->unk_260 = 4; + pauseCtx->unk_264 = -1; + pauseCtx->unk_238 = 0; + pauseCtx->unk_24C = temp; + View_Init(&pauseCtx->view, globalCtx->state.gfxCtx); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kaleido_setup/KaleidoSetup_Init.s") +#endif + +void KaleidoSetup_Destroy(GlobalContext* globalCtx) { +} + +void func_8006EE50(UNK_PTR arg0, s16 arg1, s16 arg2) { +} diff --git a/src/code/z_msgevent.c b/src/code/z_msgevent.c index 3a0f3f417..9e61a9181 100644 --- a/src/code/z_msgevent.c +++ b/src/code/z_msgevent.c @@ -16,6 +16,6 @@ void MsgEvent_SendNullTask() { task.list.t.type = M_NULTASK; osCreateMesgQueue(task.msgQ, &msg, 1); osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK); - Sched_SendEntryMsg(&gSchedContext); // osScKickEntryMsg + Sched_SendEntryMsg(&gSchedContext); osRecvMesg(&queue, NULL, OS_MESG_BLOCK); } diff --git a/src/code/z_play.c b/src/code/z_play.c index b283c6855..3ad00ee29 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -793,7 +793,7 @@ void Gameplay_Update(GlobalContext* globalCtx) { } if ((gSaveContext.gameMode == 0) && (globalCtx->msgCtx.msgMode == 0) && (globalCtx->unk_10A20 == 0)) { - func_8006EA30(globalCtx); + KaleidoSetup_Update(globalCtx); } if (1 && HREG(63)) { diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 748dbe968..b54413285 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,9 +1,6 @@ #include <ultra64.h> #include <global.h> -// Note : This file is related to z_vismono, the original name was probably z_vis<something before "mono" -// alphabetically> - // (Note: 80 = SCREEN_HEIGHT/3, see VisMono_DrawTexture) // Did the devs forget to update this? 1+1+1+80*(7+2+2+3)+1+1 makes more sense #define DLSIZE (1 + 3 + 1 + 1 + 80 * (7 + 2 + 2 + 3) + 1) |
