Ram Watch - option for the Previous column to show change from previous, rather than previous value (and save setting in config)

This commit is contained in:
andres.delikat 2011-02-24 16:51:31 +00:00
parent a1234fb428
commit f912e9976a
3 changed files with 65 additions and 31 deletions

View File

@ -56,6 +56,7 @@
public int RamWatchHeight = -1;
public bool RamWatchShowChangeColumn = true;
public bool RamWatchShowPrevColumn = false;
public bool RamWatchShowChangeFromPrev = true;
// RamSearch Settings
public bool AutoLoadRamSearch = false;

View File

@ -57,6 +57,7 @@
this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showChangeCountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showPreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WatchListView = new BizHawk.VirtualListView();
this.Address = new System.Windows.Forms.ColumnHeader();
@ -90,7 +91,7 @@
this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton();
this.WatchCountLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.showPreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.prevValueShowsChangeAmountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
@ -312,24 +313,33 @@
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showChangeCountsToolStripMenuItem,
this.showPreviousValueToolStripMenuItem,
this.restoreWindowSizeToolStripMenuItem});
this.restoreWindowSizeToolStripMenuItem,
this.prevValueShowsChangeAmountToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.optionsToolStripMenuItem.Text = "&Options";
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
//
// showChangeCountsToolStripMenuItem
//
this.showChangeCountsToolStripMenuItem.Checked = true;
this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem";
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.showChangeCountsToolStripMenuItem.Text = "Show Change Counts";
this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click);
//
// showPreviousValueToolStripMenuItem
//
this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem";
this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.showPreviousValueToolStripMenuItem.Text = "Show Previous Value";
this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click);
//
// restoreWindowSizeToolStripMenuItem
//
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
//
@ -635,12 +645,12 @@
this.MessageLabel.TabIndex = 5;
this.MessageLabel.Text = " ";
//
// showPreviousValueToolStripMenuItem
// prevValueShowsChangeAmountToolStripMenuItem
//
this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem";
this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.showPreviousValueToolStripMenuItem.Text = "Show Previous Value";
this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click);
this.prevValueShowsChangeAmountToolStripMenuItem.Name = "prevValueShowsChangeAmountToolStripMenuItem";
this.prevValueShowsChangeAmountToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.prevValueShowsChangeAmountToolStripMenuItem.Text = "Prev Value - Show change";
this.prevValueShowsChangeAmountToolStripMenuItem.Click += new System.EventHandler(this.prevValueShowsChangeAmountToolStripMenuItem_Click);
//
// RamWatch
//
@ -736,5 +746,6 @@
private System.Windows.Forms.ToolStripMenuItem showChangeCountsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showPreviousValueToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem prevValueShowsChangeAmountToolStripMenuItem;
}
}

View File

@ -21,7 +21,7 @@ namespace BizHawk.MultiClient
//DisplayWatches needs to do value display properly like updatevalues, or just run update values
//Ability to watch in different memory domains
//Save column widths in config
//Option for Prev to show change (+2 or -2) etc
//Column options in context menu
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
@ -130,28 +130,39 @@ namespace BizHawk.MultiClient
text = "";
else
{
switch (watchList[index].signed)
if (Global.Config.RamWatchShowChangeFromPrev)
{
case asigned.HEX:
switch (watchList[index].type)
{
case atype.BYTE:
text = String.Format("{0:X2}", watchList[index].prev);
break;
case atype.WORD:
text = String.Format("{0:X4}", watchList[index].prev);
break;
case atype.DWORD:
text = String.Format("{0:X8}", watchList[index].prev);
break;
}
break;
case asigned.SIGNED:
text = ((sbyte)watchList[index].prev).ToString();
break;
case asigned.UNSIGNED:
text = watchList[index].prev.ToString();
break;
int x = watchList[index].value - watchList[index].prev;
if (x < 0)
text = x.ToString();
else
text = "+" + x.ToString();
}
else
{
switch (watchList[index].signed)
{
case asigned.HEX:
switch (watchList[index].type)
{
case atype.BYTE:
text = String.Format("{0:X2}", watchList[index].prev);
break;
case atype.WORD:
text = String.Format("{0:X4}", watchList[index].prev);
break;
case atype.DWORD:
text = String.Format("{0:X8}", watchList[index].prev);
break;
}
break;
case asigned.SIGNED:
text = ((sbyte)watchList[index].prev).ToString();
break;
case asigned.UNSIGNED:
text = watchList[index].prev.ToString();
break;
}
}
}
}
@ -971,5 +982,16 @@ namespace BizHawk.MultiClient
Global.Config.RamWatchShowPrevColumn ^= true;
SetPrevColumn(Global.Config.RamWatchShowPrevColumn);
}
private void prevValueShowsChangeAmountToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchShowChangeFromPrev ^= true;
DisplayWatchList();
}
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
prevValueShowsChangeAmountToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeFromPrev;
}
}
}