You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
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:
@@ -132,6 +132,11 @@
|
||||
#define UNLOCK_ALL
|
||||
#endif // COMPLETE_SAVE_FILE
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG_ASSERTIONS
|
||||
#define DEBUG_ASSERTIONS
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
/*****************
|
||||
* config_camera.h
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]]();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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); \
|
||||
|
||||
Reference in New Issue
Block a user