wiiu: keep asserts in master builds

This commit is contained in:
GaryOderNichts 2021-01-31 23:31:02 +01:00
parent b6c01f839f
commit 15eafe7642
3 changed files with 12 additions and 6 deletions

View File

@ -367,6 +367,9 @@ void re3_usererror(const char *format, ...);
#define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__) #define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
#endif #endif
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
#ifdef __MWERKS__ #ifdef __MWERKS__
void debug(char *f, ...); void debug(char *f, ...);
void Error(char *f, ...); void Error(char *f, ...);
@ -376,7 +379,7 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__) #define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__)
#define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__) #define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__)
#ifndef MASTER #ifndef MASTER
#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__) #define TRACE(f, ...) re3_trace(__FILENAME__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
#define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__) #define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__)
#else #else
#define TRACE(f, ...) #define TRACE(f, ...)
@ -385,8 +388,8 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
#endif #endif
#undef assert #undef assert
#ifndef MASTER #if !defined(MASTER) || defined(__WIIU__)
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) ) #define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILENAME__, __LINE__, __FUNCTION__), 0) )
#else #else
#define assert(_Expression) #define assert(_Expression)
#endif #endif

View File

@ -156,7 +156,7 @@ enum Config {
// This is enabled for all released games except mobile // This is enabled for all released games except mobile
// any debug stuff that is only left in mobile, is not in MASTER // any debug stuff that is only left in mobile, is not in MASTER
//#define MASTER #define MASTER
// once and for all: // once and for all:
// pc: FINAL & MASTER // pc: FINAL & MASTER

View File

@ -984,7 +984,7 @@ const int re3_buffsize = 1024;
static char re3_buff[re3_buffsize]; static char re3_buff[re3_buffsize];
#endif #endif
#ifndef MASTER #if !defined(MASTER) || defined(__WIIU__)
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func) void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -1034,7 +1034,10 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
abort(); abort();
#elif __WIIU__ #elif __WIIU__
WHBLogPrintf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr); WHBLogPrintf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
OSFatal("RE3 ASSERT FAILED");
char buf[2048];
sprintf(buf, "RE3 ASSERT FAILED\nFile: %s\nLine: %d\nFunction: %s\nExpression: %s\n",filename,lineno,func,expr);
OSFatal(buf);
#else #else
// TODO // TODO
printf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr); printf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);