diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index a730c1c9cb..1ea12fc008 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -267,12 +267,15 @@ namespace BizHawk.MultiClient public int RamWatchChangeWidth = -1; public int RamWatchDiffWidth = -1; public int RamWatchNotesWidth = -1; + public int RamWatchDomainWidth = -1; + public int RamWatchAddressIndex = 0; public int RamWatchValueIndex = 1; public int RamWatchPrevIndex = 2; public int RamWatchChangeIndex = 3; public int RamWatchDiffIndex = 4; - public int RamWatchNotesIndex = 5; + public int RamWatchDomainIndex = 5; + public int RamWatchNotesIndex = 6; public int RamWatchPrev_Type = 1; // RamSearch Settings diff --git a/BizHawk.MultiClient/tools/RamWatch.Designer.cs b/BizHawk.MultiClient/tools/RamWatch.Designer.cs index 8af84b519f..9813abe08f 100644 --- a/BizHawk.MultiClient/tools/RamWatch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamWatch.Designer.cs @@ -107,6 +107,7 @@ this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton(); this.WatchListView = new BizHawk.VirtualListView(); this.Address = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Prev = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ChangeCounts = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -126,7 +127,7 @@ this.optionsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(338, 24); + this.menuStrip1.Size = new System.Drawing.Size(359, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -176,8 +177,8 @@ // saveAsToolStripMenuItem // this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) - | System.Windows.Forms.Keys.S))); + this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.S))); this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.saveAsToolStripMenuItem.Text = "Save &As..."; this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); @@ -642,7 +643,7 @@ this.MoveDownStripButton1}); this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(338, 25); + this.toolStrip1.Size = new System.Drawing.Size(359, 25); this.toolStrip1.TabIndex = 2; this.toolStrip1.TabStop = true; this.toolStrip1.Text = "toolStrip1"; @@ -795,9 +796,9 @@ // WatchListView // this.WatchListView.AllowColumnReorder = true; - this.WatchListView.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.WatchListView.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.WatchListView.AutoArrange = false; this.WatchListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.Address, @@ -805,6 +806,7 @@ this.Prev, this.ChangeCounts, this.Diff, + this.DomainColumn, this.Notes}); this.WatchListView.ContextMenuStrip = this.contextMenuStrip1; this.WatchListView.FullRowSelect = true; @@ -815,7 +817,7 @@ this.WatchListView.Location = new System.Drawing.Point(16, 76); this.WatchListView.Name = "WatchListView"; this.WatchListView.selectedItem = -1; - this.WatchListView.Size = new System.Drawing.Size(306, 281); + this.WatchListView.Size = new System.Drawing.Size(327, 281); this.WatchListView.TabIndex = 1; this.WatchListView.UseCompatibleStateImageBehavior = false; this.WatchListView.View = System.Windows.Forms.View.Details; @@ -829,6 +831,11 @@ // this.Address.Text = "Address"; // + // DomainColumn + // + this.DomainColumn.Text = "Domain"; + this.DomainColumn.Width = 55; + // // Value // this.Value.Text = "Value"; @@ -849,14 +856,12 @@ // // Diff // - this.Diff.DisplayIndex = 5; this.Diff.Text = "Diff"; this.Diff.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.Diff.Width = 59; // // Notes // - this.Notes.DisplayIndex = 4; this.Notes.Text = "Notes"; this.Notes.Width = 128; // @@ -865,7 +870,7 @@ this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(338, 378); + this.ClientSize = new System.Drawing.Size(359, 378); this.Controls.Add(this.MessageLabel); this.Controls.Add(this.MemDomainLabel); this.Controls.Add(this.WatchCountLabel); @@ -977,5 +982,6 @@ private System.Windows.Forms.ToolStripMenuItem definePreviousValueAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem previousFrameToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem lastChangeToolStripMenuItem; + private System.Windows.Forms.ColumnHeader DomainColumn; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index 9d72f059d7..9b0b33e549 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -29,6 +29,7 @@ namespace BizHawk.MultiClient int defaultPrevWidth; int defaultChangeWidth; int defaultDiffWidth; + int defaultDomainWidth; int NotesWidth; string systemID = "NULL"; @@ -101,8 +102,6 @@ namespace BizHawk.MultiClient WatchListView.BlazingFast = true; WatchListView.Refresh(); WatchListView.BlazingFast = false; - - } public void AddWatch(Watch w) @@ -124,11 +123,14 @@ namespace BizHawk.MultiClient defaultPrevWidth = WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width; defaultChangeWidth = WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width; defaultDiffWidth = WatchListView.Columns[Global.Config.RamWatchDiffIndex].Width; + defaultDomainWidth = WatchListView.Columns[Global.Config.RamWatchDomainIndex].Width; NotesWidth = WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width; if (Global.Config.RamWatchSaveWindowPosition && Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0) + { Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy); + } if (Global.Config.RamWatchWidth >= 0 && Global.Config.RamWatchHeight >= 0) { @@ -137,18 +139,35 @@ 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) + { WatchListView.Columns[Global.Config.RamWatchValueIndex].Width = Global.Config.RamWatchValueWidth; + } if (Global.Config.RamWatchPrevWidth > 0) + { WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = Global.Config.RamWatchPrevWidth; + } if (Global.Config.RamWatchChangeWidth > 0) + { WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = Global.Config.RamWatchChangeWidth; + } if (Global.Config.RamWatchDiffWidth > 0) + { WatchListView.Columns[Global.Config.RamWatchDiffIndex].Width = Global.Config.RamWatchDiffWidth; + } + if (Global.Config.RamWatchDomainWidth > 0) + { + WatchListView.Columns[Global.Config.RamWatchDomainIndex].Width = Global.Config.RamWatchDomainWidth; + } if (Global.Config.RamWatchNotesWidth > 0) + { WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width = Global.Config.RamWatchNotesWidth; + } } public void SaveConfigSettings() @@ -159,6 +178,7 @@ namespace BizHawk.MultiClient Global.Config.RamWatchPrevWidth = WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width; Global.Config.RamWatchChangeWidth = WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width; Global.Config.RamWatchDiffWidth = WatchListView.Columns[Global.Config.RamWatchDiffIndex].Width; + Global.Config.RamWatchDomainWidth = WatchListView.Columns[Global.Config.RamWatchDomainIndex].Width; Global.Config.RamWatchNotesWidth = WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width; Global.Config.RamWatchWndx = this.Location.X; @@ -214,45 +234,53 @@ namespace BizHawk.MultiClient return; } - if (column == 0) //Address + switch(column) { - text = Watches[index].Address.ToString(addressFormatStr); - } - if (column == 1) //Value - { - text = Watches[index].ValueString; - } - if (column == 2) //Prev - { - switch(Global.Config.RamWatchPrev_Type) - { - case 1: - text = Watches[index].PrevString; - break; - case 2: - text = Watches[index].LastChangeString; - break; - } - } - if (column == 3) //Change Counts - { - text = Watches[index].Changecount.ToString(); - } - if (column == 4) //Diff - { - switch(Global.Config.RamWatchPrev_Type) - { - case 1: - text = Watches[index].DiffToString(Watches[index].DiffPrev); - break; - case 2: - text = Watches[index].DiffToString(Watches[index].DiffLastChange); - break; - } - } - if (column == 5) //Notes - { - text = Watches[index].Notes; + case 0: + text = Watches[index].Address.ToString(addressFormatStr); + break; + case 1: + switch(Global.Config.RamWatchPrev_Type) + { + case 1: + text = Watches[index].PrevString; + break; + case 2: + text = Watches[index].LastChangeString; + break; + } + break; + case 2: + switch (Global.Config.RamWatchPrev_Type) + { + case 1: + text = Watches[index].PrevString; + break; + case 2: + text = Watches[index].LastChangeString; + break; + } + break; + case 3: + text = Watches[index].Changecount.ToString(); + break; + case 4: + switch (Global.Config.RamWatchPrev_Type) + { + case 1: + text = Watches[index].DiffToString(Watches[index].DiffPrev); + break; + case 2: + text = Watches[index].DiffToString(Watches[index].DiffLastChange); + break; + } + break; + case 5: + text = Watches[index].Domain.Name; + break; + case 6: + text = Watches[index].Notes; + break; } } @@ -789,7 +817,8 @@ namespace BizHawk.MultiClient WatchListView.Columns[2].Width = 0; WatchListView.Columns[3].Width = 55; WatchListView.Columns[4].Width = 0; - WatchListView.Columns[5].Width = 128; + WatchListView.Columns[5].Width = 55; + WatchListView.Columns[6].Width = 128; Global.Config.DisplayRamWatch = false; Global.Config.RamWatchSaveWindowPosition = false; } @@ -1072,9 +1101,13 @@ namespace BizHawk.MultiClient Global.Config.RamWatchShowDiffColumn = show; diffToolStripMenuItem.Checked = show; if (show) + { WatchListView.Columns[Global.Config.RamWatchDiffIndex].Width = 59; + } else + { WatchListView.Columns[Global.Config.RamWatchDiffIndex].Width = 0; + } } private void SetChangesColumn(bool show) @@ -1341,30 +1374,62 @@ namespace BizHawk.MultiClient } if (Global.Config.RamWatchAddressIndex >= lowIndex && Global.Config.RamWatchAddressIndex <= highIndex) + { Global.Config.RamWatchAddressIndex += changeIndex; + } if (Global.Config.RamWatchValueIndex >= lowIndex && Global.Config.RamWatchValueIndex <= highIndex) + { Global.Config.RamWatchValueIndex += changeIndex; + } if (Global.Config.RamWatchPrevIndex >= lowIndex && Global.Config.RamWatchPrevIndex <= highIndex) + { Global.Config.RamWatchPrevIndex += changeIndex; + } if (Global.Config.RamWatchChangeIndex >= lowIndex && Global.Config.RamWatchChangeIndex <= highIndex) + { Global.Config.RamWatchChangeIndex += changeIndex; + } if (Global.Config.RamWatchDiffIndex >= lowIndex && Global.Config.RamWatchDiffIndex <= highIndex) + { Global.Config.RamWatchDiffIndex += changeIndex; + } + if (Global.Config.RamWatchDomainIndex >= lowIndex && Global.Config.RamWatchDomainIndex <= highIndex) + { + Global.Config.RamWatchDomainIndex += changeIndex; + } if (Global.Config.RamWatchNotesIndex >= lowIndex && Global.Config.RamWatchNotesIndex <= highIndex) + { Global.Config.RamWatchNotesIndex += changeIndex; + } if (header.Text == "Address") + { Global.Config.RamWatchAddressIndex = e.NewDisplayIndex; + } else if (header.Text == "Value") + { Global.Config.RamWatchValueIndex = e.NewDisplayIndex; + } else if (header.Text == "Prev") + { Global.Config.RamWatchPrevIndex = e.NewDisplayIndex; + } else if (header.Text == "Changes") + { Global.Config.RamWatchChangeIndex = e.NewDisplayIndex; + } else if (header.Text == "Diff") + { Global.Config.RamWatchDiffIndex = e.NewDisplayIndex; + } + else if (header.Text == "Domain") + { + Global.Config.RamWatchDomainIndex = e.NewDisplayIndex; + } else if (header.Text == "Notes") + { Global.Config.RamWatchNotesIndex = e.NewDisplayIndex; + } } private void ColumnPositionSet() @@ -1383,6 +1448,7 @@ namespace BizHawk.MultiClient columnSettings.Add(new KeyValuePair(Global.Config.RamWatchPrevIndex, "Prev")); columnSettings.Add(new KeyValuePair(Global.Config.RamWatchChangeIndex, "Changes")); columnSettings.Add(new KeyValuePair(Global.Config.RamWatchDiffIndex, "Diff")); + columnSettings.Add(new KeyValuePair(Global.Config.RamWatchDomainIndex, "Domain")); columnSettings.Add(new KeyValuePair(Global.Config.RamWatchNotesIndex, "Notes")); columnSettings = columnSettings.OrderBy(s => s.Key).ToList(); @@ -1404,7 +1470,9 @@ namespace BizHawk.MultiClient { string columnName = WatchListView.Columns[columnToOrder].Text; if (sortedCol.CompareTo(columnName) != 0) + { sortReverse = false; + } Watches.Sort((x, y) => x.CompareTo(y, columnName, Global.Config.RamWatchPrev_Type == 1 ? Watch.PREVDEF.LASTFRAME : Watch.PREVDEF.LASTCHANGE) * (sortReverse ? -1 : 1)); sortedCol = columnName; sortReverse = !(sortReverse); diff --git a/BizHawk.MultiClient/tools/Watch.cs b/BizHawk.MultiClient/tools/Watch.cs index 3911d0c818..d8f8b143e3 100644 --- a/BizHawk.MultiClient/tools/Watch.cs +++ b/BizHawk.MultiClient/tools/Watch.cs @@ -664,6 +664,26 @@ namespace BizHawk.MultiClient return this.Notes.CompareTo(Other.Notes); } + private int CompareDomain(Watch Other) + { + if (this.Domain == null & Other.Domain == null) + { + return 0; + } + else if (this.Domain == null) + { + return -1; + } + else if (Other.Domain == null) + { + return 1; + } + else + { + return this.Domain.Name.CompareTo(Other.Domain.Name); + } + } + public int CompareTo(Watch Other, string parameter, PREVDEF previous) { int compare = 0; @@ -681,9 +701,15 @@ namespace BizHawk.MultiClient compare = ComparePrevious(Other, previous); if (compare == 0) { - compare = CompareDiff(Other, previous); + compare = CompareDomain(Other); if (compare == 0) - compare = CompareNotes(Other); + { + compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } } } } @@ -706,7 +732,13 @@ namespace BizHawk.MultiClient { compare = CompareDiff(Other, previous); if (compare == 0) - compare = CompareNotes(Other); + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } } } } @@ -752,7 +784,13 @@ namespace BizHawk.MultiClient { compare = CompareDiff(Other, previous); if (compare == 0) - compare = CompareNotes(Other); + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } } } } @@ -775,7 +813,38 @@ namespace BizHawk.MultiClient { compare = ComparePrevious(Other, previous); if (compare == 0) + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } + } + } + } + } + } + + else if (parameter == "Domain") + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { compare = CompareNotes(Other); + } } } } @@ -798,7 +867,13 @@ namespace BizHawk.MultiClient { compare = ComparePrevious(Other, previous); if (compare == 0) + { compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareDomain(Other); + } + } } } }