Add assert for beginning geo layout command (#738)

* geo layout assert

* new idea

* Change assert message, add crash screen newline support, and change debug safeguards

---------

Co-authored-by: Gregory Heskett <gheskett@gmail.com>
This commit is contained in:
arthurtilly
2024-01-22 07:38:00 +13:00
committed by GitHub
parent 15a81037ef
commit 5ba00edf20
5 changed files with 17 additions and 4 deletions

View File

@@ -132,6 +132,11 @@
#define UNLOCK_ALL
#endif // COMPLETE_SAVE_FILE
#ifdef DEBUG
#undef DEBUG_ASSERTIONS
#define DEBUG_ASSERTIONS
#endif // DEBUG
/*****************
* config_camera.h

View File

@@ -58,6 +58,8 @@ enum GeoLayoutCommands {
/*0x1E*/ GEO_CMD_NOP_1E,
/*0x1F*/ GEO_CMD_NOP_1F,
/*0x20*/ GEO_CMD_NODE_CULLING_RADIUS,
GEO_CMD_COUNT,
};
// geo layout macros

View File

@@ -5,6 +5,7 @@
#include "math_util.h"
#include "game/memory.h"
#include "graph_node.h"
#include "game/debug.h"
typedef void (*GeoLayoutCommandProc)(void);
@@ -771,6 +772,7 @@ struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
gGeoLayoutStack[1] = 0;
while (gGeoLayoutCommand != NULL) {
assert((gGeoLayoutCommand[0x00] < GEO_CMD_COUNT), "Invalid or unloaded geo layout detected.");
GeoLayoutJumpTable[gGeoLayoutCommand[0x00]]();
}

View File

@@ -133,6 +133,7 @@ void crash_screen_print(s32 x, s32 y, const char *fmt, ...) {
char *ptr;
u32 glyph;
s32 size;
s32 xOffset = x;
char buf[0x108];
bzero(&buf, sizeof(buf));
@@ -147,12 +148,15 @@ void crash_screen_print(s32 x, s32 y, const char *fmt, ...) {
while (*ptr) {
glyph = gCrashScreenCharToGlyph[*ptr & 0x7f];
if (glyph != 0xff) {
crash_screen_draw_glyph(x, y, glyph);
if (*ptr == '\n') {
xOffset = x;
y += 10;
} else if (glyph != 0xff) {
crash_screen_draw_glyph(xOffset, y, glyph);
}
ptr++;
x += 6;
xOffset += 6;
}
}

View File

@@ -62,7 +62,7 @@ extern void __n64Assert(char *fileName, u32 lineNum, char *message);
/**
* Will cause a crash if cond is not true, and DEBUG is defined (allows for quick removal of littered asserts)
*/
#if defined(DEBUG) || defined(DEBUG_ASSERTIONS)
#ifdef DEBUG_ASSERTIONS
#define assert(cond, message) do {\
if ((cond) == FALSE) { \
error(message); \