From b97228e6822966c3ec46341317d9cf6a1a020185 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 3 Jun 2023 11:46:19 +1000 Subject: [PATCH] Fix beta builds when DEBUG is not defined --- src/game/bg.c | 2 ++ src/game/challenge.c | 2 +- src/game/debug2.c | 4 ++-- src/game/endscreen.c | 12 ++++++------ src/game/mainmenu.c | 4 ++++ src/game/training.c | 2 ++ src/lib/main.c | 2 ++ src/lib/mema.c | 2 ++ src/lib/memp.c | 2 ++ 9 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/game/bg.c b/src/game/bg.c index dab84f31a..8a7fa8ff8 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -1211,7 +1211,9 @@ Gfx *bgRenderScene(Gfx *gdl) } #if VERSION < VERSION_NTSC_1_0 +#ifdef DEBUG debug0f119a80nb(); +#endif #endif return gdl; diff --git a/src/game/challenge.c b/src/game/challenge.c index bab5c3e7d..7a1481f5d 100644 --- a/src/game/challenge.c +++ b/src/game/challenge.c @@ -813,7 +813,7 @@ void challengeConsiderMarkingComplete(void) { bool result = challengeIsCompleteForEndscreen(); -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if ((g_CheatsActiveBank0 == 0 && g_CheatsActiveBank1 == 0) && (result || debugIsSetCompleteEnabled())) #elif VERSION >= VERSION_NTSC_1_0 if (g_CheatsActiveBank0 == 0 && g_CheatsActiveBank1 == 0 && result) diff --git a/src/game/debug2.c b/src/game/debug2.c index e4f545ae5..c54053039 100644 --- a/src/game/debug2.c +++ b/src/game/debug2.c @@ -407,7 +407,7 @@ s32 var80078790nb = 0; bool g_DebugFootsteps = true; bool g_DebugAllChallenges = false; bool g_DebugAllBuddies = false; -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 bool g_DebugSetComplete = false; #endif bool g_DebugAllTraining = false; @@ -1107,7 +1107,7 @@ bool debugIsAllBuddiesEnabled(void) return g_DebugAllBuddies; } -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 bool debugIsSetCompleteEnabled(void) { return g_DebugSetComplete; diff --git a/src/game/endscreen.c b/src/game/endscreen.c index 9652e14b4..b4bf2cee1 100644 --- a/src/game/endscreen.c +++ b/src/game/endscreen.c @@ -1458,7 +1458,7 @@ void endscreenPrepare(void) #endif // Push the endscreen -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if ((g_Vars.currentplayer->isdead || g_Vars.currentplayer->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) #else if (g_Vars.currentplayer->isdead || g_Vars.currentplayer->aborted || !objectiveIsAllComplete()) @@ -1509,7 +1509,7 @@ void endscreenPrepare(void) g_GameFile.autostageindex = g_MissionConfig.stageindex; g_GameFile.autodifficulty = g_MissionConfig.difficulty; -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if (g_CheatsActiveBank0 == 0 && g_CheatsActiveBank1 == 0 && g_MissionConfig.pdmode == false @@ -1687,7 +1687,7 @@ void endscreenPushCoop(void) g_Menus[g_MpPlayerNum].playernum = g_Vars.currentplayernum; -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if (((g_Vars.bond->isdead && g_Vars.coop->isdead) || g_Vars.bond->aborted || g_Vars.coop->aborted @@ -1737,7 +1737,7 @@ void endscreenPushSolo(void) g_MpPlayerNum = 0; g_Menus[g_MpPlayerNum].playernum = 0; -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if (((g_Vars.bond->isdead && g_Vars.coop->isdead) || g_Vars.bond->aborted || g_Vars.coop->aborted @@ -1786,7 +1786,7 @@ void endscreenPushAnti(void) g_Menus[g_MpPlayerNum].playernum = g_Vars.currentplayernum; if (g_Vars.currentplayer == g_Vars.bond) { -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) #else if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete())) @@ -1809,7 +1809,7 @@ void endscreenPushAnti(void) filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0); } else { -#if VERSION == VERSION_PAL_BETA +#if VERSION >= VERSION_NTSC_1_0 && defined(DEBUG) if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) #else if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete())) diff --git a/src/game/mainmenu.c b/src/game/mainmenu.c index 30cb31975..f4e60cfaa 100644 --- a/src/game/mainmenu.c +++ b/src/game/mainmenu.c @@ -1282,9 +1282,11 @@ s32 getMaxAiBuddies(void) } #if VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (debugIsAllBuddiesEnabled()) { max = 4; } +#endif #endif return max; @@ -1394,9 +1396,11 @@ MenuItemHandlerResult menuhandlerCoopBuddy(s32 operation, struct menuitem *item, maxbuddies = 1; } +#ifdef DEBUG if (debugIsAllBuddiesEnabled()) { maxbuddies = 4; } +#endif data->dropdown.value = human + maxbuddies; } diff --git a/src/game/training.c b/src/game/training.c index 451676d99..044e86193 100644 --- a/src/game/training.c +++ b/src/game/training.c @@ -223,9 +223,11 @@ bool frIsWeaponAvailable(s32 weapon) } #if VERSION < VERSION_NTSC_1_0 +#ifdef DEBUG if (debugIsAllTrainingEnabled() && weapon <= WEAPON_XRAYSCANNER) { return true; } +#endif #endif return frIsWeaponFound(weapon); diff --git a/src/lib/main.c b/src/lib/main.c index f00bf5e48..53e2596ff 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -1501,7 +1501,9 @@ void mainTick(void) profileSetMarker(PROFILE_MAINTICK_END); #if VERSION == VERSION_PAL_BETA +#ifdef DEBUG debug0f119a80nb(); +#endif #endif } } diff --git a/src/lib/mema.c b/src/lib/mema.c index ddf4b747d..2cab707df 100644 --- a/src/lib/mema.c +++ b/src/lib/mema.c @@ -289,6 +289,7 @@ void memaPrint(void) memaDefragPass(&g_MemaHeap); +#ifdef DEBUG #if VERSION == VERSION_PAL_BETA if (debugIsMemInfoEnabled()) { dhudSetFgColour(0xff, 0xff, 0xff, 0xff); @@ -392,6 +393,7 @@ void memaPrint(void) line++; } #endif +#endif } void *memaAlloc(u32 size) diff --git a/src/lib/memp.c b/src/lib/memp.c index 17005c214..2340c1859 100644 --- a/src/lib/memp.c +++ b/src/lib/memp.c @@ -187,6 +187,7 @@ void *mempAlloc(u32 len, u8 pool) } #if VERSION < VERSION_NTSC_1_0 +#ifdef DEBUG if (pool != MEMPOOL_8 && pool != MEMPOOL_7 && len) { char buffer[80]; u32 stack; @@ -206,6 +207,7 @@ void *mempAlloc(u32 len, u8 pool) crashSetMessage(buffer); CRASH(); } +#endif #endif return allocation;