Trace Logger - log to the window only up to the maximum number of lines, ability to set max lines, save window position option, show status and instruction count on window, don't autoload trace logger if core doesn't have it available, close trace logger if switching to a non-traceable core
This commit is contained in:
parent
9b6bf79855
commit
247cef6835
|
@ -287,7 +287,12 @@ namespace BizHawk.MultiClient
|
||||||
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
|
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
|
||||||
LoadSNESGraphicsDebugger();
|
LoadSNESGraphicsDebugger();
|
||||||
if (Global.Config.TraceLoggerAutoLoad)
|
if (Global.Config.TraceLoggerAutoLoad)
|
||||||
LoadTraceLogger();
|
{
|
||||||
|
if (Global.Emulator.CoreOutputComm.CpuTraceAvailable)
|
||||||
|
{
|
||||||
|
LoadTraceLogger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition)
|
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition)
|
||||||
this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy);
|
this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy);
|
||||||
|
@ -1572,6 +1577,7 @@ namespace BizHawk.MultiClient
|
||||||
TAStudio1.Restart();
|
TAStudio1.Restart();
|
||||||
Cheats1.Restart();
|
Cheats1.Restart();
|
||||||
ToolBox1.Restart();
|
ToolBox1.Restart();
|
||||||
|
TraceLogger1.Restart();
|
||||||
|
|
||||||
if (Global.Config.LoadCheatFileByGame)
|
if (Global.Config.LoadCheatFileByGame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace BizHawk.MultiClient
|
||||||
case InputType.TEXT:
|
case InputType.TEXT:
|
||||||
break;
|
break;
|
||||||
case InputType.HEX:
|
case InputType.HEX:
|
||||||
if (e.KeyChar == '\b')
|
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case InputType.SIGNED:
|
case InputType.SIGNED:
|
||||||
if (e.KeyChar == '\b')
|
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case InputType.UNSIGNED:
|
case InputType.UNSIGNED:
|
||||||
if (e.KeyChar == '\b')
|
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TraceLogger));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TraceLogger));
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.TracerBox = new System.Windows.Forms.GroupBox();
|
||||||
this.TraceView = new BizHawk.VirtualListView();
|
this.TraceView = new BizHawk.VirtualListView();
|
||||||
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
|
@ -44,23 +44,26 @@
|
||||||
this.ClearButton = new System.Windows.Forms.Button();
|
this.ClearButton = new System.Windows.Forms.Button();
|
||||||
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
||||||
this.CloseButton = new System.Windows.Forms.Button();
|
this.CloseButton = new System.Windows.Forms.Button();
|
||||||
this.groupBox1.SuspendLayout();
|
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.setMaxWindowLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.TracerBox.SuspendLayout();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// TracerBox
|
||||||
//
|
//
|
||||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.TracerBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.groupBox1.Controls.Add(this.TraceView);
|
this.TracerBox.Controls.Add(this.TraceView);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(12, 27);
|
this.TracerBox.Location = new System.Drawing.Point(12, 27);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.TracerBox.Name = "TracerBox";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(620, 444);
|
this.TracerBox.Size = new System.Drawing.Size(620, 444);
|
||||||
this.groupBox1.TabIndex = 1;
|
this.TracerBox.TabIndex = 1;
|
||||||
this.groupBox1.TabStop = false;
|
this.TracerBox.TabStop = false;
|
||||||
this.groupBox1.Text = "Trace log";
|
this.TracerBox.Text = "Trace log";
|
||||||
//
|
//
|
||||||
// TraceView
|
// TraceView
|
||||||
//
|
//
|
||||||
|
@ -138,7 +141,10 @@
|
||||||
// optionsToolStripMenuItem
|
// optionsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.autoloadToolStripMenuItem});
|
this.setMaxWindowLinesToolStripMenuItem,
|
||||||
|
this.toolStripSeparator2,
|
||||||
|
this.autoloadToolStripMenuItem,
|
||||||
|
this.saveWindowPositionToolStripMenuItem});
|
||||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||||
this.optionsToolStripMenuItem.Text = "&Options";
|
this.optionsToolStripMenuItem.Text = "&Options";
|
||||||
|
@ -147,7 +153,7 @@
|
||||||
// autoloadToolStripMenuItem
|
// autoloadToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
||||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
|
||||||
this.autoloadToolStripMenuItem.Text = "&Autoload";
|
this.autoloadToolStripMenuItem.Text = "&Autoload";
|
||||||
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
|
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -198,6 +204,25 @@
|
||||||
this.CloseButton.UseVisualStyleBackColor = true;
|
this.CloseButton.UseVisualStyleBackColor = true;
|
||||||
this.CloseButton.Click += new System.EventHandler(this.CloseButton_Click);
|
this.CloseButton.Click += new System.EventHandler(this.CloseButton_Click);
|
||||||
//
|
//
|
||||||
|
// saveWindowPositionToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
|
||||||
|
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
|
||||||
|
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window Position";
|
||||||
|
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// setMaxWindowLinesToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.setMaxWindowLinesToolStripMenuItem.Name = "setMaxWindowLinesToolStripMenuItem";
|
||||||
|
this.setMaxWindowLinesToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
|
||||||
|
this.setMaxWindowLinesToolStripMenuItem.Text = "&Set Max Window Lines...";
|
||||||
|
this.setMaxWindowLinesToolStripMenuItem.Click += new System.EventHandler(this.setMaxWindowLinesToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// toolStripSeparator2
|
||||||
|
//
|
||||||
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
|
this.toolStripSeparator2.Size = new System.Drawing.Size(198, 6);
|
||||||
|
//
|
||||||
// TraceLogger
|
// TraceLogger
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -206,14 +231,14 @@
|
||||||
this.ClientSize = new System.Drawing.Size(644, 539);
|
this.ClientSize = new System.Drawing.Size(644, 539);
|
||||||
this.Controls.Add(this.CloseButton);
|
this.Controls.Add(this.CloseButton);
|
||||||
this.Controls.Add(this.groupBox2);
|
this.Controls.Add(this.groupBox2);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.TracerBox);
|
||||||
this.Controls.Add(this.menuStrip1);
|
this.Controls.Add(this.menuStrip1);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
this.Name = "TraceLogger";
|
this.Name = "TraceLogger";
|
||||||
this.Text = "TraceLogger";
|
this.Text = "TraceLogger";
|
||||||
this.Load += new System.EventHandler(this.TraceLogger_Load);
|
this.Load += new System.EventHandler(this.TraceLogger_Load);
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.TracerBox.ResumeLayout(false);
|
||||||
this.menuStrip1.ResumeLayout(false);
|
this.menuStrip1.ResumeLayout(false);
|
||||||
this.menuStrip1.PerformLayout();
|
this.menuStrip1.PerformLayout();
|
||||||
this.groupBox2.ResumeLayout(false);
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
@ -225,7 +250,7 @@
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.GroupBox groupBox1;
|
private System.Windows.Forms.GroupBox TracerBox;
|
||||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||||
|
@ -240,5 +265,8 @@
|
||||||
private VirtualListView TraceView;
|
private VirtualListView TraceView;
|
||||||
public System.Windows.Forms.ColumnHeader Script;
|
public System.Windows.Forms.ColumnHeader Script;
|
||||||
private System.Windows.Forms.Button CloseButton;
|
private System.Windows.Forms.Button CloseButton;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem setMaxWindowLinesToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,6 +27,8 @@ namespace BizHawk.MultiClient
|
||||||
public void SaveConfigSettings()
|
public void SaveConfigSettings()
|
||||||
{
|
{
|
||||||
Global.CoreInputComm.Tracer.Enabled = false;
|
Global.CoreInputComm.Tracer.Enabled = false;
|
||||||
|
Global.Config.TraceLoggerWndx = this.Location.X;
|
||||||
|
Global.Config.TraceLoggerWndy = this.Location.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TraceView_QueryItemBkColor(int index, int column, ref Color color)
|
private void TraceView_QueryItemBkColor(int index, int column, ref Color color)
|
||||||
|
@ -48,14 +50,21 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void TraceLogger_Load(object sender, EventArgs e)
|
private void TraceLogger_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (Global.Config.TraceLoggerSaveWindowPosition && Global.Config.TraceLoggerWndx >= 0 && Global.Config.TraceLoggerWndy >= 0)
|
||||||
|
{
|
||||||
|
this.Location = new Point(Global.Config.TraceLoggerWndx, Global.Config.TraceLoggerWndy);
|
||||||
|
}
|
||||||
|
|
||||||
ClearList();
|
ClearList();
|
||||||
LoggingEnabled.Checked = true;
|
LoggingEnabled.Checked = true;
|
||||||
Global.CoreInputComm.Tracer.Enabled = true;
|
Global.CoreInputComm.Tracer.Enabled = true;
|
||||||
|
SetTracerBoxTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
DoInstructions();
|
DoInstructions();
|
||||||
|
SetTracerBoxTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
|
@ -66,7 +75,14 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearList();
|
if (Global.Emulator.CoreOutputComm.CpuTraceAvailable)
|
||||||
|
{
|
||||||
|
ClearList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +100,7 @@ namespace BizHawk.MultiClient
|
||||||
private void LoggingEnabled_CheckedChanged(object sender, EventArgs e)
|
private void LoggingEnabled_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.CoreInputComm.Tracer.Enabled = LoggingEnabled.Checked;
|
Global.CoreInputComm.Tracer.Enabled = LoggingEnabled.Checked;
|
||||||
|
SetTracerBoxTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearButton_Click(object sender, EventArgs e)
|
private void ClearButton_Click(object sender, EventArgs e)
|
||||||
|
@ -94,11 +111,21 @@ namespace BizHawk.MultiClient
|
||||||
private void DoInstructions()
|
private void DoInstructions()
|
||||||
{
|
{
|
||||||
string[] instructions = Global.CoreInputComm.Tracer.TakeContents().Split('\n');
|
string[] instructions = Global.CoreInputComm.Tracer.TakeContents().Split('\n');
|
||||||
foreach (string s in instructions)
|
if (!String.IsNullOrWhiteSpace(instructions[0]))
|
||||||
{
|
{
|
||||||
Instructions.Add(s);
|
foreach (string s in instructions)
|
||||||
|
{
|
||||||
|
Instructions.Add(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Instructions.Count >= Global.Config.TraceLoggerMaxLines)
|
||||||
|
{
|
||||||
|
int x = Instructions.Count - Global.Config.TraceLoggerMaxLines;
|
||||||
|
Instructions.RemoveRange(0, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
TraceView.ItemCount = Instructions.Count;
|
||||||
}
|
}
|
||||||
TraceView.ItemCount = Instructions.Count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
|
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -109,11 +136,60 @@ namespace BizHawk.MultiClient
|
||||||
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
autoloadToolStripMenuItem.Checked = Global.Config.TraceLoggerAutoLoad;
|
autoloadToolStripMenuItem.Checked = Global.Config.TraceLoggerAutoLoad;
|
||||||
|
saveWindowPositionToolStripMenuItem.Checked = Global.Config.TraceLoggerSaveWindowPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseButton_Click(object sender, EventArgs e)
|
private void CloseButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Global.Config.TraceLoggerSaveWindowPosition ^= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMaxWindowLinesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
InputPrompt p = new InputPrompt();
|
||||||
|
p.SetMessage("Max lines to display in the window");
|
||||||
|
p.SetInitialValue(Global.Config.TraceLoggerMaxLines.ToString());
|
||||||
|
p.TextInputType = InputPrompt.InputType.UNSIGNED;
|
||||||
|
DialogResult result = p.ShowDialog();
|
||||||
|
if (p.UserOK)
|
||||||
|
{
|
||||||
|
int x = int.Parse(p.UserText);
|
||||||
|
if (x > 0)
|
||||||
|
{
|
||||||
|
Global.Config.TraceLoggerMaxLines = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTracerBoxTitle()
|
||||||
|
{
|
||||||
|
if (Global.CoreInputComm.Tracer.Enabled)
|
||||||
|
{
|
||||||
|
if (Instructions.Count > 0)
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - logging - " + Instructions.Count.ToString() + " instructions";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - logging...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Instructions.Count > 0)
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log - " + Instructions.Count.ToString() + " instructions";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TracerBox.Text = "Trace log";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue