diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index dbc1d842c9..27a66e52cf 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -209,8 +209,9 @@ namespace BizHawk.MultiClient public int RamWatchDiffIndex = 4; public int RamWatchDomainIndex = 5; public int RamWatchNotesIndex = 6; - + public int RamWatchPrev_Type = 1; + public Watch.PreviousType RamWatchDefinePrevious = Watch.PreviousType.LastFrame; // RamSearch Settings public bool RamSearchSaveWindowPosition = true; diff --git a/BizHawk.MultiClient/tools/Watch/NewRamWatch.Designer.cs b/BizHawk.MultiClient/tools/Watch/NewRamWatch.Designer.cs index a3360f5d1b..8f0dcbfdbe 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamWatch.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamWatch.Designer.cs @@ -96,6 +96,7 @@ this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.NotesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.originalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -604,23 +605,26 @@ // this.definePreviousValueAsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.previousFrameToolStripMenuItem, - this.lastChangeToolStripMenuItem}); - this.definePreviousValueAsToolStripMenuItem.Enabled = false; + this.lastChangeToolStripMenuItem, + this.originalToolStripMenuItem}); 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); // // displayWatchesOnScreenToolStripMenuItem // @@ -721,6 +725,13 @@ this.NotesColumn.Text = "Notes"; this.NotesColumn.Width = 128; // + // originalToolStripMenuItem + // + this.originalToolStripMenuItem.Name = "originalToolStripMenuItem"; + this.originalToolStripMenuItem.Size = new System.Drawing.Size(155, 22); + this.originalToolStripMenuItem.Text = "&Original"; + this.originalToolStripMenuItem.Click += new System.EventHandler(this.originalToolStripMenuItem_Click); + // // NewRamWatch // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -814,5 +825,6 @@ private System.Windows.Forms.Label MessageLabel; private System.Windows.Forms.Label MemDomainLabel; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem originalToolStripMenuItem; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/Watch/NewRamWatch.cs b/BizHawk.MultiClient/tools/Watch/NewRamWatch.cs index e01847bc10..df5f53ce37 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamWatch.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamWatch.cs @@ -863,6 +863,42 @@ namespace BizHawk.MultiClient saveWindowPositionToolStripMenuItem.Checked = Global.Config.RamWatchSaveWindowPosition; } + private void definePreviousValueAsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + lastChangeToolStripMenuItem.Checked = false; + previousFrameToolStripMenuItem.Checked = false; + originalToolStripMenuItem.Checked = false; + + switch (Global.Config.RamWatchDefinePrevious) + { + default: + case Watch.PreviousType.LastFrame: + previousFrameToolStripMenuItem.Checked = true; + break; + case Watch.PreviousType.LastChange: + lastChangeToolStripMenuItem.Checked = true; + break; + case Watch.PreviousType.OriginalValue: + originalToolStripMenuItem.Checked = true; + break; + } + } + + private void previousFrameToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchDefinePrevious = Watch.PreviousType.LastFrame; + } + + private void lastChangeToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchDefinePrevious = Watch.PreviousType.LastChange; + } + + private void originalToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchDefinePrevious = Watch.PreviousType.OriginalValue; + } + private void displayWatchesOnScreenToolStripMenuItem_Click(object sender, EventArgs e) { Global.Config.DisplayRamWatch ^= true; diff --git a/BizHawk.MultiClient/tools/Watch/Watch.cs b/BizHawk.MultiClient/tools/Watch/Watch.cs index c37f9e75ab..dec2b865ac 100644 --- a/BizHawk.MultiClient/tools/Watch/Watch.cs +++ b/BizHawk.MultiClient/tools/Watch/Watch.cs @@ -13,6 +13,7 @@ namespace BizHawk.MultiClient { public enum WatchSize { Byte = 1, Word = 2, DWord = 4, Separator = 0 }; public enum DisplayType { Separator, Signed, Unsigned, Hex, Binary, FixedPoint_12_4, FixedPoint_20_12, Float }; + public enum PreviousType { OriginalValue = 0, LastSearch = 1, LastFrame = 2, LastChange = 3 }; public static string DisplayTypeToString(DisplayType type) { @@ -415,13 +416,31 @@ namespace BizHawk.MultiClient public string Notes { get; set; } - public void Update() //TODO: different notions of previous + public void Update() { - _previous = _value; - _value = GetByte(); - if (_value != Previous) + switch (Global.Config.RamWatchDefinePrevious) { - ChangeCount++; + case PreviousType.LastSearch: //TODO + case PreviousType.OriginalValue: + /*Do Nothing*/ + break; + case PreviousType.LastChange: + var temp = _value; + _value = GetByte(); + if (_value != temp) + { + _previous = _value; + ChangeCount++; + } + break; + case PreviousType.LastFrame: + _previous = _value; + _value = GetByte(); + if (_value != Previous) + { + ChangeCount++; + } + break; } } } @@ -515,13 +534,32 @@ namespace BizHawk.MultiClient public string Notes { get; set; } - public void Update() //TODO: different notions of previous + public void Update() { - _previous = _value; - _value = GetWord(); - if (_value != Previous) + switch (Global.Config.RamWatchDefinePrevious) { - ChangeCount++; + case PreviousType.LastSearch: //TODO + case PreviousType.OriginalValue: + /*Do Nothing*/ + break; + case PreviousType.LastChange: + var temp = _value; + _value = GetWord(); + + if (_value != temp) + { + _previous = temp; + ChangeCount++; + } + break; + case PreviousType.LastFrame: + _previous = _value; + _value = GetWord(); + if (_value != Previous) + { + ChangeCount++; + } + break; } } } @@ -616,13 +654,31 @@ namespace BizHawk.MultiClient public string Notes { get; set; } - public void Update() //TODO: different notions of previous + public void Update() { - _previous = _value; - _value = GetDWord(); - if (_value != Previous) + switch (Global.Config.RamWatchDefinePrevious) { - ChangeCount++; + case PreviousType.LastSearch: //TODO + case PreviousType.OriginalValue: + /*Do Nothing*/ + break; + case PreviousType.LastChange: + var temp = _value; + _value = GetDWord(); + if (_value != temp) + { + _previous = _value; + ChangeCount++; + } + break; + case PreviousType.LastFrame: + _previous = _value; + _value = GetDWord(); + if (_value != Previous) + { + ChangeCount++; + } + break; } } }