Skip to content

Commit

Permalink
Fix an inaccuracy with the No$gba debug registers 04fffa14 and 04fffa…
Browse files Browse the repository at this point in the history
…18 (#2119)

Writing to either of the two registers would print one newline too many

Co-authored-by: pants64DS <[email protected]>
  • Loading branch information
pants64DS and pants64DS authored Jul 30, 2024
1 parent b778fba commit 37c0320
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ u64 NDS::GetSysClockCycles(int num)
return ret;
}

void NDS::NocashPrint(u32 ncpu, u32 addr)
void NDS::NocashPrint(u32 ncpu, u32 addr, bool appendNewline)
{
// addr: debug string

Expand Down Expand Up @@ -1541,7 +1541,7 @@ void NDS::NocashPrint(u32 ncpu, u32 addr)
}

output[ptr] = '\0';
Log(LogLevel::Debug, "%s\n", output);
Log(LogLevel::Debug, appendNewline ? "%s\n" : "%s", output);
}

void NDS::MonitorARM9Jump(u32 addr)
Expand Down Expand Up @@ -3609,10 +3609,8 @@ void NDS::ARM9IOWrite32(u32 addr, u32 val)
case 0x04FFFA14:
case 0x04FFFA18:
{
bool appendLF = 0x04FFFA18 == addr;
NocashPrint(0, val);
if(appendLF)
Log(LogLevel::Debug, "\n");
NocashPrint(0, val, 0x04FFFA18 == addr);

return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/NDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class NDS

u32 GetPC(u32 cpu) const;
u64 GetSysClockCycles(int num);
void NocashPrint(u32 cpu, u32 addr);
void NocashPrint(u32 cpu, u32 addr, bool appendNewline = true);

void MonitorARM9Jump(u32 addr);

Expand Down

0 comments on commit 37c0320

Please sign in to comment.