Ram poke - Implement memory domain selection, on memory domain selection set addressbox length, reset address & value. Hex Editor - when show frozen addresses, check that addresses is in the selected memory domain. Cheat Window - update memory domain selection when clicking a cheat list item
This commit is contained in:
parent
321a45722e
commit
9cbe8626f3
|
@ -684,6 +684,7 @@ namespace BizHawk.MultiClient
|
|||
NameBox.Text = Global.CheatList.Cheat(indexes[0]).name;
|
||||
AddressBox.Text = Global.CheatList.FormatAddress(Global.CheatList.Cheat(indexes[0]).address);
|
||||
ValueBox.Text = String.Format("{0:X2}", Global.CheatList.Cheat(indexes[0]).value);
|
||||
SetDomainSelection(Global.CheatList.Cheat(indexes[0]).domain.ToString());
|
||||
CheatListView.Refresh();
|
||||
}
|
||||
}
|
||||
|
@ -996,5 +997,21 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDomainSelection(string domainStr)
|
||||
{
|
||||
//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 (domainStr == DomainComboBox.Items[x].ToString())
|
||||
DomainComboBox.SelectedIndex = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,6 +232,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
UpdateGroupBoxTitle();
|
||||
ResetScrollBar();
|
||||
MemoryViewerBox.Refresh();
|
||||
}
|
||||
|
||||
private void UpdateGroupBoxTitle()
|
||||
|
@ -787,9 +788,12 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (IsVisible(Global.CheatList.cheatList[x].address))
|
||||
{
|
||||
Rectangle rect = new Rectangle(GetAddressCoordinates(Global.CheatList.cheatList[x].address), new Size(15 * Global.Config.HexEditorDataSize, fontHeight));
|
||||
e.Graphics.DrawRectangle(new Pen(Brushes.Black), rect);
|
||||
e.Graphics.FillRectangle(Brushes.LightBlue, rect);
|
||||
if (Domain.ToString() == Global.CheatList.cheatList[x].domain.ToString())
|
||||
{
|
||||
Rectangle rect = new Rectangle(GetAddressCoordinates(Global.CheatList.cheatList[x].address), new Size(15 * Global.Config.HexEditorDataSize, fontHeight));
|
||||
e.Graphics.DrawRectangle(new Pen(Brushes.Black), rect);
|
||||
e.Graphics.FillRectangle(Brushes.LightBlue, rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addressHighlighted >= 0 && IsVisible(addressHighlighted))
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
this.ValeLabel = new System.Windows.Forms.Label();
|
||||
this.ValueBox = new System.Windows.Forms.TextBox();
|
||||
this.ValueHexLabel = new System.Windows.Forms.Label();
|
||||
this.DomainComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.DataTypeGroupBox.SuspendLayout();
|
||||
this.DataSizeBox.SuspendLayout();
|
||||
this.EndianBox.SuspendLayout();
|
||||
|
@ -200,22 +202,24 @@
|
|||
//
|
||||
// OK
|
||||
//
|
||||
this.OK.Location = new System.Drawing.Point(12, 253);
|
||||
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.OK.Location = new System.Drawing.Point(12, 293);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.OK.TabIndex = 7;
|
||||
this.OK.TabIndex = 8;
|
||||
this.OK.Text = "&Poke";
|
||||
this.OK.UseVisualStyleBackColor = true;
|
||||
this.OK.Click += new System.EventHandler(this.OK_Click);
|
||||
//
|
||||
// Cancel
|
||||
//
|
||||
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(123, 253);
|
||||
this.Cancel.Location = new System.Drawing.Point(123, 293);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.TabIndex = 8;
|
||||
this.Cancel.Text = "Close";
|
||||
this.Cancel.TabIndex = 9;
|
||||
this.Cancel.Text = "&Close";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
|
||||
//
|
||||
|
@ -257,13 +261,33 @@
|
|||
this.ValueHexLabel.TabIndex = 11;
|
||||
this.ValueHexLabel.Text = "0x";
|
||||
//
|
||||
// DomainComboBox
|
||||
//
|
||||
this.DomainComboBox.FormattingEnabled = true;
|
||||
this.DomainComboBox.Location = new System.Drawing.Point(12, 261);
|
||||
this.DomainComboBox.Name = "DomainComboBox";
|
||||
this.DomainComboBox.Size = new System.Drawing.Size(141, 21);
|
||||
this.DomainComboBox.TabIndex = 7;
|
||||
this.DomainComboBox.SelectedIndexChanged += new System.EventHandler(this.DomainComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(11, 245);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(83, 13);
|
||||
this.label6.TabIndex = 13;
|
||||
this.label6.Text = "Memory Domain";
|
||||
//
|
||||
// RamPoke
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(213, 292);
|
||||
this.ClientSize = new System.Drawing.Size(213, 332);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.DomainComboBox);
|
||||
this.Controls.Add(this.ValueHexLabel);
|
||||
this.Controls.Add(this.ValueBox);
|
||||
this.Controls.Add(this.ValeLabel);
|
||||
|
@ -314,5 +338,7 @@
|
|||
private System.Windows.Forms.Label ValeLabel;
|
||||
private System.Windows.Forms.TextBox ValueBox;
|
||||
private System.Windows.Forms.Label ValueHexLabel;
|
||||
private System.Windows.Forms.ComboBox DomainComboBox;
|
||||
private System.Windows.Forms.Label label6;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
//TODO:
|
||||
//If signed/unsigned/hex radios selected, auto-change the value box
|
||||
//Memory domain selection
|
||||
public Watch watch = new Watch();
|
||||
public MemoryDomain domain = Global.Emulator.MainMemory;
|
||||
public Point location = new Point();
|
||||
|
@ -32,6 +31,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void RamPoke_Load(object sender, EventArgs e)
|
||||
{
|
||||
PopulateMemoryDomainComboBox();
|
||||
SetTypeRadio(watch.type);
|
||||
SetSignedRadio(watch.signed);
|
||||
if (watch.signed == asigned.HEX)
|
||||
|
@ -43,14 +43,9 @@ namespace BizHawk.MultiClient
|
|||
BigEndianRadio.Checked = true;
|
||||
else
|
||||
LittleEndianRadio.Checked = true;
|
||||
AddressBox.Text = String.Format("{0:X" +
|
||||
GetNumDigits(watch.address) + "}", watch.address);
|
||||
|
||||
if (HexRadio.Checked)
|
||||
ValueBox.Text = String.Format("{0:X" +
|
||||
GetValueNumDigits() + "}", watch.value);
|
||||
else
|
||||
ValueBox.Text = watch.value.ToString();
|
||||
SetValueBox();
|
||||
SetAddressBox();
|
||||
|
||||
AddressBox.MaxLength = GetNumDigits(domain.Size);
|
||||
ValueBox.MaxLength = GetValueNumDigits();
|
||||
|
@ -58,6 +53,27 @@ namespace BizHawk.MultiClient
|
|||
if (location.X > 0 && location.Y > 0)
|
||||
this.Location = location;
|
||||
|
||||
UpdateTitleText();
|
||||
SetDomainSelection();
|
||||
}
|
||||
|
||||
private void SetValueBox()
|
||||
{
|
||||
if (HexRadio.Checked)
|
||||
ValueBox.Text = String.Format("{0:X" +
|
||||
GetValueNumDigits() + "}", watch.value);
|
||||
else
|
||||
ValueBox.Text = watch.value.ToString();
|
||||
}
|
||||
|
||||
private void SetAddressBox()
|
||||
{
|
||||
AddressBox.Text = String.Format("{0:X" +
|
||||
GetNumDigits(watch.address) + "}", watch.address);
|
||||
}
|
||||
|
||||
private void UpdateTitleText()
|
||||
{
|
||||
Text = "Ram Poke - " + domain.ToString();
|
||||
}
|
||||
|
||||
|
@ -299,15 +315,53 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int GetNumDigits(Int32 i)
|
||||
{
|
||||
//if (i == 0) return 0;
|
||||
//if (i < 0x10) return 1;
|
||||
//if (i < 0x100) return 2;
|
||||
//if (i < 0x1000) return 3; //adelikat: commenting these out because I decided that regardless of domain, 4 digits should be the minimum
|
||||
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 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 void DomainComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
|
||||
UpdateTitleText();
|
||||
int x = GetNumDigits(domain.Size);
|
||||
watch.address = 0;
|
||||
watch.value = 0;
|
||||
SetAddressBox();
|
||||
SetValueBox();
|
||||
AddressBox.MaxLength = GetNumDigits(domain.Size);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue