From fab26b99f15b5cdba5868270768f819100ee3d47 Mon Sep 17 00:00:00 2001 From: sbird Date: Tue, 6 Dec 2022 15:59:59 +0100 Subject: [PATCH 1/2] [fix] DebugPrintf with no format arguments --- include/gba/isagbprint.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gba/isagbprint.h b/include/gba/isagbprint.h index 91aa9f214..493c6604b 100644 --- a/include/gba/isagbprint.h +++ b/include/gba/isagbprint.h @@ -29,17 +29,17 @@ void AGBPrintInit(void); #if (LOG_HANDLER == LOG_HANDLER_MGBA_PRINT) -#define DebugPrintf(pBuf, ...) MgbaPrintf(MGBA_LOG_INFO, 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) -#define DebugPrintf(pBuf, ...) NoCashGBAPrintf(pBuf, __VA_ARGS__) +#define DebugPrintf(pBuf, ...) NoCashGBAPrintf(pBuf, ## __VA_ARGS__) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) NoCashGBAAssert(pFile, nLine, pExpression, nStopProgram) #else // Default to AGBPrint -#define DebugPrintf(pBuf, ...) AGBPrintf(const char *pBuf, ...) +#define DebugPrintf(pBuf, ...) AGBPrintf(pBuf, ## __VA_ARGS__) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) AGBAssert(pFile, nLine, pExpression, nStopProgram) #endif From 0d5adac1e118575018a4ffb5e13ac048b600a3c0 Mon Sep 17 00:00:00 2001 From: sbird Date: Wed, 7 Dec 2022 00:03:25 +0100 Subject: [PATCH 2/2] [debug, printf] add DebugPrintfLevel macro --- include/gba/isagbprint.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/gba/isagbprint.h b/include/gba/isagbprint.h index 493c6604b..d362b5cb3 100644 --- a/include/gba/isagbprint.h +++ b/include/gba/isagbprint.h @@ -11,6 +11,7 @@ #ifdef NDEBUG #define DebugPrintf(pBuf, ...) +#define DebugPrintfLevel(level, pBuf, ...) #define MgbaOpen() #define MgbaClose() #define AGBPrintInit() @@ -31,16 +32,19 @@ void AGBPrintInit(void); #define DebugPrintf(pBuf, ...) MgbaPrintf(MGBA_LOG_INFO, pBuf, ## __VA_ARGS__) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) MgbaAssert(pFile, nLine, pExpression, nStopProgram) +#define DebugPrintfLevel(level, pBuf, ...) MgbaPrintf(level, pBuf, ## __VA_ARGS__) #elif (LOG_HANDLER == LOG_HANDLER_NOCASH_PRINT) #define DebugPrintf(pBuf, ...) NoCashGBAPrintf(pBuf, ## __VA_ARGS__) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) NoCashGBAAssert(pFile, nLine, pExpression, nStopProgram) +#define DebugPrintfLevel(level, pBuf, ...) NoCashGBAPrintf(pBuf, ## __VA_ARGS__) #else // Default to AGBPrint #define DebugPrintf(pBuf, ...) AGBPrintf(pBuf, ## __VA_ARGS__) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) AGBAssert(pFile, nLine, pExpression, nStopProgram) +#define DebugPrintfLevel(level, pBuf, ...) AGBPrintf(pBuf, ## __VA_ARGS__) #endif #endif