devinacker / bsnes-plus

debug-oriented fork of bsnes
http://bsnes.revenant1.net
327 stars 91 forks source link

Logging DMA transfers to Debugger log #328

Open jeffythedragonslayer opened 2 years ago

jeffythedragonslayer commented 2 years ago

How could I get started logging more events to the log that's at the bottom of the Debugger window? I would like to make it easier to debug some of my DMAs, so I tried making this change:

--- a/bsnes/snes/cpu/dma/dma.cpp
+++ b/bsnes/snes/cpu/dma/dma.cpp
@@ -30,6 +30,10 @@ uint8 CPU::dma_read(uint32 abus) {
 }

 void CPU::dma_transfer(bool direction, uint8 bbus, uint32 abus) {
+#if defined(DEBUGGER)
+      debugger.echo(string() << "DMA Transfer started.  Direction=" << direction << " bbus: " << bbus << " abus: " << '\n');
+#endif
+

But got this error:

Compiling snes/cpu/cpu.cpp...
In file included from snes/cpu/cpu.cpp:16:
snes/cpu/dma/dma.cpp: In member function ‘void SNES::CPU::dma_transfer(bool, SNES::uint8, SNES::uint32)’:
snes/cpu/dma/dma.cpp:34:16: error: ‘class SNES::Debugger’ has no member named ‘echo’
   34 |       debugger.echo(string() << "DMA Transfer started.  Direction=" << direction << " bbus: " << bbus << " abus: " << '\n');
      |                ^~~~

What would be the correct way to go about implementing this?