summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcadmic <cadmic24@gmail.com>2024-01-30 10:54:38 -0800
committerGitHub <noreply@github.com>2024-01-30 13:54:38 -0500
commit9816f62129b26b5d1068e2fa2ea887ad3fdcfd88 (patch)
treecd6390c2cf4f3c08cec43aa1ce4022a0aecd3296 /src
parent6d09437c2162a156a843f3f10b1f864437eee6ed (diff)
Define OOT_DEBUG=0 in retail builds (#1658)
* Define OOT_DEBUG=0 in retail builds * Fix ifndef * Replace VI_MODE_EDITOR_INACTIVE * Revert "Replace VI_MODE_EDITOR_INACTIVE" This reverts commit f7c4cae7c3b3d9fdc56e97183690c05f2dcec215. * Replace VI_MODE_EDITOR_INACTIVE, take 2 * Revert EnBom_Draw
Diffstat (limited to 'src')
-rw-r--r--src/boot/boot_main.c2
-rw-r--r--src/boot/idle.c4
-rw-r--r--src/boot/is_debug.c10
-rw-r--r--src/code/game.c30
-rw-r--r--src/code/main.c8
-rw-r--r--src/code/sys_matrix.c2
-rw-r--r--src/code/z_parameter.c6
-rw-r--r--src/overlays/actors/ovl_En_Bom/z_en_bom.c2
8 files changed, 27 insertions, 37 deletions
diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c
index 4edec9c40..b8c08fe8a 100644
--- a/src/boot/boot_main.c
+++ b/src/boot/boot_main.c
@@ -21,7 +21,7 @@ void bootproc(void) {
gCartHandle = osCartRomInit();
osDriveRomInit();
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
isPrintfInit();
#endif
Locale_Init();
diff --git a/src/boot/idle.c b/src/boot/idle.c
index 8ae0b588e..f7074bd2f 100644
--- a/src/boot/idle.c
+++ b/src/boot/idle.c
@@ -56,7 +56,7 @@ void Idle_ThreadEntry(void* arg) {
gViConfigYScale = 1.0f;
switch (osTvType) {
-#ifndef OOT_DEBUG
+#if !OOT_DEBUG
case OS_TV_PAL:
#endif
case OS_TV_NTSC:
@@ -69,7 +69,7 @@ void Idle_ThreadEntry(void* arg) {
gViConfigMode = osViModeMpalLan1;
break;
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
case OS_TV_PAL:
gViConfigModeType = OS_VI_FPAL_LAN1;
gViConfigMode = osViModeFpalLan1;
diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c
index 7ce97c807..b5d077212 100644
--- a/src/boot/is_debug.c
+++ b/src/boot/is_debug.c
@@ -5,7 +5,7 @@ OSPiHandle* sISVHandle; // official name : is_Handle
#define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000)
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
void isPrintfInit(void) {
sISVHandle = osCartRomInit();
osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, 0);
@@ -18,7 +18,7 @@ void osSyncPrintfUnused(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
_Printf(is_proutSyncPrintf, NULL, fmt, args);
#endif
@@ -29,7 +29,7 @@ void osSyncPrintf(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
_Printf(is_proutSyncPrintf, NULL, fmt, args);
#endif
@@ -41,14 +41,14 @@ void rmonPrintf(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
_Printf(is_proutSyncPrintf, NULL, fmt, args);
#endif
va_end(args);
}
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
void* is_proutSyncPrintf(void* arg, const char* str, size_t count) {
u32 data;
s32 pos;
diff --git a/src/code/game.c b/src/code/game.c
index bd1310f25..2b60c66dd 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -1,12 +1,6 @@
#include "global.h"
#include "terminal.h"
-#ifdef OOT_DEBUG
-#define VI_MODE_EDITOR_INACTIVE (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE)
-#else
-#define VI_MODE_EDITOR_INACTIVE true
-#endif
-
SpeedMeter D_801664D0;
VisCvg sVisCvg;
VisZBuf sVisZBuf;
@@ -15,7 +9,7 @@ ViMode sViMode;
FaultClient sGameFaultClient;
u16 sLastButtonPressed;
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
void GameState_FaultPrint(void) {
static char sBtnChars[] = "ABZSuldr*+LRudlr";
s32 i;
@@ -70,7 +64,7 @@ void GameState_SetFBFilter(Gfx** gfxP) {
}
void func_800C4344(GameState* gameState) {
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
Input* selectedInput;
s32 hexDumpSize;
u16 inputCompareValue;
@@ -123,7 +117,7 @@ void func_800C4344(GameState* gameState) {
#endif
}
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
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),
@@ -169,7 +163,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
GameState_SetFBFilter(&newDList);
}
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button;
if (R_DISABLE_INPUT_DISPLAY == 0) {
GameState_DrawInputDisplay(sLastButtonPressed, &newDList);
@@ -188,7 +182,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
#endif
if (R_ENABLE_ARENA_DBG < 0) {
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
s32 pad;
DebugArena_Display();
SystemArena_Display();
@@ -263,7 +257,7 @@ void GameState_Update(GameState* gameState) {
func_800C4344(gameState);
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
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;
@@ -396,7 +390,7 @@ void GameState_Realloc(GameState* gameState, size_t size) {
THA_Init(&gameState->tha, NULL, 0);
PRINTF("ハイラル再確保失敗\n"); // "Failure to secure Hyral"
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
SystemArena_Display();
#endif
HUNGUP_AND_CRASH("../game.c", 1044);
@@ -442,7 +436,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
VisCvg_Init(&sVisCvg);
VisZBuf_Init(&sVisZBuf);
VisMono_Init(&sVisMono);
- if (VI_MODE_EDITOR_INACTIVE) {
+ if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) {
ViMode_Init(&sViMode);
}
SpeedMeter_Init(&D_801664D0);
@@ -452,7 +446,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
// "Other initialization processing time %d us"
PRINTF("その他初期化 処理時間 %d us\n", OS_CYCLES_TO_USEC(endTime - startTime));
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
Fault_AddClient(&sGameFaultClient, GameState_FaultPrint, NULL, NULL);
#endif
@@ -473,13 +467,13 @@ void GameState_Destroy(GameState* gameState) {
VisCvg_Destroy(&sVisCvg);
VisZBuf_Destroy(&sVisZBuf);
VisMono_Destroy(&sVisMono);
- if (VI_MODE_EDITOR_INACTIVE) {
+ if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) {
ViMode_Destroy(&sViMode);
}
THA_Destroy(&gameState->tha);
GameAlloc_Cleanup(&gameState->alloc);
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
SystemArena_Display();
Fault_RemoveClient(&sGameFaultClient);
#endif
@@ -499,7 +493,7 @@ u32 GameState_IsRunning(GameState* gameState) {
return gameState->running;
}
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) {
void* ret;
diff --git a/src/code/main.c b/src/code/main.c
index b7407c3bf..a777e8c70 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -25,7 +25,7 @@ AudioMgr gAudioMgr;
OSMesgQueue sSerialEventQueue;
OSMesg sSerialMsgBuf[1];
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
void Main_LogSystemHeap(void) {
PRINTF(VT_FGCOL(GREEN));
// "System heap size% 08x (% dKB) Start address% 08x"
@@ -55,8 +55,7 @@ void Main(void* arg) {
PRINTF("システムヒープ初期化 %08x-%08x %08x\n", systemHeapStart, fb, gSystemHeapSize);
SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap
-#ifdef OOT_DEBUG
- {
+ if (OOT_DEBUG) {
void* debugHeapStart;
u32 debugHeapSize;
@@ -71,7 +70,6 @@ void Main(void* arg) {
PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
DebugArena_Init(debugHeapStart, debugHeapSize);
}
-#endif
Regs_Init();
@@ -80,7 +78,7 @@ void Main(void* arg) {
osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf));
osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL);
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
Main_LogSystemHeap();
#endif
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index 5e15ec5e2..d6e4570ea 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -603,7 +603,7 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
return dest;
}
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) {
return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest);
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index efbe25a91..464405c56 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -3932,7 +3932,7 @@ void Interface_Draw(PlayState* play) {
}
}
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
if (pauseCtx->debugState == 3) {
FlagSet_Update(play);
}
@@ -3958,8 +3958,7 @@ void Interface_Update(PlayState* play) {
s16 risingAlpha;
u16 action;
-#ifdef OOT_DEBUG
- {
+ if (OOT_DEBUG) {
Input* debugInput = &play->state.input[2];
if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) {
@@ -3973,7 +3972,6 @@ void Interface_Update(PlayState* play) {
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
}
}
-#endif
if (!IS_PAUSED(&play->pauseCtx)) {
if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER ||
diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c
index 0dbbfada9..c95cfed5a 100644
--- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c
+++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c
@@ -359,7 +359,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnBom* this = (EnBom*)thisx;
-#ifdef OOT_DEBUG
+#if OOT_DEBUG
if (1) {}
#endif