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.ToWindowRadio = new System.Windows.Forms.RadioButton();
|
||||
this.LoggingEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.SegmentSizeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.TracerBox.SuspendLayout();
|
||||
this.TraceContextMenu.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
|
@ -170,27 +171,27 @@
|
|||
this.toolStripSeparator1,
|
||||
this.ExitMenuItem});
|
||||
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";
|
||||
//
|
||||
// SaveLogMenuItem
|
||||
//
|
||||
this.SaveLogMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
|
||||
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.Click += new System.EventHandler(this.SaveLogMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(140, 6);
|
||||
//
|
||||
// ExitMenuItem
|
||||
//
|
||||
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||
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.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||
//
|
||||
|
@ -201,7 +202,7 @@
|
|||
this.SelectAllMenuItem,
|
||||
this.ClearMenuItem});
|
||||
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";
|
||||
//
|
||||
// CopyMenuItem
|
||||
|
@ -209,7 +210,7 @@
|
|||
this.CopyMenuItem.Name = "CopyMenuItem";
|
||||
this.CopyMenuItem.ShortcutKeyDisplayString = "";
|
||||
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.Click += new System.EventHandler(this.CopyMenuItem_Click);
|
||||
//
|
||||
|
@ -218,29 +219,30 @@
|
|||
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
|
||||
this.SelectAllMenuItem.ShortcutKeyDisplayString = "";
|
||||
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.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.ClearMenuItem_Click);
|
||||
//
|
||||
// OptionsSubMenu
|
||||
//
|
||||
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.MaxLinesMenuItem});
|
||||
this.MaxLinesMenuItem,
|
||||
this.SegmentSizeMenuItem});
|
||||
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";
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.MaxLinesMenuItem_Click);
|
||||
//
|
||||
|
@ -331,6 +333,13 @@
|
|||
this.LoggingEnabled.UseVisualStyleBackColor = true;
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -387,5 +396,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem SelectAllContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearContextMenu;
|
||||
private System.Windows.Forms.Button OpenLogFile;
|
||||
private System.Windows.Forms.ToolStripMenuItem SegmentSizeMenuItem;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
[ConfigPersist]
|
||||
private int MaxLines { get; set; }
|
||||
|
||||
[ConfigPersist]
|
||||
private int FileSizeCap { get; set; }
|
||||
|
||||
[ConfigPersist]
|
||||
private int DisasmColumnWidth {
|
||||
get { return this.Disasm.Width; }
|
||||
|
@ -33,16 +36,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
set { this.Registers.Width = value; }
|
||||
}
|
||||
|
||||
private bool SplitFile { get; set; }
|
||||
private int FileSizeCap { get; set; }
|
||||
|
||||
private FileInfo _logFile;
|
||||
private FileInfo LogFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return _logFile;
|
||||
}
|
||||
get { return _logFile; }
|
||||
set
|
||||
{
|
||||
_logFile = value;
|
||||
|
@ -52,6 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private List<TraceInfo> _instructions = new List<TraceInfo>();
|
||||
private StreamWriter _streamWriter;
|
||||
private bool _splitFile;
|
||||
private string _baseName;
|
||||
private string _extension = ".log";
|
||||
private int _segmentCount;
|
||||
|
@ -67,8 +65,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Closing += (o, e) => SaveConfigSettings();
|
||||
|
||||
MaxLines = 10000;
|
||||
SplitFile = true;
|
||||
FileSizeCap = 100;
|
||||
_splitFile = FileSizeCap != 0;
|
||||
}
|
||||
|
||||
public bool UpdateBefore
|
||||
|
@ -94,7 +92,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
text = _instructions[index].Disassembly;
|
||||
text = _instructions[index].Disassembly.TrimEnd();
|
||||
break;
|
||||
case 1:
|
||||
text = _instructions[index].RegisterInfo;
|
||||
|
@ -151,8 +149,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
putter = (info) =>
|
||||
{
|
||||
if (_instructions.Count >= MaxLines) { }
|
||||
else _instructions.Add(info);
|
||||
if (_instructions.Count >= MaxLines)
|
||||
{
|
||||
_instructions.RemoveRange(0, _instructions.Count - MaxLines);
|
||||
}
|
||||
_instructions.Add(info);
|
||||
}
|
||||
};
|
||||
_instructions.Clear();
|
||||
|
@ -170,7 +171,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
var data = string.Format("{0} {1}", info.Disassembly, info.RegisterInfo);
|
||||
_streamWriter.WriteLine(data);
|
||||
_currentSize += (ulong)data.Length;
|
||||
CheckSplitFile();
|
||||
if (_splitFile)
|
||||
CheckSplitFile();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -203,9 +205,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//no padding supported. core should be doing this!
|
||||
var data = string.Format("{0} {1}", instruction.Disassembly, instruction.RegisterInfo);
|
||||
_streamWriter.WriteLine();
|
||||
_streamWriter.WriteLine(data);
|
||||
_currentSize += (ulong)data.Length;
|
||||
CheckSplitFile();
|
||||
if (_splitFile)
|
||||
CheckSplitFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,6 +305,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
StartLogFile();
|
||||
DumpToDisk();
|
||||
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
|
||||
|
||||
#region Dialog and ListView Events
|
||||
|
|
Loading…
Reference in New Issue