From 0bf530da12f671c678f7e524b4318213d49b30e0 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Mon, 8 Jan 2018 22:03:07 -0500 Subject: [PATCH] nocashgba printf --- include/config.h | 8 ++++++++ src/libisagbprn.c | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/config.h b/include/config.h index 53502c6c2..318ed39d8 100644 --- a/include/config.h +++ b/include/config.h @@ -7,6 +7,14 @@ // to define NDEBUG before release, however this has been changed as // Ruby's actual debug build does not use the AGBPrint features. #define NDEBUG + +// To enable print debugging, comment out "#define NDEBUG". This allows +// the various AGBPrint functions to be used. (See include/gba/isagbprint.h). +// Some emulators support a debug console window: uncomment NoCashGBAPrint() +// and NoCashGBAPrintf() in libisagbprn.c to use no$gba's own proprietary +// printing system. Use NoCashGBAPrint() and NoCashGBAPrintf() like you +// would normally use AGBPrint() and AGBPrintf(). + // NOTE: Don't try to enable assert right now as many pointers // still exist in defines and WILL likely result in a broken ROM. diff --git a/src/libisagbprn.c b/src/libisagbprn.c index 007f90bb7..a9656f3c5 100755 --- a/src/libisagbprn.c +++ b/src/libisagbprn.c @@ -155,12 +155,22 @@ void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopP } } -// no$gba print function, uncomment to use +// no$gba print functions, uncomment to use /* void NoCashGBAPrint(const char *pBuf) { *(volatile u32*)NOCASHGBAPRINTADDR = (u32)pBuf; } + +void NoCashGBAPrintf(const char *pBuf, ...) +{ + char bufPrint[0x100]; + va_list vArgv; + va_start(vArgv, pBuf); + vsprintf(bufPrint, pBuf, vArgv); + va_end(vArgv); + NoCashGBAPrint(bufPrint); +} */ #endif