diff --git a/Makefile b/Makefile index 895c3d058..fdfe77898 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,13 @@ ROMALLOCATION_GAME = 0x144ee0 ROM_SIZE := 32 +# DEBUG - Enable (1) or disable (0) the debug menu and crash screen. +# +# When enabled, press C-up and C-down simultaneously to toggle the debug menu. +# Note that some emulators have problems displaying the crash screen text. + +DEBUG = 0 + ################################################################################ # The VERSION constant is used in the source to handle version-specific code. @@ -112,6 +119,7 @@ ROMALLOCATION_DATA = 0x015000 ROMALLOCATION_LIB = 0x038800 ROM_SIZE = 32 +DEBUG = 0 ifeq ($(ROMID), ntsc-beta) PAL = 0 @@ -119,6 +127,7 @@ ifeq ($(ROMID), ntsc-beta) ROMALLOCATION_DATA = 0x012000 ROMALLOCATION_LIB = 0x02f800 ROMALLOCATION_GAME = 0x105000 + DEBUG = 1 endif ifeq ($(ROMID), ntsc-1.0) PAL = 0 @@ -138,6 +147,7 @@ ifeq ($(ROMID), pal-beta) ROMALLOCATION_GAME = 0x1306f0 ZIPMAGIC = 0x0c00 COPYLEN = 6 + DEBUG = 1 endif ifeq ($(ROMID), pal-final) PAL = 1 @@ -161,6 +171,10 @@ DEFINES := \ PIRACYCHECKS=$(PIRACYCHECKS) \ ROM_SIZE=$(ROM_SIZE) +ifeq ($(DEBUG),1) + DEFINES := $(DEFINES) DEBUG=1 +endif + C_DEFINES := $(foreach d,$(DEFINES),-D$(d)) AS_DEFINES := $(foreach d,$(DEFINES),--defsym $(d)) --defsym _LANGUAGE_ASSEMBLY=1 diff --git a/src/game/challenge.c b/src/game/challenge.c index 7db26c74a..f1e493e20 100644 --- a/src/game/challenge.c +++ b/src/game/challenge.c @@ -118,7 +118,7 @@ void challengeDetermineUnlockedFeatures(void) flag = 1; numgifted++; } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG else if (debugIsAllChallengesEnabled()) { flag = 1; } diff --git a/src/game/chr.c b/src/game/chr.c index 0d283fc2c..5250d9fcb 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -2637,7 +2637,7 @@ s32 chrTick(struct prop *prop) #endif if (needsupdate) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG debug0f1199f0nb(); #endif diff --git a/src/game/debug1.c b/src/game/debug1.c index 96b78804d..892c80ef4 100644 --- a/src/game/debug1.c +++ b/src/game/debug1.c @@ -6,7 +6,7 @@ #include "data.h" #include "types.h" -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 g_DMenuSelectedOption = 0; s32 g_DMenuNumOptions = 0; char **g_DMenuCurLabels = NULL; @@ -18,7 +18,7 @@ u8 g_DMenuXScales[] = { 4, 4, 4 }; u8 g_DMenuYScales[] = { 7, 7, 7 }; #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG void dmenu0f118c80nb(void) { // empty @@ -27,14 +27,14 @@ void dmenu0f118c80nb(void) void dmenuSetScaleIndex(s32 index) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG g_DMenuScaleIndex = index; #endif } void dmenuSetMenu(char **labels, s32 (*positions)[2], s32 *offsets) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 numgroups; g_DMenuCurLabels = labels; @@ -50,7 +50,7 @@ void dmenuSetMenu(char **labels, s32 (*positions)[2], s32 *offsets) Gfx *dmenuRender(Gfx *gdl) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 xscale = g_DMenuXScales[g_DMenuScaleIndex]; s32 yscale = g_DMenuYScales[g_DMenuScaleIndex]; s32 i; @@ -83,7 +83,7 @@ Gfx *dmenuRender(Gfx *gdl) return gdl; } -#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA +#ifndef DEBUG void debug0f11ed10(s32 arg0, s32 arg1, s32 arg2) { // empty @@ -92,7 +92,7 @@ void debug0f11ed10(s32 arg0, s32 arg1, s32 arg2) s32 dmenuGetSelectedOption(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG return g_DMenuSelectedOption; #else return 0; @@ -101,14 +101,14 @@ s32 dmenuGetSelectedOption(void) void dmenuSetSelectedOption(s32 option) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG g_DMenuSelectedOption = option; #endif } void dmenuNavigateUp(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; g_DMenuSelectedOption--; @@ -133,7 +133,7 @@ void dmenuNavigateUp(void) void dmenuNavigateDown(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; g_DMenuSelectedOption++; @@ -158,7 +158,7 @@ void dmenuNavigateDown(void) void dmenuNavigateRight(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; if (g_DMenuSelectedOption < g_DMenuCurOffsets[0]) { @@ -195,7 +195,7 @@ void dmenuNavigateRight(void) void dmenuNavigateLeft(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; // First group diff --git a/src/game/debug2.c b/src/game/debug2.c index 95486ca8f..a6578c45b 100644 --- a/src/game/debug2.c +++ b/src/game/debug2.c @@ -37,7 +37,7 @@ #endif // The DEBUG_VALUE macro is used for readability. -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG #define DEBUG_VALUE(valueifdebug, valueifnotdebug) (valueifdebug) #else #define DEBUG_VALUE(valueifdebug, valueifnotdebug) (valueifnotdebug) @@ -50,7 +50,7 @@ s32 var80075d68 = 2; s32 var800786f4nb = 2; #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 g_DebugMenuOffsets[] = { 15, 30, @@ -355,7 +355,7 @@ s32 var80075d68 = 2; s32 var800786f4nb = 2; #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 g_DebugProfileMode = 0; bool g_DebugRenderBg = true; bool g_DebugRenderProps = true; @@ -370,7 +370,7 @@ bool g_DebugObjDeform = false; bool g_DebugLineMode = false; -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 var80078724nb = 0; s32 var80078728nb = 0; s32 var8007872cnb = 0; @@ -379,7 +379,7 @@ bool g_DebugManPos = false; bool g_DebugTurboMode = false; -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG bool g_DebugObjectives = false; bool g_DebugZBufferDisabled = false; s32 var80078740nb = 0; @@ -443,7 +443,7 @@ u32 var80078810nb = 0x70100000; s32 g_DebugScreenshotRgb = 0; s32 g_DebugScreenshotJpg = 0; -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG bool g_DebugIsMenuOpen = false; #endif @@ -473,7 +473,7 @@ f32 var80075dd8 = 1; void debugUpdateMenu(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; if (g_DebugCurMenu == DEBUGMENU_MAIN) { @@ -504,7 +504,7 @@ void debugUpdateMenu(void) #endif } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG void debugSaveSelectedOption(void) { g_DebugSelectedOptionsByMenu[g_DebugCurMenu] = dmenuGetSelectedOption(); @@ -539,7 +539,7 @@ void debug0f11944cnb(void) // not called bool debugProcessInput(s8 stickx, s8 sticky, u16 buttons, u16 buttonsthisframe) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; s32 prev; s32 tmp = 3; @@ -767,7 +767,7 @@ bool debugIsManPosEnabled(void) void debugSetManPos(bool enabled) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG g_DebugManPos = enabled; #endif } @@ -807,7 +807,7 @@ void debugSetLineModeEnabled(bool enabled) g_DebugLineMode = enabled; } -#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA +#ifndef DEBUG bool debug0f11ede0(void) // not called { return false; @@ -873,7 +873,7 @@ bool debug0f11ee40(void) // Unsure which functions are which between versions // as none are called by both versions -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG bool debug0f1199d8nb(void) // not called { return var80078758nb; @@ -972,7 +972,7 @@ bool debug0f11ee98(void) // not called return DEBUG_VALUE(var80078774nb, false); } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG void debug0f119a80nb(void) { var80078774nb = 0; @@ -989,7 +989,7 @@ bool debug0f11eea8(void) return DEBUG_VALUE(var80078780nb, false); } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG bool debug0f119aa4nb(void) { return false; @@ -1005,7 +1005,7 @@ bool debugDangerousProps(void) // Unsure which functions are which between versions // as none are called by both versions -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG bool debug0f119ab8nb(void) // not called { return var800787d8nb; @@ -1062,7 +1062,7 @@ u32 dprint() //------------------------------------------------------------------------------ // Reordered functions between versions -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG bool debug0f119b00nb(void) // not called { return var800787c0nb; diff --git a/src/game/lv.c b/src/game/lv.c index ccc370929..057f6ae2c 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -659,7 +659,7 @@ bool lvUpdateTrackedProp(struct trackedprop *trackedprop, s32 index) return true; } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG Gfx *lvRenderManPosIfEnabled(Gfx *gdl) { char bufroom[16]; @@ -1313,7 +1313,7 @@ Gfx *lvRender(Gfx *gdl) if (var80075d60 == 2) { gdl = playerRenderHud(gdl); -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG gdl = lvRenderManPosIfEnabled(gdl); #endif } else { diff --git a/src/game/pak.c b/src/game/pak.c index 3e9c9fe60..0e914c9c5 100644 --- a/src/game/pak.c +++ b/src/game/pak.c @@ -252,7 +252,7 @@ u32 var800a337c; u32 var800a3380; u32 var800a3384; -#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA +#ifndef DEBUG // This is likely g_DebugCutsceneLabelPtrs and/or g_DebugCutsceneLabelBuffers // but with reduced lengths u32 var800a3388; diff --git a/src/game/player.c b/src/game/player.c index cf515ce46..f3c4d9e7e 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -4046,7 +4046,7 @@ void playerTick(bool arg0) g_Vars.currentplayer->prop->rooms); } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (debug0f11ed88()) { debug0f119a14nb(); } diff --git a/src/game/title.c b/src/game/title.c index 5d4c110f1..87f5cdeaa 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -181,7 +181,9 @@ void titleInitLegal(void) g_TitleFastForward = false; #if VERSION == VERSION_PAL_BETA - if (g_CrashHasMessage) { + // Play a sound if player has successfully enabled the crash screen. + // This is done in mainInit by holding all four C buttons. + if (g_CrashEnabled) { sndStart(var80095200, SFX_8113, 0, -1, -1, -1.0f, -1, -1); } #endif diff --git a/src/game/vmstats.c b/src/game/vmstats.c index 985c7fa9c..6df2190cc 100644 --- a/src/game/vmstats.c +++ b/src/game/vmstats.c @@ -11,7 +11,7 @@ void vmPrintStatsIfEnabled(void) char buffer[80]; if (g_Is4Mb) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_VmShowStats) { dhudSetFgColour(0xff, 0xff, 0xff, 0xff); dhudSetBgColour(0, 0, 0, 0xff); diff --git a/src/include/lib/crash.h b/src/include/lib/crash.h index a5d22d358..3f72f5309 100644 --- a/src/include/lib/crash.h +++ b/src/include/lib/crash.h @@ -90,7 +90,7 @@ extern const char var700529ac[]; #if VERSION == VERSION_NTSC_BETA extern u8 g_CrashHasMessage; #else -extern bool g_CrashHasMessage; +extern bool g_CrashEnabled; #endif void crashSetMessage(char *string); diff --git a/src/lib/crash.c b/src/lib/crash.c index 200991d31..73cdcb838 100644 --- a/src/lib/crash.c +++ b/src/lib/crash.c @@ -32,7 +32,7 @@ OSMesg g_FaultMesg; #if VERSION == VERSION_NTSC_BETA u8 g_CrashHasMessage = false; #else -bool g_CrashHasMessage = false; +bool g_CrashEnabled = false; #endif s16 g_CrashCurX = 0; @@ -137,7 +137,7 @@ struct crashdescription g_CrashFpcsrDescriptions[] = { char (*g_CrashCharBuffer)[71] = NULL; -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG u32 var8005f138nb[] = { 0x00000000, 0x22220200, 0x55000000, 0x05f5f500, 0x27427200, 0x05124500, 0x34255300, 0x22000000, @@ -216,12 +216,12 @@ void faultproc(void *arg0) osSetIntMask(mask); #if VERSION == VERSION_PAL_BETA - if (!g_CrashHasMessage) { + if (!g_CrashEnabled) { continue; } #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG crashGenerate(curr, callstack, &tracelen); schedSetCrashedUnexpectedly(true); #endif @@ -233,8 +233,9 @@ u32 var8009710cnb; char *var80097110nb; char *var80097114nb; u32 var80097118nb[24]; -char var80097178nb[MAX_LINES + 1][71]; -#elif VERSION == VERSION_PAL_BETA +#endif + +#ifdef DEBUG char var80097178nb[MAX_LINES + 1][71]; #endif @@ -881,7 +882,7 @@ void crashRenderChar(s32 x, s32 y, char c) fbpos = g_CrashFrameBuffer + x + y * width; } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG a2 = var8005f138nb[c - ' ']; #else a2 = 0; @@ -934,7 +935,7 @@ void crashRenderChar(s32 x, s32 y, char c) void crashReset(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG g_CrashCharBuffer = var80097178nb; #else g_CrashCharBuffer = NULL; diff --git a/src/lib/debughud.c b/src/lib/debughud.c index 355dbe30d..cdd13a585 100644 --- a/src/lib/debughud.c +++ b/src/lib/debughud.c @@ -23,7 +23,7 @@ struct dhudchar { u8 paletteindex; }; -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG struct dhudchar g_DHudCharBuffer[NUM_COLS][NUM_ROWS]; Gfx g_DHudFgGbi[MAX_COLOURS]; Gfx g_DHudBgGbi[MAX_COLOURS]; @@ -91,21 +91,21 @@ Gfx g_DHudFgColour = gsDPSetPrimColor(0, 0, 0xff, 0xff, 0xff, 0); Gfx g_DHudBgColour = gsDPSetEnvColor(0, 0, 0, 0); #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 dhud00013fe0nb(s32 arg0, s32 arg1) { return 0; } #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 dhud00013ff0nb(s32 arg0, s32 arg1) { return 0; } #endif -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG void dhud00014000nb(void) { // empty @@ -114,7 +114,7 @@ void dhud00014000nb(void) void dhudInit(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 i; s32 x; s32 y; @@ -144,14 +144,14 @@ void dhudInit(void) void dhudReset(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { dhudClear(); } #endif } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG void dhudPutCharAt(s32 x, s32 y, char c) { s32 i; @@ -182,7 +182,7 @@ havepalette: void dhudResetPos(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { g_DHudPosX = g_DHudBaseX; g_DHudPosY = g_DHudBaseY; @@ -192,7 +192,7 @@ void dhudResetPos(void) void dhudClear(void) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 x; s32 y; @@ -215,7 +215,7 @@ void dhudClear(void) void dhudSetPos(s32 x, s32 y) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { x += g_DHudBaseX; y += g_DHudBaseY; @@ -232,7 +232,7 @@ void dhudSetPos(s32 x, s32 y) void dhudSetFgColour(s32 r, s32 g, s32 b, s32 a) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { g_DHudFgColour.words.w1 = r << 24 | g << 16 | b << 8 | (255 - a); } @@ -241,7 +241,7 @@ void dhudSetFgColour(s32 r, s32 g, s32 b, s32 a) void dhudSetBgColour(s32 r, s32 g, s32 b, s32 a) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { g_DHudBgColour.words.w1 = r << 24 | g << 16 | b << 8 | (255 - a); } @@ -250,7 +250,7 @@ void dhudSetBgColour(s32 r, s32 g, s32 b, s32 a) void dhudPrintChar(u8 c) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG s32 maxwidth = (viGetWidth() - 13) / CHAR_W; s32 maxheight = (viGetHeight() - 10) / CHAR_H; @@ -276,7 +276,7 @@ void dhudPrintChar(u8 c) #if VERSION != VERSION_PAL_BETA void dhudPrintCharAt(s32 x, s32 y, char c) { -#if VERSION == VERSION_NTSC_BETA +#ifdef DEBUG if (g_DHudInitialised) { dhudSetPos(x, y); dhudPrintChar(c); @@ -287,7 +287,7 @@ void dhudPrintCharAt(s32 x, s32 y, char c) void dhudPrintString(char *str) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { while (*str != '\0') { dhudPrintChar(*str++); @@ -299,7 +299,7 @@ void dhudPrintString(char *str) #if VERSION != VERSION_PAL_BETA void dhudPrintStringAt(s32 x, s32 y, char *str) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_DHudInitialised) { dhudSetPos(x, y); @@ -313,7 +313,7 @@ void dhudPrintStringAt(s32 x, s32 y, char *str) Gfx *dhudRender(Gfx *gdl) { -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (!g_DHudInitialised) { return gdl; } diff --git a/src/lib/main.c b/src/lib/main.c index 10dde08d4..4bafc03dc 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -376,16 +376,16 @@ void mainInit(void) } #if VERSION == VERSION_PAL_BETA - // In PAL beta, pressing all C buttons during poweron sets g_CrashHasMessage. - // If it's set, a sound effect is played on the legal screen. - // It's likely some debug code to see how far the game got before crashing. + // In PAL beta, pressing all C buttons during poweron sets g_CrashEnabled. + // If it's set, a sound effect is played on the legal screen to confirm + // and the crash screen will be shown if the game crashes. #define BUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS) if (joyGetButtons(0, BUTTON_MASK) == BUTTON_MASK || joyGetButtons(1, BUTTON_MASK) == BUTTON_MASK || joyGetButtons(2, BUTTON_MASK) == BUTTON_MASK || joyGetButtons(3, BUTTON_MASK) == BUTTON_MASK) { - g_CrashHasMessage = true; + g_CrashEnabled = true; } #endif @@ -1428,7 +1428,7 @@ void mainTick(void) gDPSetTile(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPSetTile(gdl++, G_IM_FMT_RGBA, G_IM_SIZ_4b, 0, 0x0100, 6, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_MainIsDebugMenuOpen || joyGetButtons(0, U_CBUTTONS | D_CBUTTONS) == (U_CBUTTONS | D_CBUTTONS)) { g_MainIsDebugMenuOpen = debugProcessInput(joyGetStickX(0), joyGetStickY(0), joyGetButtons(0, 0xffff), joyGetButtonsPressedThisFrame(0, 0xffff)); } else if (joyGetButtons(0, START_BUTTON) == 0) { @@ -1459,7 +1459,7 @@ void mainTick(void) gdl = lvRender(gdl); func000034e0(&gdl); -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (debugIsLineModeEnabled()) { gDPPipeSync(gdl++); gDPSetCycleType(gdl++, G_CYC_1CYCLE); @@ -1478,7 +1478,7 @@ void mainTick(void) gdl = profileRender(gdl); } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG if (g_MainIsDebugMenuOpen) { debugUpdateMenu(); gdl = dmenuRender(gdl); diff --git a/src/lib/mema.c b/src/lib/mema.c index a53e88ff1..ddf4b747d 100644 --- a/src/lib/mema.c +++ b/src/lib/mema.c @@ -219,12 +219,12 @@ void memaReset(void *heapaddr, u32 heapsize) { struct memaspace *space; -#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA +#ifndef DEBUG // Adding an amount to the heap size here means that mema can allocate past // the end of its heap. This would overflow into the gun names language - // file. Maybe this code was intended to be temporary while a developer - // figured out how much memory was needed, but they forgot to remove it? - // @dangerous + // file. Maybe the developers had an ifndef directive like we do, but they + // meant for it to be ifdef instead? + // @bug @dangerous heapsize += 0x8e0; #endif diff --git a/src/lib/memp.c b/src/lib/memp.c index 09bdea64b..8fa817f5b 100644 --- a/src/lib/memp.c +++ b/src/lib/memp.c @@ -268,7 +268,7 @@ u32 mempGetPoolFree(u8 poolnum, u32 bank) return pool->rightpos - pool->leftpos; } -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG u32 mempGetPoolSize(u8 poolnum, u32 bank) { struct memorypool *pool; diff --git a/src/lib/vm.c b/src/lib/vm.c index f1f10e4f5..ab3056646 100644 --- a/src/lib/vm.c +++ b/src/lib/vm.c @@ -76,7 +76,7 @@ u8 *g_VmMarker; u32 g_VmRamEnd; u32 g_VmStateTableEnd; -#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA +#ifdef DEBUG u8 g_VmShowStats = false; #endif