Ram Watch - on load, check if Diff should be displayed. Implement prev value options - last frame, and last change (Diff adjust accordingly as well)

This commit is contained in:
adelikat 2012-07-05 01:58:33 +00:00
parent a8e3ffa624
commit b0b7478b40
3 changed files with 86 additions and 10 deletions

View File

@ -251,6 +251,7 @@ namespace BizHawk.MultiClient
public int RamWatchChangeIndex = 3;
public int RamWatchDiffIndex = 4;
public int RamWatchNotesIndex = 5;
public int RamWatchPrev_Type = 1;
// RamSearch Settings
public bool AutoLoadRamSearch = false;

View File

@ -109,6 +109,9 @@
this.MessageLabel = new System.Windows.Forms.Label();
this.MemDomainLabel = new System.Windows.Forms.Label();
this.showDifferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.definePreviousValueAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.previousFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lastChangeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
@ -408,6 +411,7 @@
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.definePreviousValueAsToolStripMenuItem,
this.displayWatchesOnScreenToolStripMenuItem,
this.saveWindowPositionToolStripMenuItem,
this.toolStripSeparator7,
@ -528,7 +532,7 @@
this.showPreviousValueToolStripMenuItem1,
this.showDifferenceToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(189, 302);
this.contextMenuStrip1.Size = new System.Drawing.Size(189, 280);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// editToolStripMenuItem
@ -831,6 +835,30 @@
this.showDifferenceToolStripMenuItem.Text = "Show Difference";
this.showDifferenceToolStripMenuItem.Click += new System.EventHandler(this.showDifferenceToolStripMenuItem_Click);
//
// definePreviousValueAsToolStripMenuItem
//
this.definePreviousValueAsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.previousFrameToolStripMenuItem,
this.lastChangeToolStripMenuItem});
this.definePreviousValueAsToolStripMenuItem.Name = "definePreviousValueAsToolStripMenuItem";
this.definePreviousValueAsToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.definePreviousValueAsToolStripMenuItem.Text = "Define Previous Value As";
this.definePreviousValueAsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.definePreviousValueAsToolStripMenuItem_DropDownOpened);
//
// previousFrameToolStripMenuItem
//
this.previousFrameToolStripMenuItem.Name = "previousFrameToolStripMenuItem";
this.previousFrameToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
this.previousFrameToolStripMenuItem.Text = "Previous Frame";
this.previousFrameToolStripMenuItem.Click += new System.EventHandler(this.previousFrameToolStripMenuItem_Click);
//
// lastChangeToolStripMenuItem
//
this.lastChangeToolStripMenuItem.Name = "lastChangeToolStripMenuItem";
this.lastChangeToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
this.lastChangeToolStripMenuItem.Text = "Last Change";
this.lastChangeToolStripMenuItem.Click += new System.EventHandler(this.lastChangeToolStripMenuItem_Click);
//
// RamWatch
//
this.AllowDrop = true;
@ -945,5 +973,8 @@
private System.Windows.Forms.ColumnHeader Diff;
private System.Windows.Forms.ToolStripMenuItem diffToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showDifferenceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem definePreviousValueAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem previousFrameToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem lastChangeToolStripMenuItem;
}
}

View File

@ -124,6 +124,7 @@ namespace BizHawk.MultiClient
}
SetPrevColumn(Global.Config.RamWatchShowPrevColumn);
SetChangesColumn(Global.Config.RamWatchShowChangeColumn);
SetDiffColumn(Global.Config.RamWatchShowDiffColumn);
if (Global.Config.RamWatchAddressWidth > 0)
WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width = Global.Config.RamWatchAddressWidth;
if (Global.Config.RamWatchValueWidth > 0)
@ -188,10 +189,10 @@ namespace BizHawk.MultiClient
text = "";
if (column == 0) //Address
{
if (watchList[index].type == atype.SEPARATOR)
text = "";
else
if (watchList[index].type != atype.SEPARATOR)
{
text = watchList[index].address.ToString(addressFormatStr);
}
}
if (column == 1) //Value
{
@ -199,11 +200,17 @@ namespace BizHawk.MultiClient
}
if (column == 2) //Prev
{
if (watchList[index].type == atype.SEPARATOR)
text = "";
else
if (watchList[index].type != atype.SEPARATOR)
{
text = watchList[index].PrevToString();
switch(Global.Config.RamWatchPrev_Type)
{
case 1:
text = watchList[index].PrevToString();
break;
case 2:
text = watchList[index].LastChangeToString();
break;
}
}
}
if (column == 3) //Change Counts
@ -211,10 +218,20 @@ namespace BizHawk.MultiClient
if (watchList[index].type != atype.SEPARATOR)
text = watchList[index].changecount.ToString();
}
if (column == 4) //Diff Counts
if (column == 4) //Diff
{
if (watchList[index].type != atype.SEPARATOR)
text = watchList[index].DiffToString(watchList[index].diffPrev);
{
switch(Global.Config.RamWatchPrev_Type)
{
case 1:
text = watchList[index].DiffToString(watchList[index].diffPrev);
break;
case 2:
text = watchList[index].DiffToString(watchList[index].diffLastChange);
break;
}
}
}
if (column == 5) //Notes
{
@ -1457,5 +1474,32 @@ namespace BizHawk.MultiClient
Global.Config.RamWatchShowDiffColumn ^= true;
SetDiffColumn(Global.Config.RamWatchShowDiffColumn);
}
private void previousFrameToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchPrev_Type = 1;
UpdateValues();
}
private void lastChangeToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RamWatchPrev_Type = 2;
UpdateValues();
}
private void definePreviousValueAsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
switch (Global.Config.RamWatchPrev_Type)
{
case 1:
previousFrameToolStripMenuItem.Checked = true;
lastChangeToolStripMenuItem.Checked = false;
break;
case 2:
previousFrameToolStripMenuItem.Checked = false;
lastChangeToolStripMenuItem.Checked = true;
break;
}
}
}
}