Lots of progress on Ram Poke
This commit is contained in:
parent
b8ed9b01cb
commit
686279e7b2
|
@ -57,13 +57,13 @@
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(9, 33);
|
this.label1.Location = new System.Drawing.Point(9, 33);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(48, 13);
|
this.label1.Size = new System.Drawing.Size(62, 13);
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Address:";
|
this.label1.Text = "Address: 0x";
|
||||||
//
|
//
|
||||||
// AddressBox
|
// AddressBox
|
||||||
//
|
//
|
||||||
this.AddressBox.Location = new System.Drawing.Point(60, 30);
|
this.AddressBox.Location = new System.Drawing.Point(68, 30);
|
||||||
this.AddressBox.Name = "AddressBox";
|
this.AddressBox.Name = "AddressBox";
|
||||||
this.AddressBox.Size = new System.Drawing.Size(100, 20);
|
this.AddressBox.Size = new System.Drawing.Size(100, 20);
|
||||||
this.AddressBox.TabIndex = 2;
|
this.AddressBox.TabIndex = 2;
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
//
|
//
|
||||||
// ValueBox
|
// ValueBox
|
||||||
//
|
//
|
||||||
this.ValueBox.Location = new System.Drawing.Point(60, 57);
|
this.ValueBox.Location = new System.Drawing.Point(68, 57);
|
||||||
this.ValueBox.Name = "ValueBox";
|
this.ValueBox.Name = "ValueBox";
|
||||||
this.ValueBox.Size = new System.Drawing.Size(100, 20);
|
this.ValueBox.Size = new System.Drawing.Size(100, 20);
|
||||||
this.ValueBox.TabIndex = 11;
|
this.ValueBox.TabIndex = 11;
|
||||||
|
|
|
@ -15,7 +15,6 @@ namespace BizHawk.MultiClient
|
||||||
//TODO:
|
//TODO:
|
||||||
//If signed/unsigned/hex radios selected, auto-change the value box
|
//If signed/unsigned/hex radios selected, auto-change the value box
|
||||||
//Checked signed/u/h value on RamPoke_Load and set value appopriately
|
//Checked signed/u/h value on RamPoke_Load and set value appopriately
|
||||||
//Validate address (hex) and value (based on s/u/h setting)
|
|
||||||
public Watch watch = new Watch();
|
public Watch watch = new Watch();
|
||||||
public Point location = new Point();
|
public Point location = new Point();
|
||||||
|
|
||||||
|
@ -38,7 +37,11 @@ namespace BizHawk.MultiClient
|
||||||
else
|
else
|
||||||
LittleEndianRadio.Checked = true;
|
LittleEndianRadio.Checked = true;
|
||||||
AddressBox.Text = String.Format("{0:X}", watch.address);
|
AddressBox.Text = String.Format("{0:X}", watch.address);
|
||||||
|
|
||||||
|
|
||||||
ValueBox.Text = watch.value.ToString();
|
ValueBox.Text = watch.value.ToString();
|
||||||
|
|
||||||
|
|
||||||
if (location.X > 0 && location.Y > 0)
|
if (location.X > 0 && location.Y > 0)
|
||||||
this.Location = location;
|
this.Location = location;
|
||||||
|
|
||||||
|
@ -80,25 +83,6 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RamPokeLoaddddddd(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (!customSetup)
|
|
||||||
{
|
|
||||||
Watch w = new Watch();
|
|
||||||
SetTypeRadio(w.type);
|
|
||||||
SetSignedRadio(w.signed);
|
|
||||||
|
|
||||||
if (w.bigendian == true)
|
|
||||||
BigEndianRadio.Checked = true;
|
|
||||||
else
|
|
||||||
LittleEndianRadio.Checked = true;
|
|
||||||
}
|
|
||||||
if (location.X > 0 && location.Y > 0)
|
|
||||||
this.Location = location;
|
|
||||||
* */
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Cancel_Click(object sender, EventArgs e)
|
private void Cancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
|
@ -108,12 +92,16 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
//Put user settings in the watch file
|
//Put user settings in the watch file
|
||||||
|
|
||||||
//TODO, check the user address so this can be used as a generic dialog:
|
if (InputValidate.IsValidHexNumber(AddressBox.Text)) //TODO: also validate it is within a valid memory address range!
|
||||||
//watch.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
watch.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||||
//TODO: validate input
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Invalid Address, must be a valid hex number", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
AddressBox.Focus();
|
||||||
|
AddressBox.SelectAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: check all the users choices here too
|
|
||||||
/*
|
|
||||||
if (SignedRadio.Checked)
|
if (SignedRadio.Checked)
|
||||||
watch.signed = asigned.SIGNED;
|
watch.signed = asigned.SIGNED;
|
||||||
else if (UnsignedRadio.Checked)
|
else if (UnsignedRadio.Checked)
|
||||||
|
@ -132,15 +120,71 @@ namespace BizHawk.MultiClient
|
||||||
watch.bigendian = true;
|
watch.bigendian = true;
|
||||||
else if (LittleEndianRadio.Checked)
|
else if (LittleEndianRadio.Checked)
|
||||||
watch.bigendian = false;
|
watch.bigendian = false;
|
||||||
*/
|
|
||||||
|
|
||||||
|
switch (watch.signed)
|
||||||
|
{
|
||||||
|
case asigned.UNSIGNED:
|
||||||
|
if (InputValidate.IsValidUnsignedNumber(ValueBox.Text))
|
||||||
|
{
|
||||||
watch.value = int.Parse(ValueBox.Text);
|
watch.value = int.Parse(ValueBox.Text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Invalid Address, must be a valid number number", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
ValueBox.Focus();
|
||||||
|
ValueBox.SelectAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case asigned.SIGNED:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
case asigned.HEX:
|
||||||
|
if (InputValidate.IsValidHexNumber(ValueBox.Text))
|
||||||
|
{
|
||||||
|
watch.value = int.Parse(ValueBox.Text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Invalid Address, must be a valid hex number", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
ValueBox.Focus();
|
||||||
|
ValueBox.SelectAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Try/Catch this? Seems destined for failures
|
//TODO: Try/Catch this? Seems destined for failures
|
||||||
|
|
||||||
|
switch (watch.type)
|
||||||
|
{
|
||||||
|
case atype.BYTE:
|
||||||
Global.Emulator.MainMemory.PokeByte(watch.address, (byte)watch.value);
|
Global.Emulator.MainMemory.PokeByte(watch.address, (byte)watch.value);
|
||||||
|
break;
|
||||||
|
case atype.WORD:
|
||||||
|
if (watch.bigendian)
|
||||||
|
{
|
||||||
|
Global.Emulator.MainMemory.PokeByte(watch.address, (byte)(watch.value / 256));
|
||||||
|
Global.Emulator.MainMemory.PokeByte(watch.address + 1, (byte)(watch.value % 256));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Global.Emulator.MainMemory.PokeByte(watch.address + 1, (byte)(watch.value / 256));
|
||||||
|
Global.Emulator.MainMemory.PokeByte(watch.address, (byte)(watch.value % 256));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case atype.DWORD:
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO: format value based on watch.type
|
//TODO: format value based on watch.type
|
||||||
OutputLabel.Text = watch.value.ToString() + " written to " + String.Format("{0:X}", watch.address);
|
OutputLabel.Text = watch.value.ToString() + " written to " + String.Format("{0:X}", watch.address);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -644,7 +644,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Invalid number!");
|
MessageBox.Show("Invalid number!"); //TODO: More parameters and better message
|
||||||
WatchListView.Items[index].Text = watchList[index].address.ToString(); //TODO: Why doesn't the list view update to the new value? It won't until something else changes
|
WatchListView.Items[index].Text = watchList[index].address.ToString(); //TODO: Why doesn't the list view update to the new value? It won't until something else changes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue