[debug] do not use heap allocation for MgbaPrintf

This commit is contained in:
sbird
2022-09-23 04:02:30 +02:00
parent 12670e8e3e
commit 343d7f7d26
2 changed files with 11 additions and 49 deletions

View File

@@ -3,6 +3,12 @@
#include "gba/types.h"
#define MGBA_LOG_FATAL (0)
#define MGBA_LOG_ERROR (1)
#define MGBA_LOG_WARN (2)
#define MGBA_LOG_INFO (3)
#define MGBA_LOG_DEBUG (4)
#ifdef NDEBUG
#define DebugPrintf(pBuf, ...)
#define MgbaOpen()
@@ -13,7 +19,7 @@
bool32 MgbaOpen(void);
void MgbaClose(void);
void MgbaPrintf(const char *pBuf, ...);
void MgbaPrintf(s32 level, const char *pBuf, ...);
void MgbaAssert(const char *pFile, s32 nLine, const char *pExpression, bool32 nStopProgram);
void NoCashGBAPrintf(const char *pBuf, ...);
void NoCashGBAAssert(const char *pFile, s32 nLine, const char *pExpression, bool32 nStopProgram);
@@ -23,7 +29,7 @@ void AGBPrintInit(void);
#if (LOG_HANDLER == LOG_HANDLER_MGBA_PRINT)
#define DebugPrintf(pBuf, ...) MgbaPrintf(pBuf, __VA_ARGS__)
#define DebugPrintf(pBuf, ...) MgbaPrintf(MGBA_LOG_INFO, pBuf, __VA_ARGS__)
#define DebugAssert(pFile, nLine, pExpression, nStopProgram) MgbaAssert(pFile, nLine, pExpression, nStopProgram)
#elif (LOG_HANDLER == LOG_HANDLER_NOCASH_PRINT)