diff --git a/src/boot/libu64/debug.c b/src/boot/libu64/debug.c index 7398275472..69dec97d7d 100644 --- a/src/boot/libu64/debug.c +++ b/src/boot/libu64/debug.c @@ -1,11 +1,33 @@ #include "global.h" #include "fault.h" +#if MM_VERSION < N64_US || DEBUG_FEATURES +#define DEBUG_PRINTF osSyncPrintf +#elif IDO_PRINTF_WORKAROUND +#define DEBUG_PRINTF(args) (void)0 +#else +#define DEBUG_PRINTF(format, ...) (void)0 +#endif + +#if MM_VERSION < N64_US +f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, + const char* maxName, f32 max) { + if (value < min || max < value) { + osSyncPrintf("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, + maxName, max); + } + return value; +} +#endif + NORETURN void _dbg_hungup(const char* file, int lineNum) { - osGetThreadId(NULL); + OSId threadId = osGetThreadId(NULL); + + DEBUG_PRINTF("*** HungUp in thread %d, [%s:%d] ***\n", threadId, file, lineNum); Fault_AddHungupAndCrash(file, lineNum); } NORETURN void Reset(void) { + DEBUG_PRINTF("*** Reset ***\n"); Fault_AddHungupAndCrash("Reset", 0); } diff --git a/tools/disasm/n64-jp-1.1/functions.txt b/tools/disasm/n64-jp-1.1/functions.txt index 7903d5cefe..aaa8a9578d 100644 --- a/tools/disasm/n64-jp-1.1/functions.txt +++ b/tools/disasm/n64-jp-1.1/functions.txt @@ -154,7 +154,7 @@ GfxPrint_VPrintf = 0x8008699C; // type:func size:0x20 GfxPrint_Printf = 0x800869BC; // type:func size:0x34 MtxConv_F2L = 0x800869F0; // type:func size:0x148 MtxConv_L2F = 0x80086B38; // type:func size:0x28 -func_80086B60_unknown = 0x80086B60; // type:func size:0x98 +LogUtils_CheckFloatRange = 0x80086B60; // type:func size:0x98 _dbg_hungup = 0x80086BF8; // type:func size:0x4C Reset = 0x80086C44; // type:func size:0x3C SystemHeap_Malloc = 0x80086C80; // type:func size:0x30