2018-01-07 02:38:34 +00:00
|
|
|
#ifndef GUARD_GBA_ISAGBPRINT_H
|
|
|
|
#define GUARD_GBA_ISAGBPRINT_H
|
|
|
|
|
2022-09-06 12:40:29 +01:00
|
|
|
#include "gba/types.h"
|
|
|
|
|
2018-01-07 02:38:34 +00:00
|
|
|
#ifdef NDEBUG
|
2022-09-06 12:40:29 +01:00
|
|
|
#define DebugPrintf(pBuf, ...)
|
|
|
|
#define MgbaOpen()
|
|
|
|
#define MgbaClose()
|
|
|
|
#define AGB_ASSERT(exp)
|
|
|
|
#define AGB_WARNING(exp)
|
2018-01-07 02:38:34 +00:00
|
|
|
#define AGBPrintInit()
|
|
|
|
#else
|
2022-09-06 12:40:29 +01:00
|
|
|
#if (LOG_HANDLER == LOG_HANDLER_MGBA_PRINT)
|
|
|
|
bool32 MgbaOpen(void);
|
|
|
|
void MgbaClose(void);
|
|
|
|
void MgbaPrintf(const char *pBuf, ...);
|
|
|
|
void MgbaAssert(const char *pFile, s32 nLine, const char *pExpression, bool32 nStopProgram);
|
|
|
|
#define DebugPrintf(pBuf, ...) MgbaPrintf(pBuf, __VA_ARGS__)
|
2022-09-23 02:23:44 +01:00
|
|
|
#define AGB_ASSERT(exp) (exp) ? ((void*)0) : MgbaAssert(__FILE__, __LINE__, #exp, TRUE)
|
|
|
|
#define AGB_WARNING(exp) (exp) ? ((void*)0) : MgbaAssert(__FILE__, __LINE__, #exp, FALSE)
|
2022-09-06 12:40:29 +01:00
|
|
|
|
|
|
|
// Not used in this configuration
|
|
|
|
#define AGBPrintfInit()
|
|
|
|
#elif (LOG_HANDLER == LOG_HANDLER_NOCASH_PRINT)
|
|
|
|
void NoCashGBAPrintf(const char *pBuf, ...)
|
|
|
|
void NoCashGBAAssert(const char *pFile, s32 nLine, const char *pExpression, bool32 nStopProgram)
|
|
|
|
#define DebugPrintf(pBuf, ...) NoCashGBAPrintf(pBuf, __VA_ARGS__)
|
2022-09-23 02:23:44 +01:00
|
|
|
#define AGB_ASSERT(exp) (exp) ? ((void*)0) : NoCashGBAAssert(__FILE__, __LINE__, #exp, TRUE);
|
|
|
|
#define AGB_WARNING(exp) (exp) ? ((void*)0) : NoCashGBAAssert(__FILE__, __LINE__, #exp, FALSE)
|
2022-09-06 12:40:29 +01:00
|
|
|
|
|
|
|
// Not used in this configuration
|
|
|
|
#define MgbaOpen()
|
|
|
|
#define MgbaClose()
|
|
|
|
#define AGBPrintInit()
|
|
|
|
#else // Default to AGBPrint
|
2018-01-07 02:38:34 +00:00
|
|
|
void AGBPrintf(const char *pBuf, ...);
|
|
|
|
void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram);
|
2022-09-06 12:40:29 +01:00
|
|
|
void AGBPrintInit(void);
|
|
|
|
#define DebugPrintf(pBuf, ...) AGBPrintf(const char *pBuf, ...)
|
2022-09-23 02:23:44 +01:00
|
|
|
#define AGB_ASSERT(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, TRUE)
|
|
|
|
#define AGB_WARNING(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, FALSE)
|
2018-01-07 02:38:34 +00:00
|
|
|
|
2022-09-06 12:40:29 +01:00
|
|
|
// Not used in this configuration
|
|
|
|
#define MgbaOpen()
|
|
|
|
#define MgbaClose()
|
2018-01-07 02:38:34 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// for matching purposes
|
|
|
|
|
|
|
|
#ifdef NDEBUG
|
2018-12-07 13:01:59 +00:00
|
|
|
#define AGB_ASSERT_EX(exp, file, line)
|
2018-01-07 02:38:34 +00:00
|
|
|
#else
|
2022-09-06 12:40:29 +01:00
|
|
|
#define AGB_ASSERT_EX(exp, file, line) AGB_ASSERT(exp);
|
2018-01-07 02:38:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // GUARD_GBA_ISAGBPRINT_H
|