tracer:
- expose segment size to user - fix logging to window and saving to file
This commit is contained in:
parent
1550860ad0
commit
3e7972ee9d
|
@ -57,6 +57,7 @@
|
||||||
this.ToFileRadio = new System.Windows.Forms.RadioButton();
|
this.ToFileRadio = new System.Windows.Forms.RadioButton();
|
||||||
this.ToWindowRadio = new System.Windows.Forms.RadioButton();
|
this.ToWindowRadio = new System.Windows.Forms.RadioButton();
|
||||||
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
||||||
|
this.SegmentSizeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.TracerBox.SuspendLayout();
|
this.TracerBox.SuspendLayout();
|
||||||
this.TraceContextMenu.SuspendLayout();
|
this.TraceContextMenu.SuspendLayout();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
|
@ -170,27 +171,27 @@
|
||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1,
|
||||||
this.ExitMenuItem});
|
this.ExitMenuItem});
|
||||||
this.FileSubMenu.Name = "FileSubMenu";
|
this.FileSubMenu.Name = "FileSubMenu";
|
||||||
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
|
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
|
||||||
this.FileSubMenu.Text = "&File";
|
this.FileSubMenu.Text = "&File";
|
||||||
//
|
//
|
||||||
// SaveLogMenuItem
|
// SaveLogMenuItem
|
||||||
//
|
//
|
||||||
this.SaveLogMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
|
this.SaveLogMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
|
||||||
this.SaveLogMenuItem.Name = "SaveLogMenuItem";
|
this.SaveLogMenuItem.Name = "SaveLogMenuItem";
|
||||||
this.SaveLogMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.SaveLogMenuItem.Size = new System.Drawing.Size(143, 22);
|
||||||
this.SaveLogMenuItem.Text = "&Save Log";
|
this.SaveLogMenuItem.Text = "&Save Log";
|
||||||
this.SaveLogMenuItem.Click += new System.EventHandler(this.SaveLogMenuItem_Click);
|
this.SaveLogMenuItem.Click += new System.EventHandler(this.SaveLogMenuItem_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator1
|
// toolStripSeparator1
|
||||||
//
|
//
|
||||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
|
this.toolStripSeparator1.Size = new System.Drawing.Size(140, 6);
|
||||||
//
|
//
|
||||||
// ExitMenuItem
|
// ExitMenuItem
|
||||||
//
|
//
|
||||||
this.ExitMenuItem.Name = "ExitMenuItem";
|
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||||
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||||
this.ExitMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.ExitMenuItem.Size = new System.Drawing.Size(143, 22);
|
||||||
this.ExitMenuItem.Text = "E&xit";
|
this.ExitMenuItem.Text = "E&xit";
|
||||||
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -201,7 +202,7 @@
|
||||||
this.SelectAllMenuItem,
|
this.SelectAllMenuItem,
|
||||||
this.ClearMenuItem});
|
this.ClearMenuItem});
|
||||||
this.EditSubMenu.Name = "EditSubMenu";
|
this.EditSubMenu.Name = "EditSubMenu";
|
||||||
this.EditSubMenu.Size = new System.Drawing.Size(39, 20);
|
this.EditSubMenu.Size = new System.Drawing.Size(37, 20);
|
||||||
this.EditSubMenu.Text = "Edit";
|
this.EditSubMenu.Text = "Edit";
|
||||||
//
|
//
|
||||||
// CopyMenuItem
|
// CopyMenuItem
|
||||||
|
@ -209,7 +210,7 @@
|
||||||
this.CopyMenuItem.Name = "CopyMenuItem";
|
this.CopyMenuItem.Name = "CopyMenuItem";
|
||||||
this.CopyMenuItem.ShortcutKeyDisplayString = "";
|
this.CopyMenuItem.ShortcutKeyDisplayString = "";
|
||||||
this.CopyMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
this.CopyMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||||
this.CopyMenuItem.Size = new System.Drawing.Size(164, 22);
|
this.CopyMenuItem.Size = new System.Drawing.Size(167, 22);
|
||||||
this.CopyMenuItem.Text = "&Copy";
|
this.CopyMenuItem.Text = "&Copy";
|
||||||
this.CopyMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
|
this.CopyMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -218,29 +219,30 @@
|
||||||
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
|
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
|
||||||
this.SelectAllMenuItem.ShortcutKeyDisplayString = "";
|
this.SelectAllMenuItem.ShortcutKeyDisplayString = "";
|
||||||
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||||
this.SelectAllMenuItem.Size = new System.Drawing.Size(164, 22);
|
this.SelectAllMenuItem.Size = new System.Drawing.Size(167, 22);
|
||||||
this.SelectAllMenuItem.Text = "Select &All";
|
this.SelectAllMenuItem.Text = "Select &All";
|
||||||
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
|
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
|
||||||
//
|
//
|
||||||
// ClearMenuItem
|
// ClearMenuItem
|
||||||
//
|
//
|
||||||
this.ClearMenuItem.Name = "ClearMenuItem";
|
this.ClearMenuItem.Name = "ClearMenuItem";
|
||||||
this.ClearMenuItem.Size = new System.Drawing.Size(164, 22);
|
this.ClearMenuItem.Size = new System.Drawing.Size(167, 22);
|
||||||
this.ClearMenuItem.Text = "Clear";
|
this.ClearMenuItem.Text = "Clear";
|
||||||
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
|
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
|
||||||
//
|
//
|
||||||
// OptionsSubMenu
|
// OptionsSubMenu
|
||||||
//
|
//
|
||||||
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.MaxLinesMenuItem});
|
this.MaxLinesMenuItem,
|
||||||
|
this.SegmentSizeMenuItem});
|
||||||
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||||
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
this.OptionsSubMenu.Size = new System.Drawing.Size(58, 20);
|
||||||
this.OptionsSubMenu.Text = "&Settings";
|
this.OptionsSubMenu.Text = "&Settings";
|
||||||
//
|
//
|
||||||
// MaxLinesMenuItem
|
// MaxLinesMenuItem
|
||||||
//
|
//
|
||||||
this.MaxLinesMenuItem.Name = "MaxLinesMenuItem";
|
this.MaxLinesMenuItem.Name = "MaxLinesMenuItem";
|
||||||
this.MaxLinesMenuItem.Size = new System.Drawing.Size(154, 22);
|
this.MaxLinesMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.MaxLinesMenuItem.Text = "&Set Max Lines...";
|
this.MaxLinesMenuItem.Text = "&Set Max Lines...";
|
||||||
this.MaxLinesMenuItem.Click += new System.EventHandler(this.MaxLinesMenuItem_Click);
|
this.MaxLinesMenuItem.Click += new System.EventHandler(this.MaxLinesMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -331,6 +333,13 @@
|
||||||
this.LoggingEnabled.UseVisualStyleBackColor = true;
|
this.LoggingEnabled.UseVisualStyleBackColor = true;
|
||||||
this.LoggingEnabled.CheckedChanged += new System.EventHandler(this.LoggingEnabled_CheckedChanged);
|
this.LoggingEnabled.CheckedChanged += new System.EventHandler(this.LoggingEnabled_CheckedChanged);
|
||||||
//
|
//
|
||||||
|
// SegmentSizeMenuItem
|
||||||
|
//
|
||||||
|
this.SegmentSizeMenuItem.Name = "SegmentSizeMenuItem";
|
||||||
|
this.SegmentSizeMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.SegmentSizeMenuItem.Text = "Set Segment Size...";
|
||||||
|
this.SegmentSizeMenuItem.Click += new System.EventHandler(this.SegmentSizeMenuItem_Click);
|
||||||
|
//
|
||||||
// TraceLogger
|
// TraceLogger
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -387,5 +396,6 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem SelectAllContextMenu;
|
private System.Windows.Forms.ToolStripMenuItem SelectAllContextMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ClearContextMenu;
|
private System.Windows.Forms.ToolStripMenuItem ClearContextMenu;
|
||||||
private System.Windows.Forms.Button OpenLogFile;
|
private System.Windows.Forms.Button OpenLogFile;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem SegmentSizeMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,6 +20,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[ConfigPersist]
|
[ConfigPersist]
|
||||||
private int MaxLines { get; set; }
|
private int MaxLines { get; set; }
|
||||||
|
|
||||||
|
[ConfigPersist]
|
||||||
|
private int FileSizeCap { get; set; }
|
||||||
|
|
||||||
[ConfigPersist]
|
[ConfigPersist]
|
||||||
private int DisasmColumnWidth {
|
private int DisasmColumnWidth {
|
||||||
get { return this.Disasm.Width; }
|
get { return this.Disasm.Width; }
|
||||||
|
@ -33,16 +36,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
set { this.Registers.Width = value; }
|
set { this.Registers.Width = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SplitFile { get; set; }
|
|
||||||
private int FileSizeCap { get; set; }
|
|
||||||
|
|
||||||
private FileInfo _logFile;
|
private FileInfo _logFile;
|
||||||
private FileInfo LogFile
|
private FileInfo LogFile
|
||||||
{
|
{
|
||||||
get
|
get { return _logFile; }
|
||||||
{
|
|
||||||
return _logFile;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_logFile = value;
|
_logFile = value;
|
||||||
|
@ -52,6 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private List<TraceInfo> _instructions = new List<TraceInfo>();
|
private List<TraceInfo> _instructions = new List<TraceInfo>();
|
||||||
private StreamWriter _streamWriter;
|
private StreamWriter _streamWriter;
|
||||||
|
private bool _splitFile;
|
||||||
private string _baseName;
|
private string _baseName;
|
||||||
private string _extension = ".log";
|
private string _extension = ".log";
|
||||||
private int _segmentCount;
|
private int _segmentCount;
|
||||||
|
@ -67,8 +65,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Closing += (o, e) => SaveConfigSettings();
|
Closing += (o, e) => SaveConfigSettings();
|
||||||
|
|
||||||
MaxLines = 10000;
|
MaxLines = 10000;
|
||||||
SplitFile = true;
|
|
||||||
FileSizeCap = 100;
|
FileSizeCap = 100;
|
||||||
|
_splitFile = FileSizeCap != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateBefore
|
public bool UpdateBefore
|
||||||
|
@ -94,7 +92,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
switch (column)
|
switch (column)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
text = _instructions[index].Disassembly;
|
text = _instructions[index].Disassembly.TrimEnd();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
text = _instructions[index].RegisterInfo;
|
text = _instructions[index].RegisterInfo;
|
||||||
|
@ -151,8 +149,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
putter = (info) =>
|
putter = (info) =>
|
||||||
{
|
{
|
||||||
if (_instructions.Count >= MaxLines) { }
|
if (_instructions.Count >= MaxLines)
|
||||||
else _instructions.Add(info);
|
{
|
||||||
|
_instructions.RemoveRange(0, _instructions.Count - MaxLines);
|
||||||
|
}
|
||||||
|
_instructions.Add(info);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_instructions.Clear();
|
_instructions.Clear();
|
||||||
|
@ -170,6 +171,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var data = string.Format("{0} {1}", info.Disassembly, info.RegisterInfo);
|
var data = string.Format("{0} {1}", info.Disassembly, info.RegisterInfo);
|
||||||
_streamWriter.WriteLine(data);
|
_streamWriter.WriteLine(data);
|
||||||
_currentSize += (ulong)data.Length;
|
_currentSize += (ulong)data.Length;
|
||||||
|
if (_splitFile)
|
||||||
CheckSplitFile();
|
CheckSplitFile();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -203,8 +205,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
//no padding supported. core should be doing this!
|
//no padding supported. core should be doing this!
|
||||||
var data = string.Format("{0} {1}", instruction.Disassembly, instruction.RegisterInfo);
|
var data = string.Format("{0} {1}", instruction.Disassembly, instruction.RegisterInfo);
|
||||||
_streamWriter.WriteLine();
|
_streamWriter.WriteLine(data);
|
||||||
_currentSize += (ulong)data.Length;
|
_currentSize += (ulong)data.Length;
|
||||||
|
if (_splitFile)
|
||||||
CheckSplitFile();
|
CheckSplitFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,6 +305,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
StartLogFile();
|
StartLogFile();
|
||||||
DumpToDisk();
|
DumpToDisk();
|
||||||
GlobalWin.OSD.AddMessage("Log dumped to " + LogFile.FullName);
|
GlobalWin.OSD.AddMessage("Log dumped to " + LogFile.FullName);
|
||||||
|
CloseFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,6 +360,24 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SegmentSizeMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var prompt = new InputPrompt
|
||||||
|
{
|
||||||
|
StartLocation = this.ChildPointToScreen(TraceView),
|
||||||
|
TextInputType = InputPrompt.InputType.Unsigned,
|
||||||
|
Message = "Log file segment size in megabytes\nSetting 0 disables segmentation",
|
||||||
|
InitialValue = FileSizeCap.ToString()
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = prompt.ShowHawkDialog();
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
FileSizeCap = int.Parse(prompt.PromptText);
|
||||||
|
_splitFile = FileSizeCap != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Dialog and ListView Events
|
#region Dialog and ListView Events
|
||||||
|
|
Loading…
Reference in New Issue