diff --git a/src/gba/agbprint.cpp b/src/gba/agbprint.cpp index 56244851..55b27fbe 100644 --- a/src/gba/agbprint.cpp +++ b/src/gba/agbprint.cpp @@ -55,10 +55,15 @@ void agbPrintFlush() uint16_t put = debuggerReadHalfWord(0x9fe20fe); uint32_t address = (debuggerReadHalfWord(0x9fe20fa) << 16); + + char message[0x10000]; + size_t index = 0; + if (address != 0xfd0000 && address != 0x1fd0000) { #ifdef BKPT_SUPPORT dbgOutput("Did you forget to call AGBPrintInit?\n", 0); #endif + log("AGBprint: Did you forget to call AGBPrintInit?\n"); // get rid of the text otherwise we will continue to be called debuggerWriteHalfWord(0x9fe20fc, put); return; @@ -72,6 +77,8 @@ void agbPrintFlush() s[0] = c; s[1] = 0; + message[index++] = s[0]; + if (systemVerbose & VERBOSE_AGBPRINT) { #ifdef BKPT_SUPPORT @@ -81,5 +88,11 @@ void agbPrintFlush() if (c == '\n') break; } + + message[index] = '\0'; + if (systemVerbose & VERBOSE_AGBPRINT) + { + log("AGBPrint: %s\n", message); + } debuggerWriteHalfWord(0x9fe20fc, get); }