You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Add libultra error handling as an assert
This commit is contained in:
@@ -44,7 +44,7 @@ WARNINGS += -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-implicit-fu
|
||||
CFLAGS := -std=gnu23 -G 0 -c -fno-inline -nostdinc -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf -funsigned-char $(WARNINGS)
|
||||
CFLAGS += -fno-strict-aliasing # TODO: Try adjusting code to remove this
|
||||
ASFLAGS := -w -nostdinc -c -G 0 -march=vr4300 -mabi=32 -mgp32 -mfp32 -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_MIPS_SIM=1 -D_ULTRA64
|
||||
CPPFLAGS = -DMODERN_CC -D_MIPS_SZLONG=32 -D__USE_ISOC99 $(GBIDEFINE) $(VERSION_DEFINE) $(DEBUGFLAG)
|
||||
CPPFLAGS = -DMODERN_CC -D_MIPS_SZLONG=32 -D__USE_ISOC99 $(GBIDEFINE) $(VERSION_DEFINE) $(DEBUGFLAG) -D_DEBUG
|
||||
IINC = -I . -I $(WORKING_DIR)/include -I $(WORKING_DIR)/include/compiler/modern_gcc -I $(WORKING_DIR)/include/PR
|
||||
MIPS_VERSION := -mips3
|
||||
ASOPTFLAGS :=
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
void __assertBreak(void);
|
||||
|
||||
void __assert(const char* exp, const char* filename, int line) {
|
||||
#ifndef _FINALROM
|
||||
osSyncPrintf("\nASSERTION FAULT: %s, %d: \"%s\"\n", filename, line, exp);
|
||||
__assertBreak; // Doesn't actually do anything, but is needed for matching
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "PR/os_version.h"
|
||||
|
||||
#if !defined(_FINALROM) || BUILD_VERSION < VERSION_J
|
||||
#include "sys/asm.h"
|
||||
#include "sys/regdef.h"
|
||||
|
||||
@@ -11,4 +10,3 @@ LEAF(__assertBreak)
|
||||
j ra
|
||||
END(__assertBreak)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include "PRinternal/macros.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
#ifndef _FINALROM
|
||||
|
||||
void __osSyncVPrintf(const char* fmt, va_list args);
|
||||
|
||||
static u32 errorLogData[19] ALIGNED(0x8);
|
||||
@@ -23,6 +21,8 @@ static void __commonErrorHandler(s16 code, s16 numArgs, ...);
|
||||
OSErrorHandler __osCommonHandler = __commonErrorHandler;
|
||||
|
||||
char NULSTR[] = "";
|
||||
extern char *assertMsg;
|
||||
static char errorFmt[256];
|
||||
|
||||
const char* __os_error_message[] = {
|
||||
NULSTR,
|
||||
@@ -183,11 +183,13 @@ void __commonErrorHandler(s16 code, s16 numArgs, ...) {
|
||||
fmt = __os_error_message[code];
|
||||
va_start(argPtr, numArgs);
|
||||
|
||||
sprintf(errorFmt, fmt, argPtr);
|
||||
assertMsg = &errorFmt[0];
|
||||
|
||||
osSyncPrintf("0x%08X (%04d):", osGetCount(), code);
|
||||
__osSyncVPrintf(fmt, argPtr);
|
||||
osSyncPrintf("\n");
|
||||
|
||||
va_end(argPtr);
|
||||
__builtin_trap();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "PR/os_version.h"
|
||||
|
||||
#if !defined(_FINALROM) || BUILD_VERSION < VERSION_J
|
||||
#include "sys/asm.h"
|
||||
#include "sys/regdef.h"
|
||||
#include "PR/os_version.h"
|
||||
@@ -30,4 +29,3 @@ _kmc_mode:
|
||||
j ra
|
||||
END(__osError)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user