Make AGBPrint output to our Logging.

We also output using `dbgOutput`, hence the behaviour will not change
for users relying on this.
This commit is contained in:
Edênis Freindorfer Azevedo 2020-03-17 10:50:54 -03:00 committed by Rafael Kitover
parent 60f05cedc2
commit d05e8fc141
1 changed files with 13 additions and 0 deletions

View File

@ -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);
}