Trace Logging hooked up for NES core, trace logger tool doesn't display rows for some reason
This commit is contained in:
parent
f8c508b1a3
commit
e964dfb1df
|
@ -190,8 +190,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
else
|
||||
{
|
||||
cpu.IRQ = _irq_apu || board.IRQSignal;
|
||||
if (CoreInputComm.CpuTraceEnable)
|
||||
CoreInputComm.CpuTraceStream.WriteLine(cpu.State());
|
||||
if (CoreInputComm.Tracer.Enabled)
|
||||
{
|
||||
CoreInputComm.Tracer.Put(cpu.State());
|
||||
}
|
||||
cpu.ExecuteOne();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
namespace BizHawk
|
||||
using System.Text;
|
||||
namespace BizHawk
|
||||
{
|
||||
public class CoreInputComm
|
||||
{
|
||||
|
@ -16,8 +17,7 @@
|
|||
/// <summary>
|
||||
/// if this is set, then the cpu should dump trace info to CpuTraceStream
|
||||
/// </summary>
|
||||
public bool CpuTraceEnable;
|
||||
public System.IO.StreamWriter CpuTraceStream;
|
||||
public TraceBuffer Tracer = new TraceBuffer();
|
||||
}
|
||||
|
||||
public class CoreOutputComm
|
||||
|
@ -38,4 +38,52 @@
|
|||
|
||||
public bool CpuTraceAvailable = false;
|
||||
}
|
||||
|
||||
public class TraceBuffer
|
||||
{
|
||||
public string TakeContents()
|
||||
{
|
||||
string s = buffer.ToString();
|
||||
buffer.Clear();
|
||||
return s;
|
||||
}
|
||||
|
||||
public string Contents
|
||||
{
|
||||
get
|
||||
{
|
||||
return buffer.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void Put(string content)
|
||||
{
|
||||
if (logging)
|
||||
{
|
||||
buffer.Append(content);
|
||||
buffer.Append('\n');
|
||||
}
|
||||
}
|
||||
|
||||
public TraceBuffer()
|
||||
{
|
||||
buffer = new StringBuilder();
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return logging;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
logging = value;
|
||||
}
|
||||
}
|
||||
|
||||
private StringBuilder buffer;
|
||||
private bool logging = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.ClearButton = new System.Windows.Forms.Button();
|
||||
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
|
@ -52,11 +53,13 @@
|
|||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TraceView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1});
|
||||
this.columnHeader1,
|
||||
this.columnHeader2});
|
||||
this.TraceView.FullRowSelect = true;
|
||||
this.TraceView.GridLines = true;
|
||||
this.TraceView.HideSelection = false;
|
||||
this.TraceView.ItemCount = 0;
|
||||
this.TraceView.LabelEdit = true;
|
||||
this.TraceView.Location = new System.Drawing.Point(9, 16);
|
||||
this.TraceView.Name = "TraceView";
|
||||
this.TraceView.selectedItem = -1;
|
||||
|
@ -69,7 +72,7 @@
|
|||
// columnHeader1
|
||||
//
|
||||
this.columnHeader1.Text = "Instructions";
|
||||
this.columnHeader1.Width = 316;
|
||||
this.columnHeader1.Width = 275;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
|
@ -202,5 +205,6 @@
|
|||
private System.Windows.Forms.CheckBox LoggingEnabled;
|
||||
private System.Windows.Forms.Button ClearButton;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
ClearList();
|
||||
LoggingEnabled.Checked = true;
|
||||
//Global.CoreInputComm.CpuTraceEnable = true;
|
||||
Global.CoreInputComm.Tracer.Enabled = true;
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
|
@ -75,7 +75,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void LoggingEnabled_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Global.CoreInputComm.CpuTraceEnable = LoggingEnabled.Checked;
|
||||
Global.CoreInputComm.Tracer.Enabled = LoggingEnabled.Checked;
|
||||
}
|
||||
|
||||
private void ClearButton_Click(object sender, EventArgs e)
|
||||
|
@ -85,11 +85,12 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void DoInstructions()
|
||||
{
|
||||
//using (Global.CoreInputComm.CpuTraceStream)
|
||||
//{
|
||||
Instructions.Add("FART 0x15");
|
||||
string[] instructions = Global.CoreInputComm.Tracer.TakeContents().Split('\n');
|
||||
foreach (string s in instructions)
|
||||
{
|
||||
Instructions.Add(s);
|
||||
}
|
||||
TraceView.ItemCount = Instructions.Count;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue