Ram Watch/Search/Poke - use Watch objects internal domain value, this commit doesn't add functionatility yet (may have even broke something), but will lead to eventually being able to watch multiple domains at once, and some ram search optimizations

This commit is contained in:
adelikat 2012-09-04 00:33:47 +00:00
parent 0cc6bf072e
commit 2de8e3c346
8 changed files with 393 additions and 287 deletions

View File

@ -653,6 +653,7 @@ namespace BizHawk.MultiClient
w.Value = MakeValue(p); w.Value = MakeValue(p);
w.BigEndian = BigEndian; w.BigEndian = BigEndian;
w.Signed = Watch.DISPTYPE.HEX; w.Signed = Watch.DISPTYPE.HEX;
w.Domain = Domain;
switch (DataSize) switch (DataSize)
{ {
@ -669,7 +670,7 @@ namespace BizHawk.MultiClient
} }
RamPoke poke = new RamPoke(); RamPoke poke = new RamPoke();
poke.SetWatchObject(w, Domain); poke.SetWatchObject(w);
poke.location = GetAddressCoordinates(p); poke.location = GetAddressCoordinates(p);
Global.Sound.StopSound(); Global.Sound.StopSound();
poke.ShowDialog(); poke.ShowDialog();

View File

@ -23,11 +23,11 @@ namespace BizHawk.MultiClient
InitializeComponent(); InitializeComponent();
} }
public void SetWatchObject(Watch w, MemoryDomain d) public void SetWatchObject(Watch w)
{ {
PopulateMemoryDomainComboBox(); PopulateMemoryDomainComboBox();
watch = new Watch(w); watch = new Watch(w);
domain = d; domain = w.Domain;
} }
private void RamPoke_Load(object sender, EventArgs e) private void RamPoke_Load(object sender, EventArgs e)
@ -189,8 +189,8 @@ namespace BizHawk.MultiClient
{ {
watch.Value = int.Parse(ValueBox.Text); watch.Value = int.Parse(ValueBox.Text);
} }
watch.Domain = domain;
watch.PokeAddress(domain); watch.PokeAddress();
string value; string value;
if (HexRadio.Checked) if (HexRadio.Checked)

View File

@ -81,7 +81,7 @@ namespace BizHawk.MultiClient
for (int x = Searches.Count - 1; x >= 0; x--) for (int x = Searches.Count - 1; x >= 0; x--)
{ {
Searches[x].PeekAddress(Domain); Searches[x].PeekAddress();
} }
if (AutoSearchCheckBox.Checked) if (AutoSearchCheckBox.Checked)
{ {
@ -395,7 +395,6 @@ namespace BizHawk.MultiClient
{ {
ClearUndo(); ClearUndo();
ClearRedo(); ClearRedo();
//weededList.Clear();
IsAWeededList = false; IsAWeededList = false;
Searches.Clear(); Searches.Clear();
SetPlatformAndMemoryDomainLabel(); SetPlatformAndMemoryDomainLabel();
@ -422,7 +421,8 @@ namespace BizHawk.MultiClient
Searches[x].Type = GetDataSize(); Searches[x].Type = GetDataSize();
Searches[x].BigEndian = GetBigEndian(); Searches[x].BigEndian = GetBigEndian();
Searches[x].Signed = GetDataType(); Searches[x].Signed = GetDataType();
Searches[x].PeekAddress(Domain); Searches[x].Domain = Domain;
Searches[x].PeekAddress();
Searches[x].Prev = Searches[x].Value; Searches[x].Prev = Searches[x].Value;
Searches[x].Original = Searches[x].Value; Searches[x].Original = Searches[x].Value;
Searches[x].LastChange = Searches[x].Value; Searches[x].LastChange = Searches[x].Value;
@ -493,7 +493,9 @@ namespace BizHawk.MultiClient
int x = indexes[0]; int x = indexes[0];
Watch bob = Searches[indexes[0]]; Watch bob = Searches[indexes[0]];
if (indexes.Count > 0) if (indexes.Count > 0)
p.SetWatchObject(Searches[indexes[0]], Domain); {
p.SetWatchObject(Searches[indexes[0]]);
}
p.location = GetPromptPoint(); p.location = GetPromptPoint();
p.ShowDialog(); p.ShowDialog();
UpdateValues(); UpdateValues();
@ -1566,7 +1568,7 @@ namespace BizHawk.MultiClient
int changes = list[x].Changecount; int changes = list[x].Changecount;
list[x].Type = s; list[x].Type = s;
list[x].BigEndian = GetBigEndian(); list[x].BigEndian = GetBigEndian();
list[x].PeekAddress(Domain); list[x].PeekAddress();
list[x].Prev = list[x].Value; list[x].Prev = list[x].Value;
list[x].Original = list[x].Value; list[x].Original = list[x].Value;
list[x].LastChange = list[x].Value; list[x].LastChange = list[x].Value;

View File

@ -63,8 +63,9 @@ namespace BizHawk.MultiClient
{ {
List<Watch> w = new List<Watch>(); List<Watch> w = new List<Watch>();
for (int x = 0; x < Watches.Count; x++) for (int x = 0; x < Watches.Count; x++)
{
w.Add(new Watch(Watches[x])); w.Add(new Watch(Watches[x]));
}
return w; return w;
} }
@ -82,7 +83,7 @@ namespace BizHawk.MultiClient
for (int x = 0; x < Watches.Count; x++) for (int x = 0; x < Watches.Count; x++)
{ {
Watches[x].PeekAddress(Domain); Watches[x].PeekAddress();
} }
if (Global.Config.DisplayRamWatch) if (Global.Config.DisplayRamWatch)
@ -397,7 +398,8 @@ namespace BizHawk.MultiClient
private void InitializeAddress(Watch w) private void InitializeAddress(Watch w)
{ {
w.PeekAddress(Domain); w.Domain = Domain;
w.PeekAddress();
w.Prev = w.Value; w.Prev = w.Value;
w.Original = w.Value; w.Original = w.Value;
w.LastChange = w.Value; w.LastChange = w.Value;
@ -500,12 +502,15 @@ namespace BizHawk.MultiClient
} }
List<int> i = new List<int>(); List<int> i = new List<int>();
for (int z = 0; z < indexes.Count; z++) for (int z = 0; z < indexes.Count; z++)
{
i.Add(indexes[z] - 1); i.Add(indexes[z] - 1);
}
WatchListView.SelectedIndices.Clear(); WatchListView.SelectedIndices.Clear();
for (int z = 0; z < i.Count; z++) for (int z = 0; z < i.Count; z++)
{
WatchListView.SelectItem(i[z], true); WatchListView.SelectItem(i[z], true);
}
DisplayWatchList(); DisplayWatchList();
} }
@ -820,7 +825,9 @@ namespace BizHawk.MultiClient
Watches.Insert(indexes[0], w); Watches.Insert(indexes[0], w);
} }
else else
{
Watches.Add(w); Watches.Add(w);
}
DisplayWatchList(); DisplayWatchList();
} }
@ -876,7 +883,9 @@ namespace BizHawk.MultiClient
RamPoke p = new RamPoke(); RamPoke p = new RamPoke();
Global.Sound.StartSound(); Global.Sound.StartSound();
if (indexes.Count > 0) if (indexes.Count > 0)
p.SetWatchObject(Watches[indexes[0]], Domain); {
p.SetWatchObject(Watches[indexes[0]]);
}
p.location = GetPromptPoint(); p.location = GetPromptPoint();
p.ShowDialog(); p.ShowDialog();
UpdateValues(); UpdateValues();

View File

@ -28,240 +28,264 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RamWatchNewWatch)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RamWatchNewWatch));
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.AddressBox = new System.Windows.Forms.TextBox(); this.AddressBox = new System.Windows.Forms.TextBox();
this.NotesBox = new System.Windows.Forms.TextBox(); this.NotesBox = new System.Windows.Forms.TextBox();
this.DataTypeGroupBox = new System.Windows.Forms.GroupBox(); this.DataTypeGroupBox = new System.Windows.Forms.GroupBox();
this.HexRadio = new System.Windows.Forms.RadioButton(); this.HexRadio = new System.Windows.Forms.RadioButton();
this.UnsignedRadio = new System.Windows.Forms.RadioButton(); this.UnsignedRadio = new System.Windows.Forms.RadioButton();
this.SignedRadio = new System.Windows.Forms.RadioButton(); this.SignedRadio = new System.Windows.Forms.RadioButton();
this.DataSizeBox = new System.Windows.Forms.GroupBox(); this.DataSizeBox = new System.Windows.Forms.GroupBox();
this.Byte4Radio = new System.Windows.Forms.RadioButton(); this.Byte4Radio = new System.Windows.Forms.RadioButton();
this.Byte2Radio = new System.Windows.Forms.RadioButton(); this.Byte2Radio = new System.Windows.Forms.RadioButton();
this.Byte1Radio = new System.Windows.Forms.RadioButton(); this.Byte1Radio = new System.Windows.Forms.RadioButton();
this.EndianBox = new System.Windows.Forms.GroupBox(); this.EndianBox = new System.Windows.Forms.GroupBox();
this.LittleEndianRadio = new System.Windows.Forms.RadioButton(); this.LittleEndianRadio = new System.Windows.Forms.RadioButton();
this.BigEndianRadio = new System.Windows.Forms.RadioButton(); this.BigEndianRadio = new System.Windows.Forms.RadioButton();
this.OK = new System.Windows.Forms.Button(); this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button(); this.Cancel = new System.Windows.Forms.Button();
this.DataTypeGroupBox.SuspendLayout(); this.label6 = new System.Windows.Forms.Label();
this.DataSizeBox.SuspendLayout(); this.DomainComboBox = new System.Windows.Forms.ComboBox();
this.EndianBox.SuspendLayout(); this.DataTypeGroupBox.SuspendLayout();
this.SuspendLayout(); this.DataSizeBox.SuspendLayout();
// this.EndianBox.SuspendLayout();
// label1 this.SuspendLayout();
// //
this.label1.AutoSize = true; // label1
this.label1.Location = new System.Drawing.Point(9, 9); //
this.label1.Name = "label1"; this.label1.AutoSize = true;
this.label1.Size = new System.Drawing.Size(62, 13); this.label1.Location = new System.Drawing.Point(9, 9);
this.label1.TabIndex = 0; this.label1.Name = "label1";
this.label1.Text = "Address: 0x"; this.label1.Size = new System.Drawing.Size(62, 13);
// this.label1.TabIndex = 0;
// label2 this.label1.Text = "Address: 0x";
// //
this.label2.AutoSize = true; // label2
this.label2.Location = new System.Drawing.Point(9, 35); //
this.label2.Name = "label2"; this.label2.AutoSize = true;
this.label2.Size = new System.Drawing.Size(38, 13); this.label2.Location = new System.Drawing.Point(9, 35);
this.label2.TabIndex = 1; this.label2.Name = "label2";
this.label2.Text = "Notes:"; this.label2.Size = new System.Drawing.Size(38, 13);
// this.label2.TabIndex = 1;
// AddressBox this.label2.Text = "Notes:";
// //
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; // AddressBox
this.AddressBox.Location = new System.Drawing.Point(69, 6); //
this.AddressBox.MaxLength = 8; this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Name = "AddressBox"; this.AddressBox.Location = new System.Drawing.Point(69, 6);
this.AddressBox.Size = new System.Drawing.Size(100, 20); this.AddressBox.MaxLength = 8;
this.AddressBox.TabIndex = 2; this.AddressBox.Name = "AddressBox";
this.AddressBox.Text = "00000000"; this.AddressBox.Size = new System.Drawing.Size(100, 20);
this.AddressBox.Leave += new System.EventHandler(this.AddressBox_Leave); this.AddressBox.TabIndex = 2;
this.AddressBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AddressBox_KeyPress); this.AddressBox.Text = "00000000";
// this.AddressBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AddressBox_KeyPress);
// NotesBox this.AddressBox.Leave += new System.EventHandler(this.AddressBox_Leave);
// //
this.NotesBox.Location = new System.Drawing.Point(69, 32); // NotesBox
this.NotesBox.MaxLength = 256; //
this.NotesBox.Name = "NotesBox"; this.NotesBox.Location = new System.Drawing.Point(69, 32);
this.NotesBox.Size = new System.Drawing.Size(100, 20); this.NotesBox.MaxLength = 256;
this.NotesBox.TabIndex = 3; this.NotesBox.Name = "NotesBox";
// this.NotesBox.Size = new System.Drawing.Size(100, 20);
// DataTypeGroupBox this.NotesBox.TabIndex = 3;
// //
this.DataTypeGroupBox.Controls.Add(this.HexRadio); // DataTypeGroupBox
this.DataTypeGroupBox.Controls.Add(this.UnsignedRadio); //
this.DataTypeGroupBox.Controls.Add(this.SignedRadio); this.DataTypeGroupBox.Controls.Add(this.HexRadio);
this.DataTypeGroupBox.Location = new System.Drawing.Point(12, 67); this.DataTypeGroupBox.Controls.Add(this.UnsignedRadio);
this.DataTypeGroupBox.Name = "DataTypeGroupBox"; this.DataTypeGroupBox.Controls.Add(this.SignedRadio);
this.DataTypeGroupBox.Size = new System.Drawing.Size(95, 79); this.DataTypeGroupBox.Location = new System.Drawing.Point(12, 67);
this.DataTypeGroupBox.TabIndex = 4; this.DataTypeGroupBox.Name = "DataTypeGroupBox";
this.DataTypeGroupBox.TabStop = false; this.DataTypeGroupBox.Size = new System.Drawing.Size(95, 79);
this.DataTypeGroupBox.Text = "Data Type"; this.DataTypeGroupBox.TabIndex = 4;
// this.DataTypeGroupBox.TabStop = false;
// HexRadio this.DataTypeGroupBox.Text = "Data Type";
// //
this.HexRadio.AutoSize = true; // HexRadio
this.HexRadio.Location = new System.Drawing.Point(4, 51); //
this.HexRadio.Name = "HexRadio"; this.HexRadio.AutoSize = true;
this.HexRadio.Size = new System.Drawing.Size(86, 17); this.HexRadio.Location = new System.Drawing.Point(4, 51);
this.HexRadio.TabIndex = 2; this.HexRadio.Name = "HexRadio";
this.HexRadio.Text = "Hexadecimal"; this.HexRadio.Size = new System.Drawing.Size(86, 17);
this.HexRadio.UseVisualStyleBackColor = true; this.HexRadio.TabIndex = 2;
// this.HexRadio.Text = "Hexadecimal";
// UnsignedRadio this.HexRadio.UseVisualStyleBackColor = true;
// //
this.UnsignedRadio.AutoSize = true; // UnsignedRadio
this.UnsignedRadio.Checked = true; //
this.UnsignedRadio.Location = new System.Drawing.Point(4, 34); this.UnsignedRadio.AutoSize = true;
this.UnsignedRadio.Name = "UnsignedRadio"; this.UnsignedRadio.Checked = true;
this.UnsignedRadio.Size = new System.Drawing.Size(70, 17); this.UnsignedRadio.Location = new System.Drawing.Point(4, 34);
this.UnsignedRadio.TabIndex = 1; this.UnsignedRadio.Name = "UnsignedRadio";
this.UnsignedRadio.TabStop = true; this.UnsignedRadio.Size = new System.Drawing.Size(70, 17);
this.UnsignedRadio.Text = "Unsigned"; this.UnsignedRadio.TabIndex = 1;
this.UnsignedRadio.UseVisualStyleBackColor = true; this.UnsignedRadio.TabStop = true;
// this.UnsignedRadio.Text = "Unsigned";
// SignedRadio this.UnsignedRadio.UseVisualStyleBackColor = true;
// //
this.SignedRadio.AutoSize = true; // SignedRadio
this.SignedRadio.Location = new System.Drawing.Point(4, 17); //
this.SignedRadio.Name = "SignedRadio"; this.SignedRadio.AutoSize = true;
this.SignedRadio.Size = new System.Drawing.Size(58, 17); this.SignedRadio.Location = new System.Drawing.Point(4, 17);
this.SignedRadio.TabIndex = 0; this.SignedRadio.Name = "SignedRadio";
this.SignedRadio.Text = "Signed"; this.SignedRadio.Size = new System.Drawing.Size(58, 17);
this.SignedRadio.UseVisualStyleBackColor = true; this.SignedRadio.TabIndex = 0;
// this.SignedRadio.Text = "Signed";
// DataSizeBox this.SignedRadio.UseVisualStyleBackColor = true;
// //
this.DataSizeBox.Controls.Add(this.Byte4Radio); // DataSizeBox
this.DataSizeBox.Controls.Add(this.Byte2Radio); //
this.DataSizeBox.Controls.Add(this.Byte1Radio); this.DataSizeBox.Controls.Add(this.Byte4Radio);
this.DataSizeBox.Location = new System.Drawing.Point(115, 67); this.DataSizeBox.Controls.Add(this.Byte2Radio);
this.DataSizeBox.Name = "DataSizeBox"; this.DataSizeBox.Controls.Add(this.Byte1Radio);
this.DataSizeBox.Size = new System.Drawing.Size(83, 79); this.DataSizeBox.Location = new System.Drawing.Point(115, 67);
this.DataSizeBox.TabIndex = 5; this.DataSizeBox.Name = "DataSizeBox";
this.DataSizeBox.TabStop = false; this.DataSizeBox.Size = new System.Drawing.Size(83, 79);
this.DataSizeBox.Text = "Data Size:"; this.DataSizeBox.TabIndex = 5;
// this.DataSizeBox.TabStop = false;
// Byte4Radio this.DataSizeBox.Text = "Data Size:";
// //
this.Byte4Radio.AutoSize = true; // Byte4Radio
this.Byte4Radio.Location = new System.Drawing.Point(5, 51); //
this.Byte4Radio.Name = "Byte4Radio"; this.Byte4Radio.AutoSize = true;
this.Byte4Radio.Size = new System.Drawing.Size(60, 17); this.Byte4Radio.Location = new System.Drawing.Point(5, 51);
this.Byte4Radio.TabIndex = 2; this.Byte4Radio.Name = "Byte4Radio";
this.Byte4Radio.Text = "4 Bytes"; this.Byte4Radio.Size = new System.Drawing.Size(60, 17);
this.Byte4Radio.UseVisualStyleBackColor = true; this.Byte4Radio.TabIndex = 2;
// this.Byte4Radio.Text = "4 Bytes";
// Byte2Radio this.Byte4Radio.UseVisualStyleBackColor = true;
// //
this.Byte2Radio.AutoSize = true; // Byte2Radio
this.Byte2Radio.Location = new System.Drawing.Point(5, 34); //
this.Byte2Radio.Name = "Byte2Radio"; this.Byte2Radio.AutoSize = true;
this.Byte2Radio.Size = new System.Drawing.Size(60, 17); this.Byte2Radio.Location = new System.Drawing.Point(5, 34);
this.Byte2Radio.TabIndex = 1; this.Byte2Radio.Name = "Byte2Radio";
this.Byte2Radio.Text = "2 Bytes"; this.Byte2Radio.Size = new System.Drawing.Size(60, 17);
this.Byte2Radio.UseVisualStyleBackColor = true; this.Byte2Radio.TabIndex = 1;
// this.Byte2Radio.Text = "2 Bytes";
// Byte1Radio this.Byte2Radio.UseVisualStyleBackColor = true;
// //
this.Byte1Radio.AutoSize = true; // Byte1Radio
this.Byte1Radio.Checked = true; //
this.Byte1Radio.Location = new System.Drawing.Point(5, 17); this.Byte1Radio.AutoSize = true;
this.Byte1Radio.Name = "Byte1Radio"; this.Byte1Radio.Checked = true;
this.Byte1Radio.Size = new System.Drawing.Size(55, 17); this.Byte1Radio.Location = new System.Drawing.Point(5, 17);
this.Byte1Radio.TabIndex = 0; this.Byte1Radio.Name = "Byte1Radio";
this.Byte1Radio.TabStop = true; this.Byte1Radio.Size = new System.Drawing.Size(55, 17);
this.Byte1Radio.Text = "1 Byte"; this.Byte1Radio.TabIndex = 0;
this.Byte1Radio.UseVisualStyleBackColor = true; this.Byte1Radio.TabStop = true;
// this.Byte1Radio.Text = "1 Byte";
// EndianBox this.Byte1Radio.UseVisualStyleBackColor = true;
// //
this.EndianBox.Controls.Add(this.LittleEndianRadio); // EndianBox
this.EndianBox.Controls.Add(this.BigEndianRadio); //
this.EndianBox.Location = new System.Drawing.Point(12, 152); this.EndianBox.Controls.Add(this.LittleEndianRadio);
this.EndianBox.Name = "EndianBox"; this.EndianBox.Controls.Add(this.BigEndianRadio);
this.EndianBox.Size = new System.Drawing.Size(117, 55); this.EndianBox.Location = new System.Drawing.Point(12, 152);
this.EndianBox.TabIndex = 6; this.EndianBox.Name = "EndianBox";
this.EndianBox.TabStop = false; this.EndianBox.Size = new System.Drawing.Size(117, 55);
this.EndianBox.Text = "Endian"; this.EndianBox.TabIndex = 6;
// this.EndianBox.TabStop = false;
// LittleEndianRadio this.EndianBox.Text = "Endian";
// //
this.LittleEndianRadio.AutoSize = true; // LittleEndianRadio
this.LittleEndianRadio.Location = new System.Drawing.Point(4, 35); //
this.LittleEndianRadio.Name = "LittleEndianRadio"; this.LittleEndianRadio.AutoSize = true;
this.LittleEndianRadio.Size = new System.Drawing.Size(83, 17); this.LittleEndianRadio.Location = new System.Drawing.Point(4, 35);
this.LittleEndianRadio.TabIndex = 1; this.LittleEndianRadio.Name = "LittleEndianRadio";
this.LittleEndianRadio.Text = "Little Endian"; this.LittleEndianRadio.Size = new System.Drawing.Size(83, 17);
this.LittleEndianRadio.UseVisualStyleBackColor = true; this.LittleEndianRadio.TabIndex = 1;
// this.LittleEndianRadio.Text = "Little Endian";
// BigEndianRadio this.LittleEndianRadio.UseVisualStyleBackColor = true;
// //
this.BigEndianRadio.AutoSize = true; // BigEndianRadio
this.BigEndianRadio.Checked = true; //
this.BigEndianRadio.Location = new System.Drawing.Point(4, 18); this.BigEndianRadio.AutoSize = true;
this.BigEndianRadio.Name = "BigEndianRadio"; this.BigEndianRadio.Checked = true;
this.BigEndianRadio.Size = new System.Drawing.Size(76, 17); this.BigEndianRadio.Location = new System.Drawing.Point(4, 18);
this.BigEndianRadio.TabIndex = 0; this.BigEndianRadio.Name = "BigEndianRadio";
this.BigEndianRadio.TabStop = true; this.BigEndianRadio.Size = new System.Drawing.Size(76, 17);
this.BigEndianRadio.Text = "Big Endian"; this.BigEndianRadio.TabIndex = 0;
this.BigEndianRadio.UseVisualStyleBackColor = true; this.BigEndianRadio.TabStop = true;
// this.BigEndianRadio.Text = "Big Endian";
// OK this.BigEndianRadio.UseVisualStyleBackColor = true;
// //
this.OK.Location = new System.Drawing.Point(12, 222); // OK
this.OK.Name = "OK"; //
this.OK.Size = new System.Drawing.Size(75, 23); this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.OK.TabIndex = 7; this.OK.Location = new System.Drawing.Point(12, 260);
this.OK.Text = "Ok"; this.OK.Name = "OK";
this.OK.UseVisualStyleBackColor = true; this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.Click += new System.EventHandler(this.OK_Click); this.OK.TabIndex = 7;
// this.OK.Text = "Ok";
// Cancel this.OK.UseVisualStyleBackColor = true;
// this.OK.Click += new System.EventHandler(this.OK_Click);
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; //
this.Cancel.Location = new System.Drawing.Point(123, 222); // Cancel
this.Cancel.Name = "Cancel"; //
this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.TabIndex = 8; this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Text = "Cancel"; this.Cancel.Location = new System.Drawing.Point(123, 260);
this.Cancel.UseVisualStyleBackColor = true; this.Cancel.Name = "Cancel";
this.Cancel.Click += new System.EventHandler(this.Cancel_Click); this.Cancel.Size = new System.Drawing.Size(75, 23);
// this.Cancel.TabIndex = 8;
// RamWatchNewWatch this.Cancel.Text = "Cancel";
// this.Cancel.UseVisualStyleBackColor = true;
this.AcceptButton = this.OK; this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; // label6
this.CancelButton = this.Cancel; //
this.ClientSize = new System.Drawing.Size(213, 258); this.label6.AutoSize = true;
this.Controls.Add(this.Cancel); this.label6.Location = new System.Drawing.Point(11, 214);
this.Controls.Add(this.OK); this.label6.Name = "label6";
this.Controls.Add(this.EndianBox); this.label6.Size = new System.Drawing.Size(83, 13);
this.Controls.Add(this.DataSizeBox); this.label6.TabIndex = 15;
this.Controls.Add(this.DataTypeGroupBox); this.label6.Text = "Memory Domain";
this.Controls.Add(this.NotesBox); //
this.Controls.Add(this.AddressBox); // DomainComboBox
this.Controls.Add(this.label2); //
this.Controls.Add(this.label1); this.DomainComboBox.FormattingEnabled = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.DomainComboBox.Location = new System.Drawing.Point(12, 230);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.DomainComboBox.Name = "DomainComboBox";
this.MaximizeBox = false; this.DomainComboBox.Size = new System.Drawing.Size(141, 21);
this.MinimizeBox = false; this.DomainComboBox.TabIndex = 14;
this.Name = "RamWatchNewWatch"; this.DomainComboBox.SelectedIndexChanged += new System.EventHandler(this.DomainComboBox_SelectedIndexChanged);
this.Text = "New Watch"; //
this.Load += new System.EventHandler(this.RamWatchNewWatch_Load); // RamWatchNewWatch
this.DataTypeGroupBox.ResumeLayout(false); //
this.DataTypeGroupBox.PerformLayout(); this.AcceptButton = this.OK;
this.DataSizeBox.ResumeLayout(false); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.DataSizeBox.PerformLayout(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.EndianBox.ResumeLayout(false); this.CancelButton = this.Cancel;
this.EndianBox.PerformLayout(); this.ClientSize = new System.Drawing.Size(213, 296);
this.ResumeLayout(false); this.Controls.Add(this.label6);
this.PerformLayout(); this.Controls.Add(this.DomainComboBox);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.OK);
this.Controls.Add(this.EndianBox);
this.Controls.Add(this.DataSizeBox);
this.Controls.Add(this.DataTypeGroupBox);
this.Controls.Add(this.NotesBox);
this.Controls.Add(this.AddressBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "RamWatchNewWatch";
this.Text = "New Watch";
this.Load += new System.EventHandler(this.RamWatchNewWatch_Load);
this.DataTypeGroupBox.ResumeLayout(false);
this.DataTypeGroupBox.PerformLayout();
this.DataSizeBox.ResumeLayout(false);
this.DataSizeBox.PerformLayout();
this.EndianBox.ResumeLayout(false);
this.EndianBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
} }
@ -284,5 +308,7 @@
private System.Windows.Forms.RadioButton LittleEndianRadio; private System.Windows.Forms.RadioButton LittleEndianRadio;
private System.Windows.Forms.Button OK; private System.Windows.Forms.Button OK;
private System.Windows.Forms.Button Cancel; private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox DomainComboBox;
} }
} }

View File

@ -13,6 +13,7 @@ namespace BizHawk.MultiClient
public partial class RamWatchNewWatch : Form public partial class RamWatchNewWatch : Form
{ {
public Watch watch = new Watch(); public Watch watch = new Watch();
public MemoryDomain domain = Global.Emulator.MainMemory;
public bool userSelected = false; public bool userSelected = false;
public bool customSetup = false; public bool customSetup = false;
public Point location = new Point(); public Point location = new Point();
@ -76,6 +77,11 @@ namespace BizHawk.MultiClient
LittleEndianRadio.Checked = true; LittleEndianRadio.Checked = true;
} }
public void SetDomain(MemoryDomain domain)
{
watch.Domain = domain;
}
public void SetEndian(Endian endian) public void SetEndian(Endian endian)
{ {
if (endian == Endian.Big) if (endian == Endian.Big)
@ -99,7 +105,11 @@ namespace BizHawk.MultiClient
} }
if (location.X > 0 && location.Y > 0) if (location.X > 0 && location.Y > 0)
{
this.Location = location; this.Location = location;
}
PopulateMemoryDomainComboBox();
} }
private void Cancel_Click(object sender, EventArgs e) private void Cancel_Click(object sender, EventArgs e)
@ -159,7 +169,7 @@ namespace BizHawk.MultiClient
{ {
watch.BigEndian = false; watch.BigEndian = false;
} }
watch.Domain = domain;
watch.Notes = NotesBox.Text; watch.Notes = NotesBox.Text;
this.Close(); this.Close();
@ -184,5 +194,61 @@ namespace BizHawk.MultiClient
if (!InputValidate.IsValidHexNumber(e.KeyChar)) if (!InputValidate.IsValidHexNumber(e.KeyChar))
e.Handled = true; e.Handled = true;
} }
private void PopulateMemoryDomainComboBox()
{
DomainComboBox.Items.Clear();
if (Global.Emulator.MemoryDomains.Count > 0)
{
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
{
string str = Global.Emulator.MemoryDomains[x].ToString();
DomainComboBox.Items.Add(str);
}
}
SetDomainSelection();
}
private int GetNumDigits(Int32 i)
{
if (i < 0x10000) return 4;
if (i < 0x100000) return 5;
if (i < 0x1000000) return 6;
if (i < 0x10000000) return 7;
else return 8;
}
private void SetAddressBox()
{
AddressBox.Text = String.Format("{0:X" +
GetNumDigits(watch.Address) + "}", watch.Address);
}
private void SetDomainSelection()
{
//Counts should always be the same, but just in case, let's check
int max;
if (Global.Emulator.MemoryDomains.Count < DomainComboBox.Items.Count)
max = Global.Emulator.MemoryDomains.Count;
else
max = DomainComboBox.Items.Count;
for (int x = 0; x < max; x++)
{
if (domain.ToString() == DomainComboBox.Items[x].ToString())
DomainComboBox.SelectedIndex = x;
}
}
private void DomainComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
int x = GetNumDigits(domain.Size);
watch.Address = 0;
watch.Value = 0;
watch.Domain = domain;
SetAddressBox();
AddressBox.MaxLength = GetNumDigits(domain.Size);
}
} }
} }

View File

@ -112,12 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAABMLAAATCwAAAAEAAAAA AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAABMLAAATCwAAAAEAAAAA

View File

@ -270,48 +270,50 @@ namespace BizHawk.MultiClient
} }
} }
public void PeekAddress(MemoryDomain domain) public void PeekAddress()
{ {
if (Type == TYPE.SEPARATOR) if (Type == TYPE.SEPARATOR)
{
return; return;
}
Prev = Value; Prev = Value;
switch (Type) switch (Type)
{ {
case TYPE.BYTE: case TYPE.BYTE:
Value = domain.PeekByte(Address); Value = Domain.PeekByte(Address);
break; break;
case TYPE.WORD: case TYPE.WORD:
if (BigEndian) if (BigEndian)
{ {
Value = 0; Value = 0;
Value |= domain.PeekByte(Address) << 8; Value |= Domain.PeekByte(Address) << 8;
Value |= domain.PeekByte(Address + 1); Value |= Domain.PeekByte(Address + 1);
} }
else else
{ {
Value = 0; Value = 0;
Value |= domain.PeekByte(Address); Value |= Domain.PeekByte(Address);
Value |= domain.PeekByte(Address + 1) << 8; Value |= Domain.PeekByte(Address + 1) << 8;
} }
break; break;
case TYPE.DWORD: case TYPE.DWORD:
if (BigEndian) if (BigEndian)
{ {
Value = 0; Value = 0;
Value |= domain.PeekByte(Address) << 24; Value |= Domain.PeekByte(Address) << 24;
Value |= domain.PeekByte(Address + 1) << 16; Value |= Domain.PeekByte(Address + 1) << 16;
Value |= domain.PeekByte(Address + 2) << 8; Value |= Domain.PeekByte(Address + 2) << 8;
Value |= domain.PeekByte(Address + 3) << 0; Value |= Domain.PeekByte(Address + 3) << 0;
} }
else else
{ {
Value = 0; Value = 0;
Value |= domain.PeekByte(Address) << 0; Value |= Domain.PeekByte(Address) << 0;
Value |= domain.PeekByte(Address + 1) << 8; Value |= Domain.PeekByte(Address + 1) << 8;
Value |= domain.PeekByte(Address + 2) << 16; Value |= Domain.PeekByte(Address + 2) << 16;
Value |= domain.PeekByte(Address + 3) << 24; Value |= Domain.PeekByte(Address + 3) << 24;
} }
break; break;
} }
@ -323,7 +325,7 @@ namespace BizHawk.MultiClient
} }
} }
public void PokeAddress(MemoryDomain domain) public void PokeAddress()
{ {
if (Type == TYPE.SEPARATOR) if (Type == TYPE.SEPARATOR)
return; return;
@ -331,13 +333,13 @@ namespace BizHawk.MultiClient
switch (Type) switch (Type)
{ {
case TYPE.BYTE: case TYPE.BYTE:
PokeByte(domain); PokeByte();
break; break;
case TYPE.WORD: case TYPE.WORD:
PokeWord(domain); PokeWord();
break; break;
case TYPE.DWORD: case TYPE.DWORD:
PokeDWord(domain); PokeDWord();
break; break;
} }
} }
@ -421,40 +423,40 @@ namespace BizHawk.MultiClient
#region Helpers #region Helpers
private void PokeByte(MemoryDomain domain) private void PokeByte()
{ {
domain.PokeByte(Address, (byte)Value); Domain.PokeByte(Address, (byte)Value);
} }
private void PokeWord(MemoryDomain domain) private void PokeWord()
{ {
if (BigEndian) if (BigEndian)
{ {
domain.PokeByte(Address + 0, (byte)(Value >> 8)); Domain.PokeByte(Address + 0, (byte)(Value >> 8));
domain.PokeByte(Address + 1, (byte)(Value)); Domain.PokeByte(Address + 1, (byte)(Value));
} }
else else
{ {
domain.PokeByte(Address + 0, (byte)(Value)); Domain.PokeByte(Address + 0, (byte)(Value));
domain.PokeByte(Address + 1, (byte)(Value >> 8)); Domain.PokeByte(Address + 1, (byte)(Value >> 8));
} }
} }
private void PokeDWord(MemoryDomain domain) private void PokeDWord()
{ {
if (BigEndian) if (BigEndian)
{ {
domain.PokeByte(Address + 0, (byte)(Value << 24)); Domain.PokeByte(Address + 0, (byte)(Value << 24));
domain.PokeByte(Address + 1, (byte)(Value << 16)); Domain.PokeByte(Address + 1, (byte)(Value << 16));
domain.PokeByte(Address + 2, (byte)(Value << 8)); Domain.PokeByte(Address + 2, (byte)(Value << 8));
domain.PokeByte(Address + 3, (byte)(Value)); Domain.PokeByte(Address + 3, (byte)(Value));
} }
else else
{ {
domain.PokeByte(Address + 0, (byte)(Value)); Domain.PokeByte(Address + 0, (byte)(Value));
domain.PokeByte(Address + 1, (byte)(Value << 8)); Domain.PokeByte(Address + 1, (byte)(Value << 8));
domain.PokeByte(Address + 2, (byte)(Value << 16)); Domain.PokeByte(Address + 2, (byte)(Value << 16));
domain.PokeByte(Address + 3, (byte)(Value << 24)); Domain.PokeByte(Address + 3, (byte)(Value << 24));
} }
} }