Input Roll - stuff, and a ram Watch performance test set up in the TastudioExperiment object

This commit is contained in:
adelikat 2014-08-09 21:27:05 +00:00
parent 51210b643d
commit 2c504cff7b
2 changed files with 129 additions and 9 deletions

View File

@ -82,18 +82,18 @@ namespace BizHawk.Client.EmuHawk
/// <summary> /// <summary>
/// Retrieve the background color for a Listview cell (item and subitem). /// Retrieve the background color for a Listview cell (item and subitem).
/// </summary> /// </summary>
/// <param name="item">Listview item (row).</param> /// <param name="index">Listview item (row).</param>
/// <param name="subItem">Listview subitem (column).</param> /// <param name="column">Listview subitem (column).</param>
/// <param name="color">Background color to use</param> /// <param name="color">Background color to use</param>
public delegate void QueryItemBkColorHandler(int item, int subItem, ref Color color); public delegate void QueryItemBkColorHandler(int index, int column, ref Color color);
/// <summary> /// <summary>
/// Retrieve the text for a Listview cell (item and subitem). /// Retrieve the text for a Listview cell (item and subitem).
/// </summary> /// </summary>
/// <param name="item">Listview item (row).</param> /// <param name="index">Listview item (row).</param>
/// <param name="subItem">Listview subitem (column).</param> /// <param name="column">Listview subitem (column).</param>
/// <param name="text">Text to display.</param> /// <param name="text">Text to display.</param>
public delegate void QueryItemTextHandler(int item, int subItem, out string text); public delegate void QueryItemTextHandler(int index, int column, out string text);
/// <summary> /// <summary>
/// Fire the QueryItemBkColor event which requests the background color for the passed Listview cell /// Fire the QueryItemBkColor event which requests the background color for the passed Listview cell
@ -241,7 +241,31 @@ namespace BizHawk.Client.EmuHawk
private void DrawData(GDIRenderer gdi, PaintEventArgs e) private void DrawData(GDIRenderer gdi, PaintEventArgs e)
{ {
if (QueryItemText != null)
{
if (HorizontalOrientation)
{
}
else
{
var visibleRows = (Height / CellHeight) - 1;
for (int i = 1; i < visibleRows; i++)
{
int x = 1;
for (int j = 0; j < Columns.Count; j++)
{
string text;
var point = new Point(x + CellPadding, i * CellHeight);
QueryItemText(i, j, out text);
gdi.PrepDrawString(text, this.Font, this.ForeColor, point);
gdi.DrawString(text, this.Font, point);
x += CalcWidth(Columns[j]);
}
}
}
}
} }
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)

View File

@ -24,6 +24,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
Watches.UpdateValues();
InputView.Invalidate(); InputView.Invalidate();
} }
@ -48,18 +49,59 @@ namespace BizHawk.Client.EmuHawk
#endregion #endregion
private readonly WatchList Watches = new WatchList(Global.Emulator.MemoryDomains.MainMemory);
Random r;
public TasStudioExperiment() public TasStudioExperiment()
{ {
InitializeComponent(); InitializeComponent();
InputView.QueryItemText += TasView_QueryItemText; InputView.QueryItemText += TasView_QueryItemText;
InputView.QueryItemBkColor += TasView_QueryItemBkColor; InputView.QueryItemBkColor += TasView_QueryItemBkColor;
r = new Random((int)DateTime.Now.Ticks);
} }
private void TasView_QueryItemText(int index, int column, out string text) private void TasView_QueryItemText(int index, int column, out string text)
{ {
Random r = new Random((int)DateTime.Now.Ticks);
text = r.NextDouble() > .5 ? "_" : ""; //text = r.NextDouble() > .5 ? "_" : "";
text = string.Empty;
if (index >= Watches.ItemCount || Watches[index].IsSeparator)
{
return;
}
//var columnName = InputView.Columns[column].Name;
switch (column)
{
case 0:
text = Watches[index].AddressString;
break;
case 1:
text = Watches[index].ValueString;
break;
case 2:
text = Watches[index].PreviousStr;
break;
case 3:
if (!Watches[index].IsSeparator)
{
text = Watches[index].ChangeCount.ToString();
}
break;
case 4:
text = Watches[index].Diff;
break;
case 5:
text = Watches[index].Domain.Name;
break;
case 6:
text = Watches[index].Notes;
break;
}
} }
private void TasView_QueryItemBkColor(int index, int column, ref Color color) private void TasView_QueryItemBkColor(int index, int column, ref Color color)
@ -69,6 +111,59 @@ namespace BizHawk.Client.EmuHawk
private void TasStudioExperiment_Load(object sender, EventArgs e) private void TasStudioExperiment_Load(object sender, EventArgs e)
{ {
for (int i = 0; i < 20; i++)
{
Watches.Add(new ByteWatch(Watches.Domain, 0x0057, Watch.DisplayType.Signed, false, "Speed"));
}
InputView.AddColumns(new[]
{
new RollColumn
{
Group = "",
Name = "Address",
Text = "Address"
},
new RollColumn
{
Group = "",
Name = "Value",
Text = "Value"
},
new RollColumn
{
Group = "",
Name = "Prev",
Text = "Prev"
},
new RollColumn
{
Group = "",
Name = "Changes",
Text = "Changes"
},
new RollColumn
{
Group = "",
Name = "Domain",
Text = "Domain"
},
new RollColumn
{
Group = "",
Name = "Diff",
Text = "Diff"
},
new RollColumn
{
Group = "",
Name = "Notes",
Text = "Notes"
},
});
/*
InputView.AddColumns(new [] InputView.AddColumns(new []
{ {
new RollColumn new RollColumn
@ -142,6 +237,7 @@ namespace BizHawk.Client.EmuHawk
Type = RollColumn.InputType.Boolean Type = RollColumn.InputType.Boolean
}, },
}); });
*/
} }
private void settingsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) private void settingsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)