Introduce -DDEBUG to enable crash screen and debug menu

This commit is contained in:
Ryan Dwyer 2023-01-12 21:56:54 +10:00
parent 68f2cd6db6
commit 7f62d1d74a
17 changed files with 92 additions and 75 deletions

View File

@ -68,6 +68,13 @@ ROMALLOCATION_GAME = 0x144ee0
ROM_SIZE := 32 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. # The VERSION constant is used in the source to handle version-specific code.
@ -112,6 +119,7 @@ ROMALLOCATION_DATA = 0x015000
ROMALLOCATION_LIB = 0x038800 ROMALLOCATION_LIB = 0x038800
ROM_SIZE = 32 ROM_SIZE = 32
DEBUG = 0
ifeq ($(ROMID), ntsc-beta) ifeq ($(ROMID), ntsc-beta)
PAL = 0 PAL = 0
@ -119,6 +127,7 @@ ifeq ($(ROMID), ntsc-beta)
ROMALLOCATION_DATA = 0x012000 ROMALLOCATION_DATA = 0x012000
ROMALLOCATION_LIB = 0x02f800 ROMALLOCATION_LIB = 0x02f800
ROMALLOCATION_GAME = 0x105000 ROMALLOCATION_GAME = 0x105000
DEBUG = 1
endif endif
ifeq ($(ROMID), ntsc-1.0) ifeq ($(ROMID), ntsc-1.0)
PAL = 0 PAL = 0
@ -138,6 +147,7 @@ ifeq ($(ROMID), pal-beta)
ROMALLOCATION_GAME = 0x1306f0 ROMALLOCATION_GAME = 0x1306f0
ZIPMAGIC = 0x0c00 ZIPMAGIC = 0x0c00
COPYLEN = 6 COPYLEN = 6
DEBUG = 1
endif endif
ifeq ($(ROMID), pal-final) ifeq ($(ROMID), pal-final)
PAL = 1 PAL = 1
@ -161,6 +171,10 @@ DEFINES := \
PIRACYCHECKS=$(PIRACYCHECKS) \ PIRACYCHECKS=$(PIRACYCHECKS) \
ROM_SIZE=$(ROM_SIZE) ROM_SIZE=$(ROM_SIZE)
ifeq ($(DEBUG),1)
DEFINES := $(DEFINES) DEBUG=1
endif
C_DEFINES := $(foreach d,$(DEFINES),-D$(d)) C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
AS_DEFINES := $(foreach d,$(DEFINES),--defsym $(d)) --defsym _LANGUAGE_ASSEMBLY=1 AS_DEFINES := $(foreach d,$(DEFINES),--defsym $(d)) --defsym _LANGUAGE_ASSEMBLY=1

View File

@ -118,7 +118,7 @@ void challengeDetermineUnlockedFeatures(void)
flag = 1; flag = 1;
numgifted++; numgifted++;
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
else if (debugIsAllChallengesEnabled()) { else if (debugIsAllChallengesEnabled()) {
flag = 1; flag = 1;
} }

View File

@ -2637,7 +2637,7 @@ s32 chrTick(struct prop *prop)
#endif #endif
if (needsupdate) { if (needsupdate) {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
debug0f1199f0nb(); debug0f1199f0nb();
#endif #endif

View File

@ -6,7 +6,7 @@
#include "data.h" #include "data.h"
#include "types.h" #include "types.h"
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 g_DMenuSelectedOption = 0; s32 g_DMenuSelectedOption = 0;
s32 g_DMenuNumOptions = 0; s32 g_DMenuNumOptions = 0;
char **g_DMenuCurLabels = NULL; char **g_DMenuCurLabels = NULL;
@ -18,7 +18,7 @@ u8 g_DMenuXScales[] = { 4, 4, 4 };
u8 g_DMenuYScales[] = { 7, 7, 7 }; u8 g_DMenuYScales[] = { 7, 7, 7 };
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
void dmenu0f118c80nb(void) void dmenu0f118c80nb(void)
{ {
// empty // empty
@ -27,14 +27,14 @@ void dmenu0f118c80nb(void)
void dmenuSetScaleIndex(s32 index) void dmenuSetScaleIndex(s32 index)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
g_DMenuScaleIndex = index; g_DMenuScaleIndex = index;
#endif #endif
} }
void dmenuSetMenu(char **labels, s32 (*positions)[2], s32 *offsets) void dmenuSetMenu(char **labels, s32 (*positions)[2], s32 *offsets)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 numgroups; s32 numgroups;
g_DMenuCurLabels = labels; g_DMenuCurLabels = labels;
@ -50,7 +50,7 @@ void dmenuSetMenu(char **labels, s32 (*positions)[2], s32 *offsets)
Gfx *dmenuRender(Gfx *gdl) Gfx *dmenuRender(Gfx *gdl)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 xscale = g_DMenuXScales[g_DMenuScaleIndex]; s32 xscale = g_DMenuXScales[g_DMenuScaleIndex];
s32 yscale = g_DMenuYScales[g_DMenuScaleIndex]; s32 yscale = g_DMenuYScales[g_DMenuScaleIndex];
s32 i; s32 i;
@ -83,7 +83,7 @@ Gfx *dmenuRender(Gfx *gdl)
return gdl; return gdl;
} }
#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA #ifndef DEBUG
void debug0f11ed10(s32 arg0, s32 arg1, s32 arg2) void debug0f11ed10(s32 arg0, s32 arg1, s32 arg2)
{ {
// empty // empty
@ -92,7 +92,7 @@ void debug0f11ed10(s32 arg0, s32 arg1, s32 arg2)
s32 dmenuGetSelectedOption(void) s32 dmenuGetSelectedOption(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
return g_DMenuSelectedOption; return g_DMenuSelectedOption;
#else #else
return 0; return 0;
@ -101,14 +101,14 @@ s32 dmenuGetSelectedOption(void)
void dmenuSetSelectedOption(s32 option) void dmenuSetSelectedOption(s32 option)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
g_DMenuSelectedOption = option; g_DMenuSelectedOption = option;
#endif #endif
} }
void dmenuNavigateUp(void) void dmenuNavigateUp(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
g_DMenuSelectedOption--; g_DMenuSelectedOption--;
@ -133,7 +133,7 @@ void dmenuNavigateUp(void)
void dmenuNavigateDown(void) void dmenuNavigateDown(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
g_DMenuSelectedOption++; g_DMenuSelectedOption++;
@ -158,7 +158,7 @@ void dmenuNavigateDown(void)
void dmenuNavigateRight(void) void dmenuNavigateRight(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
if (g_DMenuSelectedOption < g_DMenuCurOffsets[0]) { if (g_DMenuSelectedOption < g_DMenuCurOffsets[0]) {
@ -195,7 +195,7 @@ void dmenuNavigateRight(void)
void dmenuNavigateLeft(void) void dmenuNavigateLeft(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
// First group // First group

View File

@ -37,7 +37,7 @@
#endif #endif
// The DEBUG_VALUE macro is used for readability. // 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) #define DEBUG_VALUE(valueifdebug, valueifnotdebug) (valueifdebug)
#else #else
#define DEBUG_VALUE(valueifdebug, valueifnotdebug) (valueifnotdebug) #define DEBUG_VALUE(valueifdebug, valueifnotdebug) (valueifnotdebug)
@ -50,7 +50,7 @@ s32 var80075d68 = 2;
s32 var800786f4nb = 2; s32 var800786f4nb = 2;
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 g_DebugMenuOffsets[] = { s32 g_DebugMenuOffsets[] = {
15, 15,
30, 30,
@ -355,7 +355,7 @@ s32 var80075d68 = 2;
s32 var800786f4nb = 2; s32 var800786f4nb = 2;
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 g_DebugProfileMode = 0; s32 g_DebugProfileMode = 0;
bool g_DebugRenderBg = true; bool g_DebugRenderBg = true;
bool g_DebugRenderProps = true; bool g_DebugRenderProps = true;
@ -370,7 +370,7 @@ bool g_DebugObjDeform = false;
bool g_DebugLineMode = false; bool g_DebugLineMode = false;
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 var80078724nb = 0; s32 var80078724nb = 0;
s32 var80078728nb = 0; s32 var80078728nb = 0;
s32 var8007872cnb = 0; s32 var8007872cnb = 0;
@ -379,7 +379,7 @@ bool g_DebugManPos = false;
bool g_DebugTurboMode = false; bool g_DebugTurboMode = false;
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
bool g_DebugObjectives = false; bool g_DebugObjectives = false;
bool g_DebugZBufferDisabled = false; bool g_DebugZBufferDisabled = false;
s32 var80078740nb = 0; s32 var80078740nb = 0;
@ -443,7 +443,7 @@ u32 var80078810nb = 0x70100000;
s32 g_DebugScreenshotRgb = 0; s32 g_DebugScreenshotRgb = 0;
s32 g_DebugScreenshotJpg = 0; s32 g_DebugScreenshotJpg = 0;
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
bool g_DebugIsMenuOpen = false; bool g_DebugIsMenuOpen = false;
#endif #endif
@ -473,7 +473,7 @@ f32 var80075dd8 = 1;
void debugUpdateMenu(void) void debugUpdateMenu(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
if (g_DebugCurMenu == DEBUGMENU_MAIN) { if (g_DebugCurMenu == DEBUGMENU_MAIN) {
@ -504,7 +504,7 @@ void debugUpdateMenu(void)
#endif #endif
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
void debugSaveSelectedOption(void) void debugSaveSelectedOption(void)
{ {
g_DebugSelectedOptionsByMenu[g_DebugCurMenu] = dmenuGetSelectedOption(); g_DebugSelectedOptionsByMenu[g_DebugCurMenu] = dmenuGetSelectedOption();
@ -539,7 +539,7 @@ void debug0f11944cnb(void) // not called
bool debugProcessInput(s8 stickx, s8 sticky, u16 buttons, u16 buttonsthisframe) bool debugProcessInput(s8 stickx, s8 sticky, u16 buttons, u16 buttonsthisframe)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
s32 prev; s32 prev;
s32 tmp = 3; s32 tmp = 3;
@ -767,7 +767,7 @@ bool debugIsManPosEnabled(void)
void debugSetManPos(bool enabled) void debugSetManPos(bool enabled)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
g_DebugManPos = enabled; g_DebugManPos = enabled;
#endif #endif
} }
@ -807,7 +807,7 @@ void debugSetLineModeEnabled(bool enabled)
g_DebugLineMode = enabled; g_DebugLineMode = enabled;
} }
#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA #ifndef DEBUG
bool debug0f11ede0(void) // not called bool debug0f11ede0(void) // not called
{ {
return false; return false;
@ -873,7 +873,7 @@ bool debug0f11ee40(void)
// Unsure which functions are which between versions // Unsure which functions are which between versions
// as none are called by both versions // as none are called by both versions
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
bool debug0f1199d8nb(void) // not called bool debug0f1199d8nb(void) // not called
{ {
return var80078758nb; return var80078758nb;
@ -972,7 +972,7 @@ bool debug0f11ee98(void) // not called
return DEBUG_VALUE(var80078774nb, false); return DEBUG_VALUE(var80078774nb, false);
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
void debug0f119a80nb(void) void debug0f119a80nb(void)
{ {
var80078774nb = 0; var80078774nb = 0;
@ -989,7 +989,7 @@ bool debug0f11eea8(void)
return DEBUG_VALUE(var80078780nb, false); return DEBUG_VALUE(var80078780nb, false);
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
bool debug0f119aa4nb(void) bool debug0f119aa4nb(void)
{ {
return false; return false;
@ -1005,7 +1005,7 @@ bool debugDangerousProps(void)
// Unsure which functions are which between versions // Unsure which functions are which between versions
// as none are called by both versions // as none are called by both versions
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
bool debug0f119ab8nb(void) // not called bool debug0f119ab8nb(void) // not called
{ {
return var800787d8nb; return var800787d8nb;
@ -1062,7 +1062,7 @@ u32 dprint()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Reordered functions between versions // Reordered functions between versions
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
bool debug0f119b00nb(void) // not called bool debug0f119b00nb(void) // not called
{ {
return var800787c0nb; return var800787c0nb;

View File

@ -659,7 +659,7 @@ bool lvUpdateTrackedProp(struct trackedprop *trackedprop, s32 index)
return true; return true;
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
Gfx *lvRenderManPosIfEnabled(Gfx *gdl) Gfx *lvRenderManPosIfEnabled(Gfx *gdl)
{ {
char bufroom[16]; char bufroom[16];
@ -1313,7 +1313,7 @@ Gfx *lvRender(Gfx *gdl)
if (var80075d60 == 2) { if (var80075d60 == 2) {
gdl = playerRenderHud(gdl); gdl = playerRenderHud(gdl);
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
gdl = lvRenderManPosIfEnabled(gdl); gdl = lvRenderManPosIfEnabled(gdl);
#endif #endif
} else { } else {

View File

@ -252,7 +252,7 @@ u32 var800a337c;
u32 var800a3380; u32 var800a3380;
u32 var800a3384; u32 var800a3384;
#if VERSION != VERSION_NTSC_BETA && VERSION != VERSION_PAL_BETA #ifndef DEBUG
// This is likely g_DebugCutsceneLabelPtrs and/or g_DebugCutsceneLabelBuffers // This is likely g_DebugCutsceneLabelPtrs and/or g_DebugCutsceneLabelBuffers
// but with reduced lengths // but with reduced lengths
u32 var800a3388; u32 var800a3388;

View File

@ -4046,7 +4046,7 @@ void playerTick(bool arg0)
g_Vars.currentplayer->prop->rooms); g_Vars.currentplayer->prop->rooms);
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (debug0f11ed88()) { if (debug0f11ed88()) {
debug0f119a14nb(); debug0f119a14nb();
} }

View File

@ -181,7 +181,9 @@ void titleInitLegal(void)
g_TitleFastForward = false; g_TitleFastForward = false;
#if VERSION == VERSION_PAL_BETA #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); sndStart(var80095200, SFX_8113, 0, -1, -1, -1.0f, -1, -1);
} }
#endif #endif

View File

@ -11,7 +11,7 @@ void vmPrintStatsIfEnabled(void)
char buffer[80]; char buffer[80];
if (g_Is4Mb) { if (g_Is4Mb) {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_VmShowStats) { if (g_VmShowStats) {
dhudSetFgColour(0xff, 0xff, 0xff, 0xff); dhudSetFgColour(0xff, 0xff, 0xff, 0xff);
dhudSetBgColour(0, 0, 0, 0xff); dhudSetBgColour(0, 0, 0, 0xff);

View File

@ -90,7 +90,7 @@ extern const char var700529ac[];
#if VERSION == VERSION_NTSC_BETA #if VERSION == VERSION_NTSC_BETA
extern u8 g_CrashHasMessage; extern u8 g_CrashHasMessage;
#else #else
extern bool g_CrashHasMessage; extern bool g_CrashEnabled;
#endif #endif
void crashSetMessage(char *string); void crashSetMessage(char *string);

View File

@ -32,7 +32,7 @@ OSMesg g_FaultMesg;
#if VERSION == VERSION_NTSC_BETA #if VERSION == VERSION_NTSC_BETA
u8 g_CrashHasMessage = false; u8 g_CrashHasMessage = false;
#else #else
bool g_CrashHasMessage = false; bool g_CrashEnabled = false;
#endif #endif
s16 g_CrashCurX = 0; s16 g_CrashCurX = 0;
@ -137,7 +137,7 @@ struct crashdescription g_CrashFpcsrDescriptions[] = {
char (*g_CrashCharBuffer)[71] = NULL; char (*g_CrashCharBuffer)[71] = NULL;
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
u32 var8005f138nb[] = { u32 var8005f138nb[] = {
0x00000000, 0x22220200, 0x55000000, 0x05f5f500, 0x00000000, 0x22220200, 0x55000000, 0x05f5f500,
0x27427200, 0x05124500, 0x34255300, 0x22000000, 0x27427200, 0x05124500, 0x34255300, 0x22000000,
@ -216,12 +216,12 @@ void faultproc(void *arg0)
osSetIntMask(mask); osSetIntMask(mask);
#if VERSION == VERSION_PAL_BETA #if VERSION == VERSION_PAL_BETA
if (!g_CrashHasMessage) { if (!g_CrashEnabled) {
continue; continue;
} }
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
crashGenerate(curr, callstack, &tracelen); crashGenerate(curr, callstack, &tracelen);
schedSetCrashedUnexpectedly(true); schedSetCrashedUnexpectedly(true);
#endif #endif
@ -233,8 +233,9 @@ u32 var8009710cnb;
char *var80097110nb; char *var80097110nb;
char *var80097114nb; char *var80097114nb;
u32 var80097118nb[24]; u32 var80097118nb[24];
char var80097178nb[MAX_LINES + 1][71]; #endif
#elif VERSION == VERSION_PAL_BETA
#ifdef DEBUG
char var80097178nb[MAX_LINES + 1][71]; char var80097178nb[MAX_LINES + 1][71];
#endif #endif
@ -881,7 +882,7 @@ void crashRenderChar(s32 x, s32 y, char c)
fbpos = g_CrashFrameBuffer + x + y * width; fbpos = g_CrashFrameBuffer + x + y * width;
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
a2 = var8005f138nb[c - ' ']; a2 = var8005f138nb[c - ' '];
#else #else
a2 = 0; a2 = 0;
@ -934,7 +935,7 @@ void crashRenderChar(s32 x, s32 y, char c)
void crashReset(void) void crashReset(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
g_CrashCharBuffer = var80097178nb; g_CrashCharBuffer = var80097178nb;
#else #else
g_CrashCharBuffer = NULL; g_CrashCharBuffer = NULL;

View File

@ -23,7 +23,7 @@ struct dhudchar {
u8 paletteindex; u8 paletteindex;
}; };
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
struct dhudchar g_DHudCharBuffer[NUM_COLS][NUM_ROWS]; struct dhudchar g_DHudCharBuffer[NUM_COLS][NUM_ROWS];
Gfx g_DHudFgGbi[MAX_COLOURS]; Gfx g_DHudFgGbi[MAX_COLOURS];
Gfx g_DHudBgGbi[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); Gfx g_DHudBgColour = gsDPSetEnvColor(0, 0, 0, 0);
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 dhud00013fe0nb(s32 arg0, s32 arg1) s32 dhud00013fe0nb(s32 arg0, s32 arg1)
{ {
return 0; return 0;
} }
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 dhud00013ff0nb(s32 arg0, s32 arg1) s32 dhud00013ff0nb(s32 arg0, s32 arg1)
{ {
return 0; return 0;
} }
#endif #endif
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
void dhud00014000nb(void) void dhud00014000nb(void)
{ {
// empty // empty
@ -114,7 +114,7 @@ void dhud00014000nb(void)
void dhudInit(void) void dhudInit(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 i; s32 i;
s32 x; s32 x;
s32 y; s32 y;
@ -144,14 +144,14 @@ void dhudInit(void)
void dhudReset(void) void dhudReset(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
dhudClear(); dhudClear();
} }
#endif #endif
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
void dhudPutCharAt(s32 x, s32 y, char c) void dhudPutCharAt(s32 x, s32 y, char c)
{ {
s32 i; s32 i;
@ -182,7 +182,7 @@ havepalette:
void dhudResetPos(void) void dhudResetPos(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
g_DHudPosX = g_DHudBaseX; g_DHudPosX = g_DHudBaseX;
g_DHudPosY = g_DHudBaseY; g_DHudPosY = g_DHudBaseY;
@ -192,7 +192,7 @@ void dhudResetPos(void)
void dhudClear(void) void dhudClear(void)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 x; s32 x;
s32 y; s32 y;
@ -215,7 +215,7 @@ void dhudClear(void)
void dhudSetPos(s32 x, s32 y) void dhudSetPos(s32 x, s32 y)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
x += g_DHudBaseX; x += g_DHudBaseX;
y += g_DHudBaseY; y += g_DHudBaseY;
@ -232,7 +232,7 @@ void dhudSetPos(s32 x, s32 y)
void dhudSetFgColour(s32 r, s32 g, s32 b, s32 a) void dhudSetFgColour(s32 r, s32 g, s32 b, s32 a)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
g_DHudFgColour.words.w1 = r << 24 | g << 16 | b << 8 | (255 - a); 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) void dhudSetBgColour(s32 r, s32 g, s32 b, s32 a)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
g_DHudBgColour.words.w1 = r << 24 | g << 16 | b << 8 | (255 - a); 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) void dhudPrintChar(u8 c)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
s32 maxwidth = (viGetWidth() - 13) / CHAR_W; s32 maxwidth = (viGetWidth() - 13) / CHAR_W;
s32 maxheight = (viGetHeight() - 10) / CHAR_H; s32 maxheight = (viGetHeight() - 10) / CHAR_H;
@ -276,7 +276,7 @@ void dhudPrintChar(u8 c)
#if VERSION != VERSION_PAL_BETA #if VERSION != VERSION_PAL_BETA
void dhudPrintCharAt(s32 x, s32 y, char c) void dhudPrintCharAt(s32 x, s32 y, char c)
{ {
#if VERSION == VERSION_NTSC_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
dhudSetPos(x, y); dhudSetPos(x, y);
dhudPrintChar(c); dhudPrintChar(c);
@ -287,7 +287,7 @@ void dhudPrintCharAt(s32 x, s32 y, char c)
void dhudPrintString(char *str) void dhudPrintString(char *str)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
while (*str != '\0') { while (*str != '\0') {
dhudPrintChar(*str++); dhudPrintChar(*str++);
@ -299,7 +299,7 @@ void dhudPrintString(char *str)
#if VERSION != VERSION_PAL_BETA #if VERSION != VERSION_PAL_BETA
void dhudPrintStringAt(s32 x, s32 y, char *str) void dhudPrintStringAt(s32 x, s32 y, char *str)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_DHudInitialised) { if (g_DHudInitialised) {
dhudSetPos(x, y); dhudSetPos(x, y);
@ -313,7 +313,7 @@ void dhudPrintStringAt(s32 x, s32 y, char *str)
Gfx *dhudRender(Gfx *gdl) Gfx *dhudRender(Gfx *gdl)
{ {
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (!g_DHudInitialised) { if (!g_DHudInitialised) {
return gdl; return gdl;
} }

View File

@ -376,16 +376,16 @@ void mainInit(void)
} }
#if VERSION == VERSION_PAL_BETA #if VERSION == VERSION_PAL_BETA
// In PAL beta, pressing all C buttons during poweron sets g_CrashHasMessage. // 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. // If it's set, a sound effect is played on the legal screen to confirm
// It's likely some debug code to see how far the game got before crashing. // and the crash screen will be shown if the game crashes.
#define BUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS) #define BUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS)
if (joyGetButtons(0, BUTTON_MASK) == BUTTON_MASK if (joyGetButtons(0, BUTTON_MASK) == BUTTON_MASK
|| joyGetButtons(1, BUTTON_MASK) == BUTTON_MASK || joyGetButtons(1, BUTTON_MASK) == BUTTON_MASK
|| joyGetButtons(2, BUTTON_MASK) == BUTTON_MASK || joyGetButtons(2, BUTTON_MASK) == BUTTON_MASK
|| joyGetButtons(3, BUTTON_MASK) == BUTTON_MASK) { || joyGetButtons(3, BUTTON_MASK) == BUTTON_MASK) {
g_CrashHasMessage = true; g_CrashEnabled = true;
} }
#endif #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_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); 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)) { 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)); g_MainIsDebugMenuOpen = debugProcessInput(joyGetStickX(0), joyGetStickY(0), joyGetButtons(0, 0xffff), joyGetButtonsPressedThisFrame(0, 0xffff));
} else if (joyGetButtons(0, START_BUTTON) == 0) { } else if (joyGetButtons(0, START_BUTTON) == 0) {
@ -1459,7 +1459,7 @@ void mainTick(void)
gdl = lvRender(gdl); gdl = lvRender(gdl);
func000034e0(&gdl); func000034e0(&gdl);
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (debugIsLineModeEnabled()) { if (debugIsLineModeEnabled()) {
gDPPipeSync(gdl++); gDPPipeSync(gdl++);
gDPSetCycleType(gdl++, G_CYC_1CYCLE); gDPSetCycleType(gdl++, G_CYC_1CYCLE);
@ -1478,7 +1478,7 @@ void mainTick(void)
gdl = profileRender(gdl); gdl = profileRender(gdl);
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
if (g_MainIsDebugMenuOpen) { if (g_MainIsDebugMenuOpen) {
debugUpdateMenu(); debugUpdateMenu();
gdl = dmenuRender(gdl); gdl = dmenuRender(gdl);

View File

@ -219,12 +219,12 @@ void memaReset(void *heapaddr, u32 heapsize)
{ {
struct memaspace *space; 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 // 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 // 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 // file. Maybe the developers had an ifndef directive like we do, but they
// figured out how much memory was needed, but they forgot to remove it? // meant for it to be ifdef instead?
// @dangerous // @bug @dangerous
heapsize += 0x8e0; heapsize += 0x8e0;
#endif #endif

View File

@ -268,7 +268,7 @@ u32 mempGetPoolFree(u8 poolnum, u32 bank)
return pool->rightpos - pool->leftpos; return pool->rightpos - pool->leftpos;
} }
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
u32 mempGetPoolSize(u8 poolnum, u32 bank) u32 mempGetPoolSize(u8 poolnum, u32 bank)
{ {
struct memorypool *pool; struct memorypool *pool;

View File

@ -76,7 +76,7 @@ u8 *g_VmMarker;
u32 g_VmRamEnd; u32 g_VmRamEnd;
u32 g_VmStateTableEnd; u32 g_VmStateTableEnd;
#if VERSION == VERSION_NTSC_BETA || VERSION == VERSION_PAL_BETA #ifdef DEBUG
u8 g_VmShowStats = false; u8 g_VmShowStats = false;
#endif #endif