2021-03-28 22:49:05 +02:00
|
|
|
#ifndef JUTASSERT_H
|
|
|
|
|
#define JUTASSERT_H
|
|
|
|
|
|
2024-01-19 16:22:19 -08:00
|
|
|
#include "dolphin/os.h"
|
2021-03-28 22:49:05 +02:00
|
|
|
|
2023-09-28 12:01:42 -07:00
|
|
|
#ifdef DEBUG
|
2023-09-16 10:17:56 -07:00
|
|
|
#define JUT_ASSERT(LINE, COND) \
|
|
|
|
|
if ((COND) == 0) { \
|
|
|
|
|
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
|
|
|
|
|
OSPanic(__FILE__, LINE, "Halt"); \
|
2021-09-24 17:13:23 +02:00
|
|
|
}
|
|
|
|
|
|
2024-01-01 15:09:41 -08:00
|
|
|
#define JUT_ASSERT_REPORT(LINE, COND) \
|
|
|
|
|
if ((COND) == 0) { \
|
|
|
|
|
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
|
|
|
|
|
OSPanic(__FILE__, LINE, "Halt"); \
|
|
|
|
|
OSReport("[%s] %d\n", __FILE__, __LINE__); \
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-16 10:17:56 -07:00
|
|
|
#define JUT_PANIC(LINE, TEXT) \
|
|
|
|
|
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, TEXT); \
|
|
|
|
|
OSPanic(__FILE__, LINE, "Halt");
|
2021-09-24 17:13:23 +02:00
|
|
|
|
2023-09-16 10:17:56 -07:00
|
|
|
#define JUT_WARN(LINE, ...) \
|
|
|
|
|
JUTAssertion::setWarningMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__); \
|
2023-09-15 16:02:47 -07:00
|
|
|
|
|
|
|
|
#define JUT_LOG(LINE, ...) \
|
|
|
|
|
JUTAssertion::setLogMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__)
|
|
|
|
|
|
2024-03-04 17:33:13 -08:00
|
|
|
#define JUT_CONFIRM(LINE, COND) \
|
|
|
|
|
JUTAssertion::setConfirmMessage(JUTAssertion::getSDevice(), __FILE__, LINE, COND, #COND)
|
|
|
|
|
|
2021-09-24 17:13:23 +02:00
|
|
|
#else
|
2023-09-15 16:02:47 -07:00
|
|
|
#define JUT_ASSERT(...)
|
2024-01-01 15:09:41 -08:00
|
|
|
#define JUT_ASSERT_REPORT(...)
|
2021-09-24 17:13:23 +02:00
|
|
|
#define JUT_PANIC(...)
|
2023-09-15 16:02:47 -07:00
|
|
|
#define JUT_WARN(...)
|
|
|
|
|
#define JUT_LOG(...)
|
2024-03-04 17:33:13 -08:00
|
|
|
#define JUT_CONFIRM(...)
|
2021-09-24 17:13:23 +02:00
|
|
|
#endif
|
|
|
|
|
|
2023-02-26 22:18:40 -08:00
|
|
|
namespace JUTAssertion {
|
|
|
|
|
/* 802E495C */ void create();
|
|
|
|
|
/* 802E4960 */ u32 flush_subroutine();
|
|
|
|
|
/* 802E499C */ void flushMessage();
|
|
|
|
|
/* 802E4A54 */ void flushMessage_dbPrint();
|
|
|
|
|
/* 802E4C34 */ void setVisible(bool);
|
|
|
|
|
/* 802E4C3C */ void setMessageCount(int);
|
2023-09-28 12:01:42 -07:00
|
|
|
|
|
|
|
|
u32 getSDevice();
|
|
|
|
|
void showAssert(u32 device, const char * file, int line, const char * assertion);
|
|
|
|
|
void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...);
|
|
|
|
|
void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...);
|
2021-05-03 02:03:24 +02:00
|
|
|
};
|
|
|
|
|
|
2022-01-10 04:07:06 -08:00
|
|
|
extern bool sAssertVisible;
|
|
|
|
|
|
2021-03-28 22:49:05 +02:00
|
|
|
#endif /* JUTASSERT_H */
|