From 4018452f21239ed5131df6c5fa4a4add69fc8434 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 16 Sep 2012 19:38:08 +0000 Subject: [PATCH] add CoreInputComm.CpuTraceEnable and CoreInputComm.CpuTraceStream, and use it in NES; set those appropriately from a gui component and you can effect user-controlled cpu tracing, if its been setup in the core he's interested in. CoreInputComm doesnt reconstruct between emulator instances, so this may not be the best way of hooking it up, but its serviceable. --- BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs | 2 ++ BizHawk.Emulation/Interfaces/CoreComms.cs | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index 2a2c18c4b4..47c58551ea 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -129,6 +129,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo else { cpu.IRQ = _irq_apu || board.IRQSignal; + if (CoreInputComm.CpuTraceEnable) + CoreInputComm.CpuTraceStream.WriteLine(cpu.State()); cpu.ExecuteOne(); } diff --git a/BizHawk.Emulation/Interfaces/CoreComms.cs b/BizHawk.Emulation/Interfaces/CoreComms.cs index 63e7f062b7..1910a76039 100644 --- a/BizHawk.Emulation/Interfaces/CoreComms.cs +++ b/BizHawk.Emulation/Interfaces/CoreComms.cs @@ -11,6 +11,12 @@ public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0; public bool SNES_ShowBG1_1, SNES_ShowBG2_1, SNES_ShowBG3_1, SNES_ShowBG4_1; public bool SNES_ShowOBJ_0, SNES_ShowOBJ_1, SNES_ShowOBJ_2, SNES_ShowOBJ_3; + + /// + /// if this is set, then the cpu should dump trace info to CpuTraceStream + /// + public bool CpuTraceEnable; + public System.IO.StreamWriter CpuTraceStream; } public class CoreOutputComm @@ -26,5 +32,7 @@ public int VsyncDen = 1; public string RomStatusAnnotation; public string RomStatusDetails; + + } }