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
|
2025-01-16 09:37:39 -08:00
|
|
|
#define JUT_ASSERT(LINE, COND) \
|
|
|
|
|
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND), OSPanic(__FILE__, LINE, "Halt"));
|
2024-01-01 15:09:41 -08:00
|
|
|
|
2025-04-09 01:17:20 -04:00
|
|
|
#define JUT_ASSERT_MSG(LINE, COND, MSG) \
|
|
|
|
|
(COND) ? (void)0 : (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, MSG), OSPanic(__FILE__, LINE, "Halt"));
|
|
|
|
|
|
2025-04-13 21:55:52 +03:00
|
|
|
#define JUT_ASSERT_MSG_F(LINE, COND, MSG, ...) \
|
|
|
|
|
(COND) ? (void)0 : (JUTAssertion::showAssert_f(JUTAssertion::getSDevice(), __FILE__, LINE, MSG, __VA_ARGS__), OSPanic(__FILE__, LINE, "Halt"));
|
|
|
|
|
|
2025-04-16 00:09:31 +03:00
|
|
|
#define J3D_ASSERT(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
|
|
|
|
|
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
|
|
|
|
2025-04-13 21:55:52 +03:00
|
|
|
#define JUT_WARN_DEVICE(LINE, DEVICE, ...) \
|
|
|
|
|
JUTAssertion::setWarningMessage_f(DEVICE, __FILE__, LINE, __VA_ARGS__); \
|
2023-09-15 16:02:47 -07:00
|
|
|
|
2025-04-13 21:55:52 +03:00
|
|
|
#define JUT_WARN(LINE, ...) \
|
|
|
|
|
JUT_WARN_DEVICE(LINE, JUTAssertion::getSDevice(), __VA_ARGS__)
|
2025-04-12 00:54:08 +03:00
|
|
|
|
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
|
2025-01-19 21:05:53 -08:00
|
|
|
#define JUT_ASSERT(...) (void)0;
|
2025-04-09 01:17:20 -04:00
|
|
|
#define JUT_ASSERT_MSG(...) (void)0;
|
2025-04-13 21:55:52 +03:00
|
|
|
#define JUT_ASSERT_MSG_F(...) (void)0;
|
2025-04-16 00:09:31 +03:00
|
|
|
#define J3D_ASSERT(...) (void)0;
|
2021-09-24 17:13:23 +02:00
|
|
|
#define JUT_PANIC(...)
|
2023-09-15 16:02:47 -07:00
|
|
|
#define JUT_WARN(...)
|
2025-04-13 21:55:52 +03:00
|
|
|
#define JUT_WARN_DEVICE(...)
|
2023-09-15 16:02:47 -07:00
|
|
|
#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);
|
2025-04-13 21:55:52 +03:00
|
|
|
void showAssert_f(u32 device, const char* file, int line, const char* msg, ...);
|
2023-09-28 12:01:42 -07:00
|
|
|
void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...);
|
|
|
|
|
void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...);
|
2025-03-01 04:48:49 -08:00
|
|
|
void setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const char* msg);
|
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 */
|