New Ram Watch - implement freeze address
This commit is contained in:
parent
aa314fc219
commit
0442eddf5a
|
@ -212,9 +212,7 @@ namespace BizHawk.MultiClient
|
|||
DisplayCheatsList();
|
||||
CheatListView.Refresh();
|
||||
|
||||
Global.MainForm.RamWatch1.UpdateValues();
|
||||
Global.MainForm.RamSearch1.UpdateValues();
|
||||
Global.MainForm.HexEditor1.UpdateValues();
|
||||
UpdateOtherTools();
|
||||
}
|
||||
|
||||
public void RemoveCheat(Cheat c)
|
||||
|
@ -227,7 +225,13 @@ namespace BizHawk.MultiClient
|
|||
if (!IsHandleCreated || IsDisposed) return;
|
||||
DisplayCheatsList();
|
||||
CheatListView.Refresh();
|
||||
UpdateOtherTools();
|
||||
}
|
||||
|
||||
private void UpdateOtherTools()
|
||||
{
|
||||
Global.MainForm.RamWatch1.UpdateValues();
|
||||
Global.MainForm.NewRamWatch1.UpdateValues();
|
||||
Global.MainForm.RamSearch1.UpdateValues();
|
||||
Global.MainForm.HexEditor1.UpdateValues();
|
||||
}
|
||||
|
|
|
@ -35,5 +35,81 @@ namespace BizHawk.MultiClient
|
|||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
||||
public static void FreezeAddress(List<Watch> watches)
|
||||
{
|
||||
foreach(var watch in watches)
|
||||
{
|
||||
switch (watch.Size)
|
||||
{
|
||||
case Watch.WatchSize.Byte:
|
||||
Cheat c = new Cheat("", watch.Address.Value, (byte)watch.Value.Value,
|
||||
true, watch.Domain);
|
||||
Global.MainForm.Cheats1.AddCheat(c);
|
||||
break;
|
||||
case Watch.WatchSize.Word:
|
||||
{
|
||||
byte low = (byte)(watch.Value.Value / 256);
|
||||
byte high = (byte)(watch.Value.Value);
|
||||
int a1 = watch.Address.Value;
|
||||
int a2 = watch.Address.Value + 1;
|
||||
if (watch.BigEndian)
|
||||
{
|
||||
Cheat c1 = new Cheat("", a1, low, true, watch.Domain);
|
||||
Cheat c2 = new Cheat("", a2, high, true, watch.Domain);
|
||||
Global.MainForm.Cheats1.AddCheat(c1);
|
||||
Global.MainForm.Cheats1.AddCheat(c2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cheat c1 = new Cheat("", a1, high, true, watch.Domain);
|
||||
Cheat c2 = new Cheat("", a2, low, true, watch.Domain);
|
||||
Global.MainForm.Cheats1.AddCheat(c1);
|
||||
Global.MainForm.Cheats1.AddCheat(c2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Watch.WatchSize.DWord:
|
||||
{
|
||||
byte HIWORDhigh = (byte)(watch.Value.Value >> 24);
|
||||
byte HIWORDlow = (byte)(watch.Value.Value >> 16);
|
||||
byte LOWORDhigh = (byte)(watch.Value.Value >> 8);
|
||||
byte LOWORDlow = (byte)(watch.Value.Value);
|
||||
int a1 = watch.Address.Value;
|
||||
int a2 = watch.Address.Value + 1;
|
||||
int a3 = watch.Address.Value + 2;
|
||||
int a4 = watch.Address.Value + 3;
|
||||
if (watch.BigEndian)
|
||||
{
|
||||
Cheat c1 = new Cheat("", a1, HIWORDhigh, true, watch.Domain);
|
||||
Cheat c2 = new Cheat("", a2, HIWORDlow, true, watch.Domain);
|
||||
Cheat c3 = new Cheat("", a3, LOWORDhigh, true, watch.Domain);
|
||||
Cheat c4 = new Cheat("", a4, LOWORDlow, true, watch.Domain);
|
||||
Global.MainForm.Cheats1.AddCheat(c1);
|
||||
Global.MainForm.Cheats1.AddCheat(c2);
|
||||
Global.MainForm.Cheats1.AddCheat(c3);
|
||||
Global.MainForm.Cheats1.AddCheat(c4);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cheat c1 = new Cheat("", a1, LOWORDlow, true, watch.Domain);
|
||||
Cheat c2 = new Cheat("", a2, LOWORDhigh, true, watch.Domain);
|
||||
Cheat c3 = new Cheat("", a3, HIWORDlow, true, watch.Domain);
|
||||
Cheat c4 = new Cheat("", a4, HIWORDhigh, true, watch.Domain);
|
||||
Global.MainForm.Cheats1.AddCheat(c1);
|
||||
Global.MainForm.Cheats1.AddCheat(c2);
|
||||
Global.MainForm.Cheats1.AddCheat(c3);
|
||||
Global.MainForm.Cheats1.AddCheat(c4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Global.MainForm.RamWatch1.UpdateValues();
|
||||
Global.MainForm.NewRamWatch1.UpdateValues();
|
||||
Global.MainForm.HexEditor1.UpdateValues();
|
||||
Global.MainForm.Cheats_UpdateValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,23 +246,23 @@
|
|||
// PoketoolStripButton2
|
||||
//
|
||||
this.PoketoolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.PoketoolStripButton2.Enabled = false;
|
||||
this.PoketoolStripButton2.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
|
||||
this.PoketoolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.PoketoolStripButton2.Name = "PoketoolStripButton2";
|
||||
this.PoketoolStripButton2.Size = new System.Drawing.Size(23, 22);
|
||||
this.PoketoolStripButton2.Text = "toolStripButton2";
|
||||
this.PoketoolStripButton2.ToolTipText = "Poke address";
|
||||
this.PoketoolStripButton2.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click);
|
||||
//
|
||||
// FreezetoolStripButton2
|
||||
//
|
||||
this.FreezetoolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.FreezetoolStripButton2.Enabled = false;
|
||||
this.FreezetoolStripButton2.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze;
|
||||
this.FreezetoolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.FreezetoolStripButton2.Name = "FreezetoolStripButton2";
|
||||
this.FreezetoolStripButton2.Size = new System.Drawing.Size(23, 22);
|
||||
this.FreezetoolStripButton2.Text = "Freeze Address";
|
||||
this.FreezetoolStripButton2.Click += new System.EventHandler(this.freezeAddressToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
|
@ -481,21 +481,21 @@
|
|||
//
|
||||
// pokeAddressToolStripMenuItem
|
||||
//
|
||||
this.pokeAddressToolStripMenuItem.Enabled = false;
|
||||
this.pokeAddressToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
|
||||
this.pokeAddressToolStripMenuItem.Name = "pokeAddressToolStripMenuItem";
|
||||
this.pokeAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
|
||||
this.pokeAddressToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
|
||||
this.pokeAddressToolStripMenuItem.Text = "Poke Address";
|
||||
this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click);
|
||||
//
|
||||
// freezeAddressToolStripMenuItem
|
||||
//
|
||||
this.freezeAddressToolStripMenuItem.Enabled = false;
|
||||
this.freezeAddressToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze;
|
||||
this.freezeAddressToolStripMenuItem.Name = "freezeAddressToolStripMenuItem";
|
||||
this.freezeAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
|
||||
this.freezeAddressToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
|
||||
this.freezeAddressToolStripMenuItem.Text = "Freeze Address";
|
||||
this.freezeAddressToolStripMenuItem.Click += new System.EventHandler(this.freezeAddressToolStripMenuItem_Click);
|
||||
//
|
||||
// insertSeparatorToolStripMenuItem
|
||||
//
|
||||
|
|
|
@ -448,6 +448,46 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void PokeAddress()
|
||||
{
|
||||
return; //TODO
|
||||
//TODO: WatchEditor can do the poking too
|
||||
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
Global.Sound.StopSound();
|
||||
RamPoke poke = new RamPoke()
|
||||
{
|
||||
NewLocation = GetPromptPoint()
|
||||
};
|
||||
poke.ShowDialog();
|
||||
//poke.SetWatchObject(null); //TODO
|
||||
UpdateValues();
|
||||
Global.Sound.StartSound();
|
||||
}
|
||||
}
|
||||
|
||||
private List<Watch> SelectedWatches
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Watch> selected = new List<Watch>();
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
foreach (int index in indexes)
|
||||
{
|
||||
if (!Watches[index].IsSeparator)
|
||||
{
|
||||
selected.Add(Watches[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
|
||||
#region Winform Events
|
||||
|
||||
private void NewRamWatch_Load(object sender, EventArgs e)
|
||||
|
@ -602,6 +642,16 @@ namespace BizHawk.MultiClient
|
|||
EditWatch(duplicate:true);
|
||||
}
|
||||
|
||||
private void pokeAddressToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PokeAddress();
|
||||
}
|
||||
|
||||
private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolHelpers.FreezeAddress(SelectedWatches);
|
||||
}
|
||||
|
||||
private void insertSeparatorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
InsertSeparator();
|
||||
|
|
Loading…
Reference in New Issue