convert TraceLogger to use InputRoll
This commit is contained in:
parent
4ed50200c8
commit
279726d52c
|
@ -31,9 +31,7 @@
|
|||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TraceLogger));
|
||||
this.TracerBox = new System.Windows.Forms.GroupBox();
|
||||
this.TraceView = new BizHawk.Client.EmuHawk.VirtualListView();
|
||||
this.Disasm = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.Registers = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.TraceView = new InputRoll();
|
||||
this.TraceContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.CopyContextMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SelectAllContextMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -81,36 +79,19 @@
|
|||
this.TraceView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TraceView.BlazingFast = false;
|
||||
this.TraceView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.Disasm,
|
||||
this.Registers});
|
||||
this.TraceView.ContextMenuStrip = this.TraceContextMenu;
|
||||
this.TraceView.Font = new System.Drawing.Font("Courier New", 8F);
|
||||
this.TraceView.FullRowSelect = true;
|
||||
this.TraceView.GridLines = true;
|
||||
this.TraceView.HideSelection = false;
|
||||
this.TraceView.ItemCount = 0;
|
||||
this.TraceView.RowCount = 0;
|
||||
this.TraceView.Location = new System.Drawing.Point(8, 18);
|
||||
this.TraceView.Name = "TraceView";
|
||||
this.TraceView.SelectAllInProgress = false;
|
||||
this.TraceView.selectedItem = -1;
|
||||
this.TraceView.Size = new System.Drawing.Size(603, 414);
|
||||
this.TraceView.TabIndex = 4;
|
||||
this.TraceView.TabStop = false;
|
||||
this.TraceView.UseCompatibleStateImageBehavior = false;
|
||||
this.TraceView.UseCustomBackground = true;
|
||||
this.TraceView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// Disasm
|
||||
//
|
||||
this.Disasm.Text = "Disasm";
|
||||
this.Disasm.Width = 239;
|
||||
//
|
||||
// Registers
|
||||
//
|
||||
this.Registers.Text = "Registers";
|
||||
this.Registers.Width = 357;
|
||||
this.TraceView.AllowColumnResize = true;
|
||||
this.TraceView.AllowColumnReorder = false;
|
||||
//
|
||||
// TraceContextMenu
|
||||
//
|
||||
|
@ -371,8 +352,7 @@
|
|||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.CheckBox LoggingEnabled;
|
||||
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
|
||||
private VirtualListView TraceView;
|
||||
public System.Windows.Forms.ColumnHeader Disasm;
|
||||
private InputRoll TraceView;
|
||||
private System.Windows.Forms.ToolStripMenuItem MaxLinesMenuItem;
|
||||
private System.Windows.Forms.RadioButton ToFileRadio;
|
||||
private System.Windows.Forms.RadioButton ToWindowRadio;
|
||||
|
@ -381,7 +361,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem EditSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem CopyMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SelectAllMenuItem;
|
||||
private System.Windows.Forms.ColumnHeader Registers;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip TraceContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem CopyContextMenu;
|
||||
|
|
|
@ -24,16 +24,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
private int FileSizeCap { get; set; }
|
||||
|
||||
[ConfigPersist]
|
||||
private int DisasmColumnWidth {
|
||||
get { return this.Disasm.Width; }
|
||||
set { this.Disasm.Width = value; }
|
||||
}
|
||||
|
||||
[ConfigPersist]
|
||||
private int RegistersColumnWidth
|
||||
private List<InputRoll.RollColumn> Columns
|
||||
{
|
||||
get { return this.Registers.Width; }
|
||||
set { this.Registers.Width = value; }
|
||||
get { return TraceView.AllColumns; }
|
||||
set
|
||||
{
|
||||
TraceView.AllColumns.Clear();
|
||||
foreach (var column in value)
|
||||
{
|
||||
TraceView.AllColumns.Add(column);
|
||||
}
|
||||
|
||||
TraceView.AllColumns.ColumnsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private FileInfo _logFile;
|
||||
|
@ -47,7 +50,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private List<TraceInfo> _instructions = new List<TraceInfo>();
|
||||
private readonly List<TraceInfo> _instructions = new List<TraceInfo>();
|
||||
private StreamWriter _streamWriter;
|
||||
private bool _splitFile;
|
||||
private string _baseName;
|
||||
|
@ -55,12 +58,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
private int _segmentCount;
|
||||
private ulong _currentSize;
|
||||
|
||||
private const string DisasmColumnName = "Disasm";
|
||||
private const string RegistersColumnName = "Registers";
|
||||
public TraceLogger()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
TraceView.QueryItemText += TraceView_QueryItemText;
|
||||
TraceView.VirtualMode = true;
|
||||
|
||||
Closing += (o, e) =>
|
||||
{
|
||||
|
@ -72,6 +76,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
MaxLines = 10000;
|
||||
FileSizeCap = 150; // make 1 frame of tracelog for n64/psx fit in
|
||||
_splitFile = FileSizeCap != 0;
|
||||
|
||||
TraceView.AllColumns.Clear();
|
||||
TraceView.AllColumns.Add(new InputRoll.RollColumn
|
||||
{
|
||||
Name = DisasmColumnName,
|
||||
Text = DisasmColumnName,
|
||||
Width = 239,
|
||||
Type = InputRoll.RollColumn.InputType.Text
|
||||
});
|
||||
TraceView.AllColumns.Add(new InputRoll.RollColumn
|
||||
{
|
||||
Name = RegistersColumnName,
|
||||
Text = RegistersColumnName,
|
||||
Width = 357,
|
||||
Type = InputRoll.RollColumn.InputType.Text
|
||||
});
|
||||
}
|
||||
|
||||
public bool UpdateBefore
|
||||
|
@ -89,17 +109,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
//Tracer.Enabled = LoggingEnabled.Checked;
|
||||
}
|
||||
|
||||
private void TraceView_QueryItemText(int index, int column, out string text)
|
||||
private void TraceView_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||
{
|
||||
text = "";
|
||||
if (index < _instructions.Count)
|
||||
{
|
||||
switch (column)
|
||||
switch (column.Name)
|
||||
{
|
||||
case 0:
|
||||
case DisasmColumnName:
|
||||
text = _instructions[index].Disassembly.TrimEnd();
|
||||
break;
|
||||
case 1:
|
||||
case RegistersColumnName:
|
||||
text = _instructions[index].RegisterInfo;
|
||||
break;
|
||||
}
|
||||
|
@ -133,11 +153,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (ToWindowRadio.Checked)
|
||||
{
|
||||
// setting to zero first fixes an exception when scrolling the view
|
||||
// how or why I don't know
|
||||
// it's hidden behind an internal class ListViewNativeItemCollection
|
||||
TraceView.VirtualListSize = 0;
|
||||
TraceView.VirtualListSize = _instructions.Count;
|
||||
TraceView.RowCount = _instructions.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -152,12 +168,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
//connect tracer to sink for next frame
|
||||
if (ToWindowRadio.Checked)
|
||||
{
|
||||
//update listview with most recent results
|
||||
TraceView.BlazingFast = !GlobalWin.MainForm.EmulatorPaused;
|
||||
|
||||
Tracer.Sink = new CallbackSink()
|
||||
Tracer.Sink = new CallbackSink
|
||||
{
|
||||
putter = (info) =>
|
||||
putter = info =>
|
||||
{
|
||||
if (_instructions.Count >= MaxLines)
|
||||
{
|
||||
|
@ -210,7 +223,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void ClearList()
|
||||
{
|
||||
_instructions.Clear();
|
||||
TraceView.ItemCount = 0;
|
||||
TraceView.RowCount = 0;
|
||||
SetTracerBoxTitle();
|
||||
}
|
||||
|
||||
|
@ -233,7 +246,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_instructions.RemoveRange(0, _instructions.Count - MaxLines);
|
||||
}
|
||||
TraceView.ItemCount = _instructions.Count;
|
||||
TraceView.RowCount = _instructions.Count;
|
||||
}
|
||||
|
||||
private void SetTracerBoxTitle()
|
||||
|
@ -331,7 +344,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CopyMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var indices = TraceView.SelectedIndices;
|
||||
var indices = TraceView.SelectedRows.ToList();
|
||||
|
||||
if (indices.Count > 0)
|
||||
{
|
||||
|
@ -348,7 +361,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
for (var i = 0; i < _instructions.Count; i++)
|
||||
{
|
||||
TraceView.SelectItem(i, true);
|
||||
TraceView.SelectRow(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=autorestore/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autosave/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Disasm/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Dontfire/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Endian/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=frameadvance/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
Loading…
Reference in New Issue