Files
tp/include/JSystem/JUtility/JUTAssert.h
T

70 lines
2.9 KiB
C++
Raw Normal View History

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
#ifdef DEBUG
#define JUT_SHOW_ASSERT(LINE, COND) JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND)
#define JUT_ASSERT(LINE, COND) \
(COND) ? (void)0 : (JUT_SHOW_ASSERT(LINE, COND), OSPanic(__FILE__, LINE, "Halt"));
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"));
#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-06-21 13:47:24 +03:00
#define J3D_PANIC(LINE, COND, MSG) ((COND) != 0 || (OSPanic(__FILE__, LINE, MSG), 0));
2025-04-16 00:09:31 +03:00
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
#define JUT_WARN_DEVICE(LINE, DEVICE, ...) \
JUTAssertion::setWarningMessage_f(DEVICE, __FILE__, LINE, __VA_ARGS__); \
2023-09-15 16:02:47 -07: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__)
2025-11-21 18:52:16 -05:00
#define JUT_SET_CONFIRM(LINE, COND) \
JUTAssertion::setConfirmMessage(JUTAssertion::getSDevice(), __FILE__, LINE, COND, #COND)
2025-11-21 18:52:16 -05:00
#define JUT_CONFIRM(LINE, COND) \
JUT_SET_CONFIRM(LINE, 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;
#define JUT_ASSERT_MSG_F(...) (void)0;
2025-06-21 13:47:24 +03:00
#define J3D_PANIC(...) (void)0;
2021-09-24 17:13:23 +02:00
#define JUT_PANIC(...)
2023-09-15 16:02:47 -07:00
#define JUT_WARN(...)
#define JUT_WARN_DEVICE(...)
2023-09-15 16:02:47 -07:00
#define JUT_LOG(...)
#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);
u32 getSDevice();
void showAssert(u32 device, const char * file, int line, const char * assertion);
void showAssert_f(u32 device, const char* file, int line, const char* msg, ...);
void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...);
void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...);
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 */