diff options
| author | fig02 <fig02srl@gmail.com> | 2024-11-17 17:02:07 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-17 17:02:07 -0500 |
| commit | 17edb82c0d22fb78135033f92a624bd6cde6f495 (patch) | |
| tree | 1f5f077c12e3a693745fcbb0aa450b35cf8ff9b6 /src/code | |
| parent | cf4dc98cc934cdb62ed8b5001602468fac6dfeb3 (diff) | |
Decouple Debug Features From gc-eu-mq-dbg (#2296)
* rename OOT_DEBUG to DEBUG_FEATURES
* makefile changes
* add DEBUG_ASSETS
* fix DEBUG_FEATURES usages
* format
* fix errors
* review
* fix problem and review2
* review
* add DEBUG_FEATURES to DEBUG_ASSETS check
* review
* whoops
* format
Diffstat (limited to 'src/code')
37 files changed, 229 insertions, 214 deletions
diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 441dddade..d8d96d1b8 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -598,7 +598,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { buffCvg[i] = this->cvgSave[xi + yi * this->width] >> 5; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (buffCvg[7] == 7) { PRINTF("Error, should not be in here \n"); return; @@ -693,7 +693,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { (((a2) >= (a1)) ? (((a3) >= (a2)) ? (a2) : (((a1) >= (a3)) ? (a1) : (a3))) \ : (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3)))) -#if OOT_DEBUG +#if DEBUG_FEATURES #define R_HREG_MODE_DEBUG R_HREG_MODE #else #define R_HREG_MODE_DEBUG ((void)0, 0) diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index 90ae85187..2bdfc6bcd 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -36,7 +36,7 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); carriedActor->world.pos = pos; -#if OOT_DEBUG +#if DEBUG_FEATURES if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y || pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) { diff --git a/src/code/code_800D31A0.c b/src/code/code_800D31A0.c index b4e0495e1..e7bd207d7 100644 --- a/src/code/code_800D31A0.c +++ b/src/code/code_800D31A0.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#if OOT_DEBUG +#if DEBUG_FEATURES u32 gIsCtrlr2Valid = false; #endif @@ -12,7 +12,7 @@ NORETURN void func_800D31A0(void) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES void func_800D31F0(void) { gIsCtrlr2Valid = (gPadMgr.validCtrlrsMask & 2) != 0; } diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index a1def050a..b6aa81b32 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -7,14 +7,16 @@ Arena sDebugArena; -#if OOT_DEBUG +#if DEBUG_FEATURES s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR; void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { if (ptr == NULL) { if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) { PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action); +#if PLATFORM_GC __osDisplayArena(&sDebugArena); +#endif return; } } else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { @@ -34,7 +36,7 @@ void* DebugArena_Malloc(u32 size) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* DebugArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sDebugArena, size, file, line); @@ -50,7 +52,7 @@ void* DebugArena_MallocR(u32 size) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* DebugArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sDebugArena, size, file, line); @@ -65,7 +67,7 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing" @@ -77,7 +79,7 @@ void DebugArena_Free(void* ptr) { __osFree(&sDebugArena, ptr); } -#if OOT_DEBUG +#if DEBUG_FEATURES void DebugArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sDebugArena, ptr, file, line); } @@ -96,7 +98,7 @@ void* DebugArena_Calloc(u32 num, u32 size) { return ret; } -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES void DebugArena_Display(void) { // Likely copypasted from ZeldaArena_Display, should say "Debug" PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); @@ -113,14 +115,14 @@ void DebugArena_Check(void) { } void DebugArena_Init(void* start, u32 size) { -#if OOT_DEBUG +#if DEBUG_FEATURES gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sDebugArena, start, size); } void DebugArena_Cleanup(void) { -#if OOT_DEBUG +#if DEBUG_FEATURES gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sDebugArena); diff --git a/src/code/game.c b/src/code/game.c index bd129ef77..8aad6bf00 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -15,7 +15,7 @@ VisZBuf sVisZBuf; VisMono sVisMono; ViMode sViMode; -#if OOT_DEBUG +#if DEBUG_FEATURES FaultClient sGameFaultClient; u16 sLastButtonPressed; @@ -73,18 +73,16 @@ void GameState_SetFBFilter(Gfx** gfxP) { } void func_800C4344(GameState* gameState) { -#if PLATFORM_N64 - if (D_80121212 != 0) { - func_801C7E78(); - } -#elif OOT_DEBUG +#if DEBUG_FEATURES Input* selectedInput; s32 hexDumpSize; u16 inputCompareValue; +#if PLATFORM_GC if (R_HREG_MODE == HREG_MODE_HEAP_FREE_BLOCK_TEST) { __osMalloc_FreeBlockTest_Enable = R_HEAP_FREE_BLOCK_TEST_TOGGLE; } +#endif if (R_HREG_MODE == HREG_MODE_INPUT_TEST) { selectedInput = @@ -128,9 +126,15 @@ void func_800C4344(GameState* gameState) { } } #endif + +#if PLATFORM_N64 + if (D_80121212 != 0) { + func_801C7E78(); + } +#endif } -#if OOT_DEBUG +#if DEBUG_FEATURES void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { static const u16 sInpDispBtnColors[] = { GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), @@ -176,7 +180,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { GameState_SetFBFilter(&newDList); } -#if OOT_DEBUG +#if DEBUG_FEATURES sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button; if (R_DISABLE_INPUT_DISPLAY == 0) { GameState_DrawInputDisplay(sLastButtonPressed, &newDList); @@ -195,14 +199,14 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { #endif if (R_ENABLE_ARENA_DBG < 0) { -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES s32 pad; DebugArena_Display(); SystemArena_Display(); +#endif PRINTF(T("ハイラル滅亡まであと %08x バイト(game_alloc)\n", "%08x bytes left until Hyrule is destroyed (game_alloc)\n"), THA_GetRemaining(&gameState->tha)); -#endif R_ENABLE_ARENA_DBG = 0; } @@ -290,7 +294,7 @@ void GameState_Update(GameState* gameState) { } #endif -#if OOT_DEBUG +#if OOT_VERSION >= PAL_1_0 && DEBUG_FEATURES if (SREG(63) == 1u) { if (R_VI_MODE_EDIT_STATE < VI_MODE_EDIT_STATE_INACTIVE) { R_VI_MODE_EDIT_STATE = VI_MODE_EDIT_STATE_INACTIVE; @@ -431,7 +435,7 @@ void GameState_Realloc(GameState* gameState, size_t size) { THA_Init(&gameState->tha, NULL, 0); PRINTF(T("ハイラル再確保失敗\n", "Failure to secure Hyrule\n")); -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES SystemArena_Display(); #endif @@ -488,7 +492,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g VisCvg_Init(&sVisCvg); VisZBuf_Init(&sVisZBuf); VisMono_Init(&sVisMono); - if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) { + if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Init(&sViMode); } SpeedMeter_Init(&D_801664D0); @@ -498,7 +502,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g PRINTF(T("その他初期化 処理時間 %d us\n", "Other initialization processing time %d us\n"), OS_CYCLES_TO_USEC(endTime - startTime)); -#if OOT_DEBUG +#if DEBUG_FEATURES Fault_AddClient(&sGameFaultClient, GameState_FaultPrint, NULL, NULL); #endif @@ -519,14 +523,17 @@ void GameState_Destroy(GameState* gameState) { VisCvg_Destroy(&sVisCvg); VisZBuf_Destroy(&sVisZBuf); VisMono_Destroy(&sVisMono); - if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) { + if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Destroy(&sViMode); } THA_Destroy(&gameState->tha); GameAlloc_Cleanup(&gameState->alloc); -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES SystemArena_Display(); +#endif + +#if DEBUG_FEATURES Fault_RemoveClient(&sGameFaultClient); #endif @@ -545,7 +552,7 @@ u32 GameState_IsRunning(GameState* gameState) { return gameState->running; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line) { void* ret; diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index b80ece7b2..d625bc65f 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -12,7 +12,7 @@ void GameAlloc_Log(GameAlloc* this) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line) { GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line); diff --git a/src/code/graph.c b/src/code/graph.c index e7c3a2d86..405be9cb7 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -20,7 +20,7 @@ OSTime sGraphPrevUpdateEndTime; */ OSTime sGraphPrevTaskTimeStart; -#if OOT_DEBUG +#if DEBUG_FEATURES FaultClient sGraphFaultClient; UCodeInfo D_8012D230[3] = { @@ -152,21 +152,21 @@ void Graph_Init(GraphicsContext* gfxCtx) { osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff)); -#if OOT_DEBUG +#if DEBUG_FEATURES func_800D31F0(); Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL); #endif } void Graph_Destroy(GraphicsContext* gfxCtx) { -#if OOT_DEBUG +#if DEBUG_FEATURES func_800D3210(); Fault_RemoveClient(&sGraphFaultClient); #endif } void Graph_TaskSet00(GraphicsContext* gfxCtx) { -#if OOT_DEBUG +#if DEBUG_FEATURES static Gfx* sPrevTaskWorkBuffer = NULL; #endif OSTask_t* task = &gfxCtx->task.list.t; @@ -186,7 +186,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { osStopTimer(&timer); if (msg == (OSMesg)666) { -#if OOT_DEBUG +#if DEBUG_FEATURES PRINTF(VT_FGCOL(RED)); PRINTF(T("RCPが帰ってきませんでした。", "RCP did not return.")); PRINTF(VT_RST); @@ -209,7 +209,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK); -#if OOT_DEBUG +#if DEBUG_FEATURES sPrevTaskWorkBuffer = gfxCtx->workBuffer; #endif } @@ -302,7 +302,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gameState->inPreNMIState = false; Graph_InitTHGA(gfxCtx); -#if OOT_DEBUG +#if DEBUG_FEATURES OPEN_DISPS(gfxCtx, "../graph.c", 966); gDPNoOpString(WORK_DISP++, "WORK_DISP 開始", 0); @@ -316,7 +316,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { GameState_ReqPadData(gameState); GameState_Update(gameState); -#if OOT_DEBUG +#if DEBUG_FEATURES OPEN_DISPS(gfxCtx, "../graph.c", 987); gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0); @@ -338,7 +338,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { CLOSE_DISPS(gfxCtx, "../graph.c", 1028); -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_PLAY && R_PLAY_ENABLE_UCODE_DISAS == 2) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_TOGGLE = -1; @@ -450,7 +450,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { sGraphPrevUpdateEndTime = timeNow; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (gIsCtrlr2Valid && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) { gSaveContext.gameMode = GAMEMODE_NORMAL; @@ -487,7 +487,7 @@ void Graph_ThreadEntry(void* arg0) { gameState = SYSTEM_ARENA_MALLOC(size, "../graph.c", 1196); if (gameState == NULL) { -#if OOT_DEBUG +#if DEBUG_FEATURES char faultMsg[0x50]; PRINTF(T("確保失敗\n", "Failure to secure\n")); @@ -540,7 +540,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) { return THGA_AllocTail(&gfxCtx->polyOpa, ALIGN16(size)); } -#if OOT_DEBUG +#if DEBUG_FEATURES void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) { dispRefs[0] = gfxCtx->polyOpa.p; diff --git a/src/code/main.c b/src/code/main.c index a0671605d..1ba4bc585 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -57,7 +57,7 @@ AudioMgr sAudioMgr; OSMesgQueue sSerialEventQueue; OSMesg sSerialMsgBuf[1]; -#if OOT_DEBUG +#if DEBUG_FEATURES void Main_LogSystemHeap(void) { PRINTF(VT_FGCOL(GREEN)); PRINTF( @@ -100,7 +100,7 @@ void Main(void* arg) { fb, gSystemHeapSize); SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap -#if OOT_DEBUG +#if DEBUG_FEATURES { void* debugHeapStart; u32 debugHeapSize; @@ -125,7 +125,7 @@ void Main(void* arg) { osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf)); osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL); -#if OOT_DEBUG +#if DEBUG_FEATURES Main_LogSystemHeap(); #endif diff --git a/src/code/padmgr.c b/src/code/padmgr.c index f9ccce780..4486e541a 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -33,7 +33,7 @@ #include "terminal.h" #define PADMGR_LOG(controllerNum, msg) \ - if (OOT_DEBUG) { \ + if (DEBUG_FEATURES) { \ PRINTF(VT_FGCOL(YELLOW)); \ PRINTF(T("padmgr: %dコン: %s\n", "padmgr: Controller %d: %s\n"), (controllerNum) + 1, (msg)); \ PRINTF(VT_RST); \ @@ -68,7 +68,7 @@ s32 gPadMgrLogSeverity = LOG_SEVERITY_CRITICAL; OSMesgQueue* PadMgr_AcquireSerialEventQueue(PadMgr* padMgr) { OSMesgQueue* serialEventQueue; -#if OOT_DEBUG +#if DEBUG_FEATURES serialEventQueue = NULL; #endif @@ -184,7 +184,7 @@ void PadMgr_UpdateRumble(PadMgr* padMgr) { } } else { if (padMgr->pakType[i] != CONT_PAK_NONE) { - if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !OOT_DEBUG) { + if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !DEBUG_FEATURES) { PADMGR_LOG(i, T("振動パックが抜かれたようです", "It seems that a rumble pak was pulled out")); padMgr->pakType[i] = CONT_PAK_NONE; } else { @@ -363,7 +363,7 @@ void PadMgr_HandleRetrace(PadMgr* padMgr) { osRecvMesg(serialEventQueue, NULL, OS_MESG_BLOCK); osContGetReadData(padMgr->pads); -#if !OOT_DEBUG +#if !DEBUG_FEATURES // Clear controllers 2 and 4 bzero(&padMgr->pads[1], sizeof(OSContPad)); bzero(&padMgr->pads[3], sizeof(OSContPad)); diff --git a/src/code/sched.c b/src/code/sched.c index 3374da65e..b22f38b40 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -54,7 +54,7 @@ OSTime sRSPAudioTimeStart; OSTime sRSPOtherTimeStart; OSTime sRDPTimeStart; -#if OOT_VERSION < PAL_1_0 || OOT_DEBUG +#if OOT_VERSION < PAL_1_0 || DEBUG_FEATURES vs32 sSchedDebugPrintfEnabled = false; #define SCHED_DEBUG_PRINTF \ @@ -85,7 +85,7 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) { Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 16); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_SCHED && R_SCHED_INIT != HREG_MODE_SCHED) { R_SCHED_TOGGLE_SPECIAL_FEATURES = 0; R_SCHED_GAMMA_ON = 0; @@ -151,7 +151,7 @@ void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) { } void Sched_HandlePreNMI(Scheduler* sc) { -#if OOT_DEBUG +#if DEBUG_FEATURES OSTime now; if (sc->curRSPTask != NULL) { diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index 2dbe295e6..ad8da58d3 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -86,7 +86,7 @@ void Letterbox_Update(s32 updateRate) { sLetterboxState = LETTERBOX_STATE_IDLE; } - if (OOT_DEBUG && (R_HREG_MODE == HREG_MODE_LETTERBOX)) { + if (DEBUG_FEATURES && (R_HREG_MODE == HREG_MODE_LETTERBOX)) { if (R_LETTERBOX_INIT != HREG_MODE_LETTERBOX) { R_LETTERBOX_INIT = HREG_MODE_LETTERBOX; R_LETTERBOX_ENABLE_LOGS = 0; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 76012588b..c7e2933be 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -15,7 +15,7 @@ void SysCfb_Init(s32 n64dd) { tmpFbEnd = 0x8044BE80; if (n64dd == 1) { PRINTF(T("RAM 8M mode (N64DD対応)\n", "RAM 8M mode (N64DD compatible)\n")); -#if OOT_DEBUG +#if DEBUG_FEATURES sSysCfbEnd = 0x805FB000; #else sSysCfbEnd = 0x80600000; @@ -23,7 +23,7 @@ void SysCfb_Init(s32 n64dd) { } else { PRINTF(T("このバージョンのマージンは %dK バイトです\n", "The margin for this version is %dK bytes\n"), (0x4BC00 / 1024)); -#if OOT_DEBUG +#if DEBUG_FEATURES sSysCfbEnd = tmpFbEnd; #else sSysCfbEnd = 0x80400000; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 9cf75240c..96b352d69 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -929,7 +929,7 @@ f32 Math3D_Plane(Plane* plane, Vec3f* pointOnPlane) { * `nx`, `ny`, `nz`, and `originDist` */ f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p) { - if (OOT_DEBUG && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) { + if (DEBUG_FEATURES && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) { PRINTF(VT_COL(YELLOW, BLACK)); PRINTF(T("Math3DLengthPlaneAndPos():法線size がゼロ近いです%f %f %f\n", "Math3DLengthPlaneAndPos(): Normal size is near zero %f %f %f\n"), diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index b5c0b206b..19db7799e 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -1,5 +1,5 @@ #include "global.h" -#if OOT_DEBUG +#if DEBUG_FEATURES #include "fault.h" #endif @@ -609,7 +609,7 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { return dest; } -#if OOT_DEBUG +#if DEBUG_FEATURES Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line) { return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest); @@ -629,7 +629,7 @@ Mtx* Matrix_Finalize(GraphicsContext* gfxCtx) { return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx))); } -#endif /* OOT_DEBUG */ +#endif /* DEBUG_FEATURES */ Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) { return Matrix_MtxFToMtx(src, GRAPH_ALLOC(gfxCtx, sizeof(Mtx))); @@ -975,7 +975,7 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line) { s32 i, j; diff --git a/src/code/sys_rumble.c b/src/code/sys_rumble.c index fdb204af5..10844f367 100644 --- a/src/code/sys_rumble.c +++ b/src/code/sys_rumble.c @@ -147,7 +147,7 @@ void RumbleMgr_Init(RumbleMgr* rumbleMgr) { } void RumbleMgr_Destroy(RumbleMgr* rumbleMgr) { -#if OOT_DEBUG +#if DEBUG_FEATURES bzero(rumbleMgr, sizeof(RumbleMgr)); #endif } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 45370e83b..2fde9f8a9 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -17,7 +17,7 @@ static CollisionPoly* sCurCeilingPoly; static s32 sCurCeilingBgId; -#if OOT_DEBUG +#if DEBUG_FEATURES #define ACTOR_DEBUG_PRINTF \ if (R_ENABLE_ACTOR_DEBUG_PRINTF) \ PRINTF @@ -917,7 +917,7 @@ void Actor_Destroy(Actor* actor, PlayState* play) { actor->destroy(actor, play); actor->destroy = NULL; } else { -#if OOT_DEBUG +#if DEBUG_FEATURES overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -1468,7 +1468,7 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* *hilite = GRAPH_ALLOC(gfxCtx, sizeof(Hilite)); -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_PRINT_HILITE_INFO) { PRINTF("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", correctedEyeX, eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z); @@ -2365,7 +2365,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actorCtx->unk_02--; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (KREG(0) == -100) { Actor* player = &GET_PLAYER(play)->actor; @@ -2488,7 +2488,7 @@ void Actor_FaultPrint(Actor* actor, char* command) { Fault_Printf("ACTOR NAME is NULL"); } -#if OOT_DEBUG +#if DEBUG_FEATURES overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -2741,22 +2741,22 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { gDPNoOpString(POLY_OPA_DISP++, actorName, i); gDPNoOpString(POLY_XLU_DISP++, actorName, i); - if (OOT_DEBUG) { + if (DEBUG_FEATURES) { HREG(66) = i; } - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &actor->projectedW); } - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { if (actor->sfx != 0) { Actor_UpdateFlaggedAudio(actor); } } - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { if (func_800314B0(play, actor)) { actor->flags |= ACTOR_FLAG_6; } else { @@ -2766,7 +2766,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { actor->isDrawn = false; - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_REACT_TO_LENS) && ((play->roomCtx.curRoom.lensMode == LENS_MODE_SHOW_ACTORS) || play->actorCtx.lensActive || @@ -2776,7 +2776,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || + if (!DEBUG_FEATURES || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { Actor_Draw(play, actor); actor->isDrawn = true; @@ -2789,15 +2789,15 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { } } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(73) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(73) != 0)) { Effect_DrawAll(play->state.gfxCtx); } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(74) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(74) != 0)) { EffectSs_DrawAll(play); } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(72) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(72) != 0)) { if (play->actorCtx.lensActive) { Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors); if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) { @@ -2812,11 +2812,11 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { Lights_DrawGlow(play); } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(75) != 0)) { + if (!DEBUG_FEATURES || (HREG(64) != 1) || (HREG(75) != 0)) { TitleCard_Draw(play, &actorCtx->titleCtx); } -#if OOT_DEBUG +#if DEBUG_FEATURES if ((HREG(64) != 1) || (HREG(76) != 0)) { CollisionCheck_DrawCollision(play, &play->colChkCtx); } @@ -3009,7 +3009,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos overlayEntry = &gActorOverlayTable[actorId]; ASSERT(actorId < ACTOR_ID_MAX, "profile < ACTOR_DLF_MAX", "../z_actor.c", 6883); -#if OOT_DEBUG +#if DEBUG_FEATURES name = overlayEntry->name != NULL ? overlayEntry->name : ""; #endif diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 6e1fdb97c..65b118efd 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -24,7 +24,7 @@ #undef DEFINE_ACTOR_UNSET // Actor Overlay Table definition -#if OOT_DEBUG +#if DEBUG_FEATURES #define DEFINE_ACTOR(name, _1, allocType, nameString) \ { \ @@ -80,7 +80,7 @@ s32 gMaxActorId = 0; static FaultClient sFaultClient; void ActorOverlayTable_LogPrint(void) { -#if OOT_DEBUG +#if DEBUG_FEATURES ActorOverlay* overlayEntry; u32 i; @@ -137,7 +137,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { Fault_Printf("\n"); #else Fault_Printf("%3d %08x-%08x %3d %s\n", i, ramStart, ramEnd, overlayEntry->numLoaded, - (OOT_DEBUG && overlayEntry->name != NULL) ? overlayEntry->name : ""); + (DEBUG_FEATURES && overlayEntry->name != NULL) ? overlayEntry->name : ""); #endif } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 15d1364be..37d839dff 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -81,7 +81,7 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = { SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET }; -#if OOT_DEBUG +#if DEBUG_FEATURES /** * original name: T_BGCheck_PosErrorCheck */ @@ -1724,7 +1724,7 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla break; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(&checkPos, "../z_bgcheck.c", 4410)) { if (actor != NULL) { PRINTF(T("こいつ,pself_actor->name %d\n", "This guy, pself_actor->name %d\n"), actor->id); @@ -1976,7 +1976,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul dy = posNext->y - posPrev->y; dz = posNext->z - posPrev->z; -#if OOT_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(posNext, "../z_bgcheck.c", 4831) == true || BgCheck_PosErrorCheck(posPrev, "../z_bgcheck.c", 4832) == true) { if (actor != NULL) { @@ -2170,7 +2170,7 @@ s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, V *outBgId = BGCHECK_SCENE; *outY = pos->y; -#if OOT_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(pos, "../z_bgcheck.c", 5206) == true) { if (actor != NULL) { PRINTF(T("こいつ,pself_actor->name %d\n", "This guy, pself_actor->name %d\n"), actor->id); @@ -2243,7 +2243,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, *outBgId = BGCHECK_SCENE; -#if OOT_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(posA, "../z_bgcheck.c", 5334) == true || BgCheck_PosErrorCheck(posB, "../z_bgcheck.c", 5335) == true) { if (actor != NULL) { @@ -2466,7 +2466,7 @@ s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionP *outBgId = BGCHECK_SCENE; -#if OOT_DEBUG +#if DEBUG_FEATURES if (BgCheck_PosErrorCheck(center, "../z_bgcheck.c", 5852) == true) { if (actor != NULL) { PRINTF(T("こいつ,pself_actor->name %d\n", "This guy, pself_actor->name %d\n"), actor->id); @@ -2810,7 +2810,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI PRINTF(VT_RST); if (!DynaPoly_IsBgIdBgActor(bgId)) { -#if OOT_DEBUG +#if DEBUG_FEATURES if (bgId == -1) { PRINTF(VT_FGCOL(GREEN)); PRINTF(T("DynaPolyInfo_delReserve():削除されているはずの(?)\n" @@ -2882,7 +2882,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 return; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) { PRINTF(VT_FGCOL(RED)); PRINTF(T("DynaPolyInfo_expandSRT():polygon over %dが%dを越えるとダメ\n", @@ -4447,7 +4447,7 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec return result; } -#if OOT_DEBUG +#if DEBUG_FEATURES /** * Draw a list of dyna polys, specified by `ssList` */ diff --git a/src/code/z_camera.c b/src/code/z_camera.c index af1d69b1f..db9fbddcb 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -17,11 +17,11 @@ s32 Camera_UpdateWater(Camera* camera); #define CAMERA_CHECK_BTN(input, btn) CHECK_BTN_ALL((input)->press.button, (btn)) #endif -#if OOT_DEBUG +#if DEBUG_FEATURES s32 Camera_QRegInit(void); #endif -#if OOT_DEBUG +#if DEBUG_FEATURES #define CAM_DEBUG_RELOAD_PREG(camera) \ if (R_RELOAD_CAM_PARAMS) { \ Camera_CopyPREGToModeValues(camera); \ @@ -35,7 +35,7 @@ s32 Camera_QRegInit(void); // CameraModeValue arrays. Although sometimes some read-write data is reset as well #define RELOAD_PARAMS(camera) (camera->animState == 0 || camera->animState == 10 || camera->animState == 20) -#if OOT_DEBUG +#if DEBUG_FEATURES #define CAM_DEBUG_RELOAD_PARAMS R_RELOAD_CAM_PARAMS #else #define CAM_DEBUG_RELOAD_PARAMS true @@ -53,7 +53,7 @@ s32 Camera_QRegInit(void); // Load the next value and scale down from camera read-only data stored in CameraModeValue #define GET_NEXT_SCALED_RO_DATA(values) CAM_DATA_SCALED(GET_NEXT_RO_DATA(values)) -#if OOT_DEBUG +#if DEBUG_FEATURES #define CAM_GLOBAL_0 OREG(0) #define CAM_GLOBAL_1 OREG(1) @@ -583,7 +583,7 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES if (i == 0) { PRINTF(VT_COL(YELLOW, BLACK) "camera: foward check: too many layer!\n" VT_RST); } @@ -868,7 +868,7 @@ void Camera_CopyDataToRegs(Camera* camera, s16 mode) { CameraModeValue* valueP; s32 i; -#if OOT_DEBUG +#if DEBUG_FEATURES if (PREG(82)) { PRINTF("camera: res: stat (%d/%d/%d)\n", camera->camId, camera->setting, mode); } @@ -887,7 +887,7 @@ void Camera_CopyDataToRegs(Camera* camera, s16 mode) { camera->animState = 0; } -#if OOT_DEBUG +#if DEBUG_FEATURES s32 Camera_CopyPREGToModeValues(Camera* camera) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; CameraModeValue* valueP; @@ -950,7 +950,7 @@ Vec3f Camera_BGCheckCorner(Vec3f* linePointA, Vec3f* linePointB, CamColChk* poin bool result; result = func_800427B4(pointAColChk->poly, pointBColChk->poly, linePointA, linePointB, &closestPoint); -#if OOT_DEBUG +#if DEBUG_FEATURES if (!result) { PRINTF(VT_COL(YELLOW, BLACK) "camera: corner check no cross point %x %x\n" VT_RST, pointAColChk, pointBColChk); return pointAColChk->pos; @@ -2725,7 +2725,7 @@ s32 Camera_Jump3(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_RELOAD_CAM_PARAMS) { prevMode = camera->mode; camera->mode = rwData->mode; @@ -2982,7 +2982,7 @@ s32 Camera_Battle1(Camera* camera) { rwData->target = camera->target; camera->animState++; -#if OOT_DEBUG +#if DEBUG_FEATURES if (rwData->target->id > 0) { PRINTF("camera: battle: target actor name " VT_FGCOL(BLUE) "%d" VT_RST "\n", rwData->target->id); } else { @@ -3890,7 +3890,7 @@ s32 Camera_KeepOn4(Camera* camera) { spB8.pitch = D_8011D3CC[i] + spA2; D_8015BD70 = Camera_AddVecGeoToVec3f(&D_8015BD50, &spB8); } -#if OOT_DEBUG +#if DEBUG_FEATURES PRINTF("camera: item: BG&collision check %d time(s)\n", i); #endif } @@ -4372,7 +4372,7 @@ s32 Camera_Subj3(Camera* camera) { func_80043ABC(camera); -#if OOT_DEBUG +#if DEBUG_FEATURES Camera_CopyPREGToModeValues(camera); #endif @@ -5744,7 +5744,7 @@ s32 Camera_Unique9(Camera* camera) { return true; } -#if OOT_DEBUG +#if DEBUG_FEATURES void Camera_DebugPrintSplineArray(char* name, s16 length, CutsceneCameraPoint cameraPoints[]) { s32 i; @@ -5825,7 +5825,7 @@ s32 Camera_Demo1(Camera* camera) { PRINTF(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n", camera->play->state.frames, *relativeToPlayer == 0 ? T("絶対", "absolute") : T("相対", "relative")); -#if OOT_DEBUG +#if DEBUG_FEATURES if (PREG(93)) { Camera_DebugPrintSplineArray("CENTER", 5, csAtPoints); Camera_DebugPrintSplineArray(" EYE", 5, csEyePoints); @@ -5846,7 +5846,7 @@ s32 Camera_Demo1(Camera* camera) { Camera_RotateAroundPoint(&curPlayerPosRot, &csEyeUpdate, eyeNext); Camera_RotateAroundPoint(&curPlayerPosRot, &csAtUpdate, at); } -#if OOT_DEBUG +#if DEBUG_FEATURES else { PRINTF(VT_COL(RED, WHITE) "camera: spline demo: owner dead\n" VT_RST); } @@ -7458,7 +7458,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState if (sInitRegs) { s32 i; -#if OOT_DEBUG +#if DEBUG_FEATURES for (i = 0; i < sOREGInitCnt; i++) { OREG(i) = sOREGInit[i]; } @@ -7473,7 +7473,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState PREG(88) = -1; } camera->play = D_8015BD7C = play; -#if OOT_DEBUG +#if DEBUG_FEATURES DebugCamera_Init(&D_8015BD80, camera); #endif curUID = sNextUID; @@ -7528,7 +7528,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState camera->quakeOffset.z = 0; camera->atLERPStepScale = 1; sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_IGNORE, CAM_HUD_VISIBILITY_IGNORE, 0); -#if OOT_DEBUG +#if DEBUG_FEATURES sDbgModeIdx = -1; #endif D_8011D3F0 = 3; @@ -7630,7 +7630,7 @@ void Camera_InitDataUsingPlayer(Camera* camera, Player* player) { camera->nextBgCamIndex = -1; camera->atLERPStepScale = 1.0f; Camera_CopyDataToRegs(camera, camera->mode); -#if OOT_DEBUG +#if DEBUG_FEATURES Camera_QRegInit(); #endif PRINTF(VT_FGCOL(BLUE) "camera: personalize ---" VT_RST "\n"); @@ -7645,7 +7645,7 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) { CameraModeValue* valueP; s32 i; -#if OOT_DEBUG +#if DEBUG_FEATURES if (PREG(82)) { PRINTF("camera: change camera status: cond %c%c\n", status == CAM_STAT_ACTIVE ? 'o' : 'x', camera->status != CAM_STAT_ACTIVE ? 'o' : 'x'); @@ -7671,7 +7671,7 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) { return camera->status; } -#if OOT_DEBUG +#if DEBUG_FEATURES void Camera_PrintSettings(Camera* camera) { char sp58[8]; char sp50[8]; @@ -7888,7 +7888,7 @@ s32 Camera_UpdateHotRoom(Camera* camera) { return 1; } -#if OOT_DEBUG +#if DEBUG_FEATURES s32 Camera_DbgChangeMode(Camera* camera) { static s16 D_8011DAFC[] = { CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2, @@ -8007,7 +8007,7 @@ void Camera_UpdateDistortion(Camera* camera) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES #define ENABLE_DEBUG_CAM_UPDATE R_DEBUG_CAM_UPDATE #else #define ENABLE_DEBUG_CAM_UPDATE false @@ -8108,7 +8108,7 @@ Vec3s Camera_Update(Camera* camera) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES Camera_PrintSettings(camera); Camera_DbgChangeMode(camera); #endif @@ -8168,7 +8168,7 @@ Vec3s Camera_Update(Camera* camera) { sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx); } -#if OOT_DEBUG +#if DEBUG_FEATURES // enable/disable debug cam if (CAMERA_CHECK_BTN(&D_8015BD7C->state.input[2], BTN_START)) { gDebugCamEnabled ^= 1; @@ -8257,7 +8257,7 @@ Vec3s Camera_Update(Camera* camera) { CAM_BINANG_TO_DEG(camera->camDir.x), camera->camDir.y, CAM_BINANG_TO_DEG(camera->camDir.y)); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (camera->timer != -1 && CAMERA_CHECK_BTN(&D_8015BD7C->state.input[0], BTN_DRIGHT)) { camera->timer = 0; } @@ -8591,7 +8591,7 @@ s32 Camera_RequestBgCam(Camera* camera, s32 requestedBgCamIndex) { if (!(camera->behaviorFlags & CAM_BEHAVIOR_BG_PROCESSED)) { requestedCamSetting = Camera_GetBgCamSetting(camera, requestedBgCamIndex); camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; -#if OOT_DEBUG +#if DEBUG_FEATURES settingChangeSuccessful = Camera_RequestSettingImpl(camera, requestedCamSetting, CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX | CAM_REQUEST_SETTING_FORCE_CHANGE) >= 0; @@ -8622,7 +8622,7 @@ s32 Camera_RequestBgCam(Camera* camera, s32 requestedBgCamIndex) { } Vec3s Camera_GetInputDir(Camera* camera) { -#if OOT_DEBUG +#if DEBUG_FEATURES if (gDebugCamEnabled) { return D_8015BD80.sub.unk_104A; } @@ -8644,7 +8644,7 @@ s16 Camera_GetInputDirYaw(Camera* camera) { } Vec3s Camera_GetCamDir(Camera* camera) { -#if OOT_DEBUG +#if DEBUG_FEATURES if (gDebugCamEnabled) { return D_8015BD80.sub.unk_104A; } @@ -8841,7 +8841,7 @@ s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera) { } s32 Camera_IsDebugCamEnabled(void) { -#if OOT_DEBUG +#if DEBUG_FEATURES return gDebugCamEnabled; #else return false; @@ -8875,7 +8875,7 @@ void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* d } } -#if OOT_DEBUG +#if DEBUG_FEATURES s32 Camera_QRegInit(void) { if (!R_RELOAD_CAM_PARAMS) { QREG(2) = 1; diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 3212173fd..fece55ea3 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -27,7 +27,7 @@ typedef struct CameraSetting { /*==================================================================*/ // Data -#if OOT_DEBUG +#if DEBUG_FEATURES s16 sOREGInit[] = { 0, // OREG(0) 1, // OREG(1) @@ -119,7 +119,7 @@ s16 sCamDataRegsInit[CAM_DATA_MAX] = { s16 sCamDataRegsInitCount = ARRAY_COUNT(sCamDataRegsInit); -#if OOT_DEBUG +#if DEBUG_FEATURES char sCameraSettingNames[][12] = { "NONE ", // CAM_SET_NONE "NORMAL0 ", // CAM_SET_NORMAL0 @@ -2562,7 +2562,7 @@ s32 sInitRegs = 1; s32 gDebugCamEnabled = false; -#if OOT_DEBUG +#if DEBUG_FEATURES s32 sDbgModeIdx = -1; #endif @@ -2588,7 +2588,7 @@ s32 D_8011D3F0 = 0; s32 sDemo5PrevAction12Frame = -16; -#if OOT_DEBUG +#if DEBUG_FEATURES char sCameraFunctionNames[][8] = { "NONE ", // CAM_FUNC_NONE "NORM0()", // CAM_FUNC_NORM0 @@ -2681,7 +2681,7 @@ Vec3f D_8011D678[] = { PlayState* D_8015BD7C; -#if OOT_DEBUG +#if DEBUG_FEATURES DebugCam D_8015BD80; #endif diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index f2741865a..7904809bf 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -25,7 +25,7 @@ typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec #define SAC_ENABLE (1 << 0) -#if OOT_DEBUG +#if DEBUG_FEATURES /** * Draws a red triangle with vertices vA, vB, and vC. */ @@ -1028,7 +1028,7 @@ void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCt colChkCtx->sacFlags = 0; CollisionCheck_ClearContext(play, colChkCtx); -#if OOT_DEBUG +#if DEBUG_FEATURES AREG(21) = true; AREG(22) = true; AREG(23) = true; @@ -1082,7 +1082,7 @@ void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx colChkCtx->sacFlags &= ~SAC_ENABLE; } -#if OOT_DEBUG +#if DEBUG_FEATURES /** * Draws a collider of any shape. * Math3D_DrawSphere and Math3D_DrawCylinder are noops, so JntSph and Cylinder are not drawn. @@ -2339,7 +2339,7 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk } } -#if OOT_DEBUG +#if DEBUG_FEATURES static s8 sBssDummy3; static s8 sBssDummy4; #endif @@ -3351,7 +3351,7 @@ void Collider_SetTrisDim(PlayState* play, ColliderTris* tris, s32 elemIndex, Col Collider_SetTrisElementDim(play, &trisElem->dim, src); } -#if OOT_DEBUG +#if DEBUG_FEATURES // The two static Vec3f variables in the function below cross a block index rollover, causing a bss order swap. //! In order to replicate this behavior, we declare a certain amount of sBssDummy variables throughout the file, which //! we fit inside padding added by the compiler between structs like TriNorm and/or Vec3f, so they don't take space in @@ -3734,7 +3734,7 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags) { damage = 8; } -#if OOT_DEBUG +#if DEBUG_FEATURES KREG(7) = damage; #endif diff --git a/src/code/z_debug.c b/src/code/z_debug.c index f937b2d17..d83dc2337 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -32,7 +32,7 @@ Color_RGBA8 sDebugCamTextColors[] = { { 128, 255, 32, 128 }, // DEBUG_CAM_TEXT_GREEN }; -#if OOT_DEBUG +#if DEBUG_FEATURES InputCombo sRegGroupInputCombos[REG_GROUPS] = { { BTN_L, BTN_CUP }, // REG { BTN_L, BTN_CLEFT }, // SREG @@ -158,7 +158,7 @@ void DebugCamera_DrawScreenText(GfxPrint* printer) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES /** * Updates the state of the Reg Editor according to user input. * Also contains a controller rumble test that can be interfaced with via related REGs. @@ -298,7 +298,7 @@ void Debug_DrawText(GraphicsContext* gfxCtx) { DebugCamera_DrawScreenText(&printer); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (gRegEditor->regPage != 0) { Regs_DrawEditor(&printer); } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 0b177a1d3..453a9f3fb 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -138,7 +138,7 @@ s16 sQuakeIndex; void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx); -#if OOT_DEBUG +#if DEBUG_FEATURES void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) { GfxPrint printer; s32 pad[2]; @@ -183,7 +183,7 @@ void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { -#if OOT_DEBUG +#if DEBUG_FEATURES { Input* input = &play->state.input[0]; @@ -576,7 +576,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti } if ((csCtx->curFrame == cmd->startFrame) || titleDemoSkipped || - (OOT_DEBUG && (csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && + (DEBUG_FEATURES && (csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && (gSaveContext.fileNum != 0xFEDC))) { csCtx->state = CS_STATE_RUN_UNSTOPPABLE; Audio_SetCutsceneFlag(0); @@ -731,7 +731,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION: -#if OOT_DEBUG +#if DEBUG_FEATURES SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS); #endif play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4; @@ -902,7 +902,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT: -#if OOT_DEBUG +#if DEBUG_FEATURES SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS); #endif play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4; @@ -959,7 +959,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_GERUDO_VALLEY_CREDITS: -#if OOT_DEBUG +#if DEBUG_FEATURES gSaveContext.gameMode = GAMEMODE_END_CREDITS; Audio_SetSfxBanksMute(0x6F); #endif @@ -1802,7 +1802,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) return; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) { csCtx->state = CS_STATE_STOP; return; @@ -2215,7 +2215,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { -#if OOT_DEBUG +#if DEBUG_FEATURES if (BREG(0) != 0) { Gfx* displayList; Gfx* prevDisplayList; @@ -2236,7 +2236,7 @@ void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { csCtx->curFrame++; -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_USE_DEBUG_CUTSCENE) { Cutscene_ProcessScript(play, csCtx, gDebugCutsceneScript); } else { diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 2acc362b5..4041426b4 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -10,7 +10,7 @@ void EffectSs_InitInfo(PlayState* play, s32 tableSize) { EffectSs* effectSs; EffectSsOverlay* overlay; -#if OOT_DEBUG +#if DEBUG_FEATURES for (i = 0; i < ARRAY_COUNT(gEffectSsOverlayTable); i++) { overlay = &gEffectSsOverlayTable[i]; PRINTF("effect index %3d:size=%6dbyte romsize=%6dbyte\n", i, diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 42dc94ed8..69d2b2d9b 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -60,7 +60,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if (IS_PAUSED(&play->pauseCtx)) { if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { if (Letterbox_GetSize() == 0) { -#if OOT_DEBUG +#if DEBUG_FEATURES R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; #endif @@ -71,7 +71,7 @@ void KaleidoScopeCall_Update(PlayState* play) { pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER } } else if (pauseCtx->state == PAUSE_STATE_GAME_OVER_START) { -#if OOT_DEBUG +#if DEBUG_FEATURES R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; #endif diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 990b1c040..075a13dcd 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -72,7 +72,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 (OOT_DEBUG && BREG(0)) { + if (DEBUG_FEATURES && BREG(0)) { pauseCtx->debugState = 3; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index fd8900e77..2fa1a719e 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -349,7 +349,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) envCtx->sceneTimeSpeed = 0; gTimeSpeed = envCtx->sceneTimeSpeed; -#if OOT_DEBUG +#if DEBUG_FEATURES R_ENV_TIME_SPEED_OLD = gTimeSpeed; R_ENV_DISABLE_DBG = true; @@ -421,7 +421,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) gSkyboxIsChanging = false; gSaveContext.retainWeatherMode = false; -#if OOT_DEBUG +#if DEBUG_FEATURES R_ENV_LIGHT1_DIR(0) = 80; R_ENV_LIGHT1_DIR(1) = 80; R_ENV_LIGHT1_DIR(2) = 80; @@ -718,7 +718,7 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon } } -#if OOT_DEBUG +#if DEBUG_FEATURES if (newSkybox1Index == 0xFF) { PRINTF(VT_COL(RED, WHITE) T("\n環境VRデータ取得失敗! ささきまでご報告を!", "\nEnvironment VR data acquisition failed! Report to Sasaki!") VT_RST); @@ -835,7 +835,7 @@ void Environment_DisableUnderwaterLights(PlayState* play) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { GfxPrint printer; s32 pad[2]; @@ -979,7 +979,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex gSaveContext.save.nightFlag = 0; } -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) { Gfx* displayList; Gfx* prevDisplayList; @@ -1146,7 +1146,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend); -#if OOT_DEBUG +#if DEBUG_FEATURES if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >= envCtx->numLightSettings) { PRINTF(VT_COL(RED, WHITE) T("\nカラーパレットの設定がおかしいようです!", @@ -1226,7 +1226,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (envCtx->lightSetting >= envCtx->numLightSettings) { PRINTF("\n" VT_FGCOL(RED) T("カラーパレットがおかしいようです!", "The color palette seems to be wrong!")); @@ -1300,7 +1300,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex lightCtx->zFar = ENV_ZFAR_MAX; } -#if OOT_DEBUG +#if DEBUG_FEATURES // When environment debug is enabled, various environment related variables can be configured via the reg editor if (R_ENV_DISABLE_DBG) { R_ENV_AMBIENT_COLOR(0) = lightCtx->ambientColor[0]; diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 901e7b4e7..eaa1408bf 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -7,14 +7,16 @@ Arena sZeldaArena; -#if OOT_DEBUG +#if DEBUG_FEATURES s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR; void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { if (ptr == NULL) { if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR) { PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action); +#if PLATFORM_GC __osDisplayArena(&sZeldaArena); +#endif } } else if (gZeldaArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { PRINTF(T("%s: %u バイトの%sに成功しました\n", "%s: %u bytes %s succeeded\n"), name, size, action); @@ -34,7 +36,7 @@ void* ZeldaArena_Malloc(u32 size) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* ZeldaArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sZeldaArena, size, file, line); @@ -50,7 +52,7 @@ void* ZeldaArena_MallocR(u32 size) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line); @@ -65,7 +67,7 @@ void* ZeldaArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", T("再確保", "Re-securing")); @@ -77,7 +79,7 @@ void ZeldaArena_Free(void* ptr) { __osFree(&sZeldaArena, ptr); } -#if OOT_DEBUG +#if DEBUG_FEATURES void ZeldaArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sZeldaArena, ptr, file, line); } @@ -96,7 +98,7 @@ void* ZeldaArena_Calloc(u32 num, u32 size) { return ret; } -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES void ZeldaArena_Display(void) { PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); __osDisplayArena(&sZeldaArena); @@ -112,14 +114,14 @@ void ZeldaArena_Check(void) { } void ZeldaArena_Init(void* start, u32 size) { -#if OOT_DEBUG +#if DEBUG_FEATURES gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sZeldaArena, start, size); } void ZeldaArena_Cleanup(void) { -#if OOT_DEBUG +#if DEBUG_FEATURES gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sZeldaArena); diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index ae654c22d..4d0ab0411 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -118,8 +118,8 @@ void MapMark_DrawForDungeon(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - rectLeft = ((OOT_DEBUG ? GREG(94) : 0) + markPoint->x + 204) << 2; - rectTop = ((OOT_DEBUG ? GREG(95) : 0) + markPoint->y + 140) << 2; + rectLeft = ((DEBUG_FEATURES ? GREG(94) : 0) + markPoint->x + 204) << 2; + rectTop = ((DEBUG_FEATURES ? GREG(95) : 0) + markPoint->y + 140) << 2; gSPTextureRectangle(OVERLAY_DISP++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx, markInfo->dtdy); diff --git a/src/code/z_message.c b/src/code/z_message.c index 75ccc2c08..368a53723 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -3921,7 +3921,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { *p = gfx; } -#if OOT_DEBUG +#if DEBUG_FEATURES /** * If the s16 variable pointed to by `var` changes in value, a black bar and white box * are briefly drawn onto the screen. It can only watch one variable per build due to @@ -3981,13 +3981,13 @@ void Message_Draw(PlayState* play) { #if OOT_VERSION < GC_US s32 pad; #endif -#if OOT_DEBUG +#if DEBUG_FEATURES s16 watchVar; #endif OPEN_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3554); -#if OOT_DEBUG +#if DEBUG_FEATURES watchVar = gSaveContext.save.info.scarecrowLongSongSet; Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); if (BREG(0) != 0 && play->msgCtx.textId != 0) { @@ -4050,7 +4050,7 @@ void Message_Update(PlayState* play) { s32 pad2; #endif -#if OOT_DEBUG +#if DEBUG_FEATURES if (BREG(0) != 0) { static u16 sMessageDebuggerTextboxCount = 0; diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 2fd634e5e..04ffc2f46 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -5255,7 +5255,7 @@ s32 OnePointCutscene_Attention(PlayState* play, Actor* actor) { s32 temp2; s32 timer; -#if OOT_DEBUG +#if DEBUG_FEATURES if (sDisableAttention) { PRINTF(VT_COL(YELLOW, BLACK) "actor attention demo camera: canceled by other camera\n" VT_RST); return CAM_ID_NONE; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 166236177..74b0ef5ee 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3986,7 +3986,7 @@ void Interface_Draw(PlayState* play) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES if (pauseCtx->debugState == 3) { FlagSet_Update(play); } @@ -4012,7 +4012,7 @@ void Interface_Update(PlayState* play) { s16 risingAlpha; u16 action; -#if OOT_DEBUG +#if OOT_PAL && DEBUG_FEATURES { Input* debugInput = &play->state.input[2]; diff --git a/src/code/z_play.c b/src/code/z_play.c index bfca2ab4f..84c80119a 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -17,13 +17,13 @@ s32 gTransitionTileState; VisMono gPlayVisMono; Color_RGBA8_u32 gVisMonoColor; -#if OOT_DEBUG +#if DEBUG_FEATURES FaultClient D_801614B8; #endif s16 sTransitionFillTimer; -#if OOT_DEBUG +#if DEBUG_FEATURES void* gDebugCutsceneScript = NULL; UNK_TYPE D_8012D1F4 = 0; // unused #endif @@ -34,7 +34,7 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn); // This macro prints the number "1" with a file and line number if R_ENABLE_PLAY_LOGS is enabled. // For example, it can be used to trace the play state execution at a high level. -#if OOT_DEBUG +#if DEBUG_FEATURES #define PLAY_LOG(line) \ do { \ if (R_ENABLE_PLAY_LOGS) { \ @@ -254,7 +254,7 @@ void Play_Destroy(GameState* thisx) { } #endif -#if OOT_DEBUG +#if DEBUG_FEATURES Fault_RemoveClient(&D_801614B8); #endif } @@ -278,7 +278,7 @@ void Play_Init(GameState* thisx) { return; } -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES SystemArena_Display(); #endif @@ -468,7 +468,7 @@ void Play_Init(GameState* thisx) { PRINTF(T("ゼルダヒープ %08x-%08x\n", "Zelda Heap %08x-%08x\n"), zAllocAligned, (u8*)zAllocAligned + zAllocSize - (s32)(zAllocAligned - zAlloc)); -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL); #endif @@ -505,7 +505,7 @@ void Play_Init(GameState* thisx) { AnimTaskQueue_Update(this, &this->animTaskQueue); gSaveContext.respawnFlag = 0; -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_USE_DEBUG_CUTSCENE) { static u64 sDebugCutsceneScriptBuf[0xA00]; @@ -524,10 +524,12 @@ void Play_Update(PlayState* this) { s32 isPaused; s32 pad1; -#if OOT_DEBUG +#if DEBUG_FEATURES if ((SREG(1) < 0) || (DREG(0) != 0)) { SREG(1) = 0; +#if PLATFORM_GC ZeldaArena_Display(); +#endif } if ((R_HREG_MODE == HREG_MODE_PRINT_OBJECT_TABLE) && (R_PRINT_OBJECT_TABLE_TRIGGER < 0)) { @@ -613,7 +615,7 @@ void Play_Update(PlayState* this) { } } -#if OOT_DEBUG +#if DEBUG_FEATURES if (!R_TRANS_DBG_ENABLED) { Play_SetupTransition(this, this->transitionType); } else { @@ -931,7 +933,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3555); AnimTaskQueue_Reset(&this->animTaskQueue); - if (!OOT_DEBUG) {} + if (!DEBUG_FEATURES) {} PLAY_LOG(3561); Object_UpdateEntries(&this->objectCtx); @@ -1139,7 +1141,7 @@ void Play_Draw(PlayState* this) { Gfx_SetupFrame(gfxCtx, 0, 0, 0); - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) { POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP); POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP); @@ -1162,7 +1164,7 @@ void Play_Draw(PlayState* this) { gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx); - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { Gfx* gfxP; Gfx* sp1CC = POLY_OPA_DISP; @@ -1231,7 +1233,7 @@ void Play_Draw(PlayState* this) { goto Play_Draw_DrawOverlayElements; } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) { if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) { Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx); @@ -1244,32 +1246,34 @@ void Play_Draw(PlayState* this) { } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || + (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) { if (!this->envCtx.sunMoonDisabled) { Environment_DrawSunAndMoon(this); } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || + (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) { Environment_DrawSkyboxFilters(this); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) { Environment_UpdateLightningStrike(this); Environment_DrawLightning(this, 0); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) { sp228 = LightContext_NewLights(&this->lightCtx, gfxCtx); Lights_BindAll(sp228, this->lightCtx.listHead, NULL); Lights_Draw(sp228, gfxCtx); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { if (VREG(94) == 0) { s32 roomDrawFlags; - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY)) { roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU; } else { roomDrawFlags = R_PLAY_DRAW_ROOM_FLAGS; @@ -1280,7 +1284,7 @@ void Play_Draw(PlayState* this) { } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { if ((this->skyboxCtx.drawType != SKYBOX_DRAW_128) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) { Vec3f quakeOffset; @@ -1295,15 +1299,15 @@ void Play_Draw(PlayState* this) { Environment_DrawRain(this, &this->view, gfxCtx); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { Environment_FillScreen(gfxCtx, 0, 0, 0, this->bgCoverAlpha, FILL_SCREEN_OPA); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { func_800315AC(this, &this->actorCtx); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { if (!this->envCtx.sunMoonDisabled) { sp21C.x = this->view.eye.x + this->envCtx.sunPos.x; sp21C.y = this->view.eye.y + this->envCtx.sunPos.y; @@ -1313,7 +1317,7 @@ void Play_Draw(PlayState* this) { Environment_DrawCustomLensFlare(this); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) { if (MREG(64) != 0) { Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68), FILL_SCREEN_OPA | FILL_SCREEN_XLU); @@ -1330,13 +1334,13 @@ void Play_Draw(PlayState* this) { } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) { if (this->envCtx.sandstormState != SANDSTORM_OFF) { Environment_DrawSandstorm(this, this->envCtx.sandstormState); } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) { DebugDisplay_DrawObjects(this); } @@ -1363,7 +1367,7 @@ void Play_Draw(PlayState* this) { } Play_Draw_DrawOverlayElements: - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { Play_DrawOverlayElements(this); } } @@ -1393,7 +1397,7 @@ void Play_Main(GameState* thisx) { PLAY_LOG(4556); - if (OOT_DEBUG && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) { + if (DEBUG_FEATURES && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) { R_PLAY_RUN_UPDATE = true; R_PLAY_RUN_DRAW = true; R_PLAY_DRAW_SKYBOX = true; @@ -1411,7 +1415,7 @@ void Play_Main(GameState* thisx) { R_PLAY_INIT = HREG_MODE_PLAY; } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) { + if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) { Play_Update(this); } diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 1e85a8c7e..8f0f61ed3 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1246,7 +1246,7 @@ Gfx* Gfx_SetupDL_69NoCD(Gfx* gfx) { return gfx; } -#if OOT_DEBUG +#if DEBUG_FEATURES #define HREG_21 HREG(21) #define HREG_22 HREG(22) #else @@ -1482,7 +1482,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { s32 letterboxSize = Letterbox_GetSize(); -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) { if (R_SETUP_FRAME_INIT != HREG_MODE_SETUP_FRAME) { R_SETUP_FRAME_GET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG); diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index d8386c688..24521f3aa 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1758,7 +1758,7 @@ SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { }; void Scene_Draw(PlayState* play) { -#if OOT_DEBUG +#if DEBUG_FEATURES if (R_HREG_MODE == HREG_MODE_SCENE_CONFIG) { if (R_SCENE_CONFIG_INIT != HREG_MODE_SCENE_CONFIG) { R_SCENE_CONFIG_INIT = HREG_MODE_SCENE_CONFIG; diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 3a5060abf..0fcee6f03 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -671,7 +671,7 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt bzero(&gSaveContext.save.totalDays, sizeof(s32)); bzero(&gSaveContext.save.bgsDayCount, sizeof(s32)); -#if OOT_DEBUG +#if DEBUG_FEATURES if (!slotNum) { Sram_InitDebugSave(); gSaveContext.save.info.playerData.newf[0] = 'Z'; @@ -780,7 +780,7 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { u16* ptr; u16 checksum; -#if OOT_DEBUG +#if DEBUG_FEATURES if (fileSelect->buttonIndex != 0) { Sram_InitNewSave(); } else { @@ -795,7 +795,7 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { gSaveContext.save.dayTime = CLOCK_TIME(10, 0); gSaveContext.save.cutsceneIndex = 0xFFF1; -#if OOT_DEBUG +#if DEBUG_FEATURES if (fileSelect->buttonIndex == 0) { gSaveContext.save.cutsceneIndex = 0; } @@ -973,7 +973,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { } #endif -#if OOT_DEBUG +#if DEBUG_FEATURES if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) { bzero(sramCtx->readBuff, SRAM_SIZE); for (i = 0; i < CHECKSUM_SIZE; i++) { diff --git a/src/code/z_view.c b/src/code/z_view.c index 1c27679e2..5395f3855 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -316,7 +316,7 @@ s32 View_ApplyPerspective(View* view) { height = view->viewport.bottomY - view->viewport.topY; aspect = (f32)width / (f32)height; - if (OOT_DEBUG && R_HREG_MODE == HREG_MODE_PERSPECTIVE) { + if (DEBUG_FEATURES && R_HREG_MODE == HREG_MODE_PERSPECTIVE) { if (R_PERSPECTIVE_INIT != HREG_MODE_PERSPECTIVE) { R_PERSPECTIVE_INIT = HREG_MODE_PERSPECTIVE; R_PERSPECTIVE_FOVY = 60; @@ -331,7 +331,7 @@ s32 View_ApplyPerspective(View* view) { guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale); } -#if OOT_DEBUG +#if DEBUG_FEATURES if (QREG(88) & 1) { s32 i; MtxF mf; @@ -375,7 +375,7 @@ s32 View_ApplyPerspective(View* view) { view->viewing = *viewing; -#if OOT_DEBUG +#if DEBUG_FEATURES // Debug print view matrix if (QREG(88) & 2) { s32 i; @@ -625,7 +625,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) { return 1; } -#if OOT_DEBUG +#if DEBUG_FEATURES /** * Logs an error and returns nonzero if camera is too far from the origin. */ |
