Remove Ram Poke as a standalone dialog. Support new Ram Poke dialog in Hex Editor and Ram Search

This commit is contained in:
adelikat 2013-09-14 03:13:22 +00:00
parent 5c2b005eee
commit 2910878d05
19 changed files with 359 additions and 7526 deletions

View File

@ -657,11 +657,11 @@
<Compile Include="tools\VirtualPads\VirtualPadSNESControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="tools\Watch\NewRamPoke.cs">
<Compile Include="tools\Watch\RamPoke.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\Watch\NewRamPoke.Designer.cs">
<DependentUpon>NewRamPoke.cs</DependentUpon>
<Compile Include="tools\Watch\RamPoke.Designer.cs">
<DependentUpon>RamPoke.cs</DependentUpon>
</Compile>
<Compile Include="tools\Watch\RamWatch.cs">
<SubType>Form</SubType>
@ -669,12 +669,6 @@
<Compile Include="tools\Watch\RamWatch.Designer.cs">
<DependentUpon>RamWatch.cs</DependentUpon>
</Compile>
<Compile Include="tools\Watch\RamPoke.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\Watch\RamPoke.Designer.cs">
<DependentUpon>RamPoke.cs</DependentUpon>
</Compile>
<Compile Include="tools\Watch\RamSearch.cs">
<SubType>Form</SubType>
</Compile>
@ -874,15 +868,12 @@
<EmbeddedResource Include="tools\VirtualPads\VirtualPadSaturnControl.resx">
<DependentUpon>VirtualPadSaturnControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Watch\NewRamPoke.resx">
<DependentUpon>NewRamPoke.cs</DependentUpon>
<EmbeddedResource Include="tools\Watch\RamPoke.resx">
<DependentUpon>RamPoke.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Watch\RamWatch.resx">
<DependentUpon>RamWatch.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Watch\RamPoke.resx">
<DependentUpon>RamPoke.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Watch\RamSearch.resx">
<DependentUpon>RamSearch.cs</DependentUpon>
</EmbeddedResource>

View File

@ -659,12 +659,6 @@
<Compile Include="tools\VirtualPads\VirtualPadSNESControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="tools\Watch\NewRamPoke.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\Watch\NewRamPoke.Designer.cs">
<DependentUpon>NewRamPoke.cs</DependentUpon>
</Compile>
<Compile Include="tools\Watch\RamPoke.cs">
<SubType>Form</SubType>
</Compile>
@ -677,7 +671,9 @@
<Compile Include="tools\Watch\RamSearch.Designer.cs">
<DependentUpon>RamSearch.cs</DependentUpon>
</Compile>
<Compile Include="tools\Watch\RamWatch.cs" />
<Compile Include="tools\Watch\RamWatch.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\Watch\RamWatch.Designer.cs">
<DependentUpon>RamWatch.cs</DependentUpon>
</Compile>
@ -872,9 +868,6 @@
<EmbeddedResource Include="tools\VirtualPads\VirtualPadSaturnControl.resx">
<DependentUpon>VirtualPadSaturnControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Watch\NewRamPoke.resx">
<DependentUpon>NewRamPoke.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Watch\RamPoke.resx">
<DependentUpon>RamPoke.cs</DependentUpon>
</EmbeddedResource>

View File

@ -182,7 +182,7 @@ namespace BizHawk.MultiClient
public bool RamWatchShowPrevColumn = false;
public bool RamWatchShowDiffColumn = false;
public bool RamWatchShowDomainColumn = true;
public int RamWatchAddressWidth = -1;
public int RamWatchValueWidth = -1;
public int RamWatchPrevWidth = -1;
@ -758,7 +758,6 @@ namespace BizHawk.MultiClient
//Tools
new Binding() { DisplayName = "Ram Watch", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 0 },
new Binding() { DisplayName = "Ram Search", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 1 },
new Binding() { DisplayName = "Ram Poke", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 2 },
new Binding() { DisplayName = "Hex Editor", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 3 },
new Binding() { DisplayName = "Trace Logger", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 4 },
new Binding() { DisplayName = "Lua Console", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 5 },
@ -870,7 +869,7 @@ namespace BizHawk.MultiClient
foreach (PathEntry path in missingDisplayPaths)
{
path.SystemDisplayName = DefaultValues.FirstOrDefault(x => x.System == path.System).SystemDisplayName;
}
}
@ -1045,11 +1044,11 @@ namespace BizHawk.MultiClient
public string System;
public int Ordinal;
public PathEntry() { }
public bool HasSystem(string systemID)
{
string[] ids = System.Split('_');
return ids.Contains(systemID);
}
public bool HasSystem(string systemID)
{
string[] ids = System.Split('_');
return ids.Contains(systemID);
}
}
public enum PLUGINTYPE { RICE, GLIDE, GLIDE64MK2 };

View File

@ -202,7 +202,6 @@
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.rAMWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rAMSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hexEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.traceLoggerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tAStudioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -1801,7 +1800,6 @@
this.toolStripSeparator12,
this.rAMWatchToolStripMenuItem,
this.rAMSearchToolStripMenuItem,
this.rAMPokeToolStripMenuItem,
this.hexEditorToolStripMenuItem,
this.traceLoggerToolStripMenuItem,
this.tAStudioToolStripMenuItem,
@ -1845,14 +1843,6 @@
this.rAMSearchToolStripMenuItem.Text = "RAM &Search";
this.rAMSearchToolStripMenuItem.Click += new System.EventHandler(this.rAMSearchToolStripMenuItem_Click);
//
// rAMPokeToolStripMenuItem
//
this.rAMPokeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
this.rAMPokeToolStripMenuItem.Name = "rAMPokeToolStripMenuItem";
this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
this.rAMPokeToolStripMenuItem.Text = "RAM &Poke";
this.rAMPokeToolStripMenuItem.Click += new System.EventHandler(this.RAMPokeToolStripMenuItem_Click);
//
// hexEditorToolStripMenuItem
//
this.hexEditorToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
@ -3108,7 +3098,6 @@
private System.Windows.Forms.ToolStripMenuItem gUIToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pauseWhenMenuActivatedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem soundToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem rAMPokeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem startPausedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem frameSkipToolStripMenuItem;

View File

@ -35,11 +35,6 @@ namespace BizHawk.MultiClient
Global.Sound.StartSound();
}
private void RAMPokeToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadRamPoke();
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SaveWindowPosition ^= true;
@ -634,7 +629,6 @@ namespace BizHawk.MultiClient
toolBoxToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["ToolBox"].Bindings;
rAMWatchToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Ram Watch"].Bindings;
rAMSearchToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Ram Search"].Bindings;
rAMPokeToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Ram Poke"].Bindings;
hexEditorToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hex Editor"].Bindings;
luaConsoleToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lua Console"].Bindings;
cheatsToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Cheats"].Bindings;

View File

@ -2064,7 +2064,6 @@ namespace BizHawk.MultiClient
case "Ram Watch": LoadRamWatch(true); break;
case "Ram Search": LoadRamSearch(); break;
case "Ram Poke": new RamPoke().Show(); break;
case "Hex Editor": LoadHexEditor(); break;
case "Trace Logger": LoadTraceLogger(); break;
case "Lua Console": OpenLuaConsole(); break;
@ -3823,12 +3822,6 @@ namespace BizHawk.MultiClient
#endif
}
public void LoadRamPoke()
{
RamPoke r = new RamPoke();
r.Show();
}
void ProcessMovieImport(string fn)
{
string d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null);

View File

@ -714,6 +714,7 @@ namespace BizHawk.MultiClient
private void PokeAddress()
{
//TODO: get rid of legacy watch, and support multiple address poking
int p = GetHighlightedAddress();
if (p < 0) return;
Watch_Legacy w = new Watch_Legacy
@ -738,10 +739,11 @@ namespace BizHawk.MultiClient
w.Type = Watch_Legacy.TYPE.DWORD;
break;
}
RamPoke poke = new RamPoke();
poke.SetWatchObject(w);
poke.NewLocation = GetAddressCoordinates(p);
var poke = new RamPoke();
Watch watch = Watch.ConvertLegacyWatch(w);
poke.SetWatch(new List<Watch> { watch });
poke.InitialLocation = GetAddressCoordinates(p);
Global.Sound.StopSound();
poke.ShowDialog();
Global.Sound.StartSound();

View File

@ -536,7 +536,6 @@ namespace BizHawk.MultiClient
"opentoolbox",
"openramwatch",
"openramsearch",
"openrampoke",
"openhexeditor",
"opentasstudio",
"opencheats",
@ -2424,11 +2423,6 @@ namespace BizHawk.MultiClient
Global.MainForm.LoadRamSearch();
}
public void client_openrampoke()
{
Global.MainForm.LoadRamPoke();
}
public void client_openhexeditor()
{
Global.MainForm.LoadHexEditor();

View File

@ -33,7 +33,6 @@
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
this.HexEditor = new System.Windows.Forms.ToolStripButton();
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton6 = new System.Windows.Forms.ToolStripButton();
@ -43,23 +42,23 @@
this.NESNameTable = new System.Windows.Forms.ToolStripButton();
this.NESGameGenie = new System.Windows.Forms.ToolStripButton();
this.KeypadTool = new System.Windows.Forms.ToolStripButton();
this.GameboyDebuggerTool = new System.Windows.Forms.ToolStripButton();
this.SNESGraphicsDebuggerButton = new System.Windows.Forms.ToolStripButton();
this.SNESGameGenie = new System.Windows.Forms.ToolStripButton();
this.GGGameGenie = new System.Windows.Forms.ToolStripButton();
this.GBGameGenie = new System.Windows.Forms.ToolStripButton();
this.GameboyDebuggerTool = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.BackColor = System.Drawing.SystemColors.Control;
this.toolStrip1.ClickThrough = true;
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1,
this.toolStripButton2,
this.toolStripButton3,
this.toolStripButton4,
this.HexEditor,
this.toolStripButton5,
this.toolStripButton6,
@ -75,9 +74,9 @@
this.GBGameGenie,
this.GameboyDebuggerTool});
this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Table;
this.toolStrip1.Location = new System.Drawing.Point(12, 14);
this.toolStrip1.Location = new System.Drawing.Point(9, 11);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(123, 485);
this.toolStrip1.Size = new System.Drawing.Size(100, 394);
this.toolStrip1.TabIndex = 0;
this.toolStrip1.TabStop = true;
//
@ -86,7 +85,7 @@
this.toolStripButton1.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze;
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(73, 24);
this.toolStripButton1.Size = new System.Drawing.Size(63, 20);
this.toolStripButton1.Text = "Cheats";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
@ -95,7 +94,7 @@
this.toolStripButton2.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS;
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton2.Name = "toolStripButton2";
this.toolStripButton2.Size = new System.Drawing.Size(105, 24);
this.toolStripButton2.Size = new System.Drawing.Size(88, 20);
this.toolStripButton2.Text = "Ram Watch";
this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click);
//
@ -104,25 +103,16 @@
this.toolStripButton3.Image = global::BizHawk.MultiClient.Properties.Resources.search;
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton3.Name = "toolStripButton3";
this.toolStripButton3.Size = new System.Drawing.Size(107, 24);
this.toolStripButton3.Size = new System.Drawing.Size(89, 20);
this.toolStripButton3.Text = "Ram Search";
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click);
//
// toolStripButton4
//
this.toolStripButton4.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton4.Name = "toolStripButton4";
this.toolStripButton4.Size = new System.Drawing.Size(95, 24);
this.toolStripButton4.Text = "Ram Poke";
this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click);
//
// HexEditor
//
this.HexEditor.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
this.HexEditor.ImageTransparentColor = System.Drawing.Color.Magenta;
this.HexEditor.Name = "HexEditor";
this.HexEditor.Size = new System.Drawing.Size(99, 24);
this.HexEditor.Size = new System.Drawing.Size(81, 20);
this.HexEditor.Text = "Hex Editor";
this.HexEditor.Click += new System.EventHandler(this.HexEditor_Click);
//
@ -131,7 +121,7 @@
this.toolStripButton5.Image = global::BizHawk.MultiClient.Properties.Resources.textdoc;
this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton5.Name = "toolStripButton5";
this.toolStripButton5.Size = new System.Drawing.Size(109, 24);
this.toolStripButton5.Size = new System.Drawing.Size(92, 20);
this.toolStripButton5.Text = "Lua Console";
this.toolStripButton5.Click += new System.EventHandler(this.toolStripButton5_Click);
//
@ -140,7 +130,7 @@
this.toolStripButton6.Image = global::BizHawk.MultiClient.Properties.Resources.TAStudio;
this.toolStripButton6.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton6.Name = "toolStripButton6";
this.toolStripButton6.Size = new System.Drawing.Size(90, 24);
this.toolStripButton6.Size = new System.Drawing.Size(76, 20);
this.toolStripButton6.Text = "TAStudio";
this.toolStripButton6.Click += new System.EventHandler(this.TAStudioButton_Click);
//
@ -149,7 +139,7 @@
this.TAStudioButton.Image = global::BizHawk.MultiClient.Properties.Resources.GameController;
this.TAStudioButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.TAStudioButton.Name = "TAStudioButton";
this.TAStudioButton.Size = new System.Drawing.Size(103, 24);
this.TAStudioButton.Size = new System.Drawing.Size(86, 20);
this.TAStudioButton.Text = "VirtualPads";
this.TAStudioButton.Click += new System.EventHandler(this.TAStudioButton_Click_1);
//
@ -158,7 +148,7 @@
this.NESDebugger.Image = global::BizHawk.MultiClient.Properties.Resources.NESControllerIcon;
this.NESDebugger.ImageTransparentColor = System.Drawing.Color.Magenta;
this.NESDebugger.Name = "NESDebugger";
this.NESDebugger.Size = new System.Drawing.Size(96, 24);
this.NESDebugger.Size = new System.Drawing.Size(79, 20);
this.NESDebugger.Text = "Debugger";
this.NESDebugger.Click += new System.EventHandler(this.NESDebugger_Click);
//
@ -167,7 +157,7 @@
this.NESPPU.Image = global::BizHawk.MultiClient.Properties.Resources.NESControllerIcon;
this.NESPPU.ImageTransparentColor = System.Drawing.Color.Magenta;
this.NESPPU.Name = "NESPPU";
this.NESPPU.Size = new System.Drawing.Size(55, 24);
this.NESPPU.Size = new System.Drawing.Size(49, 20);
this.NESPPU.Text = "PPU";
this.NESPPU.Click += new System.EventHandler(this.NESPPU_Click);
//
@ -176,7 +166,7 @@
this.NESNameTable.Image = global::BizHawk.MultiClient.Properties.Resources.NESControllerIcon;
this.NESNameTable.ImageTransparentColor = System.Drawing.Color.Magenta;
this.NESNameTable.Name = "NESNameTable";
this.NESNameTable.Size = new System.Drawing.Size(103, 24);
this.NESNameTable.Size = new System.Drawing.Size(85, 20);
this.NESNameTable.Text = "Nametable";
this.NESNameTable.Click += new System.EventHandler(this.NESNameTable_Click);
//
@ -185,7 +175,7 @@
this.NESGameGenie.Image = global::BizHawk.MultiClient.Properties.Resources.NESControllerIcon;
this.NESGameGenie.ImageTransparentColor = System.Drawing.Color.Magenta;
this.NESGameGenie.Name = "NESGameGenie";
this.NESGameGenie.Size = new System.Drawing.Size(110, 24);
this.NESGameGenie.Size = new System.Drawing.Size(91, 20);
this.NESGameGenie.Text = "Game Genie";
this.NESGameGenie.Click += new System.EventHandler(this.NESGameGenie_Click);
//
@ -194,21 +184,16 @@
this.KeypadTool.Image = global::BizHawk.MultiClient.Properties.Resources.calculator;
this.KeypadTool.ImageTransparentColor = System.Drawing.Color.Magenta;
this.KeypadTool.Name = "KeypadTool";
this.KeypadTool.Size = new System.Drawing.Size(79, 24);
this.KeypadTool.Size = new System.Drawing.Size(66, 20);
this.KeypadTool.Text = "Keypad";
this.KeypadTool.Click += new System.EventHandler(this.KeyPadTool_Click);
//
// GameboyDebuggerTool
//
this.GameboyDebuggerTool.Name = "GameboyDebuggerTool";
this.GameboyDebuggerTool.Size = new System.Drawing.Size(23, 4);
//
// SNESGraphicsDebuggerButton
//
this.SNESGraphicsDebuggerButton.Image = global::BizHawk.MultiClient.Properties.Resources.SNESControllerIcon;
this.SNESGraphicsDebuggerButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.SNESGraphicsDebuggerButton.Name = "SNESGraphicsDebuggerButton";
this.SNESGraphicsDebuggerButton.Size = new System.Drawing.Size(122, 24);
this.SNESGraphicsDebuggerButton.Size = new System.Drawing.Size(99, 20);
this.SNESGraphicsDebuggerButton.Text = "Gfx Debugger";
this.SNESGraphicsDebuggerButton.Click += new System.EventHandler(this.SNESGraphicsDebuggerButton_Click);
//
@ -217,7 +202,7 @@
this.SNESGameGenie.Image = global::BizHawk.MultiClient.Properties.Resources.SNESControllerIcon;
this.SNESGameGenie.ImageTransparentColor = System.Drawing.Color.Magenta;
this.SNESGameGenie.Name = "SNESGameGenie";
this.SNESGameGenie.Size = new System.Drawing.Size(110, 24);
this.SNESGameGenie.Size = new System.Drawing.Size(91, 20);
this.SNESGameGenie.Text = "Game Genie";
this.SNESGameGenie.Click += new System.EventHandler(this.SNESGameGenie_Click);
//
@ -226,7 +211,7 @@
this.GGGameGenie.Image = ((System.Drawing.Image)(resources.GetObject("GGGameGenie.Image")));
this.GGGameGenie.ImageTransparentColor = System.Drawing.Color.Magenta;
this.GGGameGenie.Name = "GGGameGenie";
this.GGGameGenie.Size = new System.Drawing.Size(110, 24);
this.GGGameGenie.Size = new System.Drawing.Size(91, 20);
this.GGGameGenie.Text = "Game Genie";
this.GGGameGenie.Click += new System.EventHandler(this.GGGameGenie_Click);
//
@ -235,19 +220,23 @@
this.GBGameGenie.Image = ((System.Drawing.Image)(resources.GetObject("GBGameGenie.Image")));
this.GBGameGenie.ImageTransparentColor = System.Drawing.Color.Magenta;
this.GBGameGenie.Name = "GBGameGenie";
this.GBGameGenie.Size = new System.Drawing.Size(110, 24);
this.GBGameGenie.Size = new System.Drawing.Size(91, 20);
this.GBGameGenie.Text = "Game Genie";
this.GBGameGenie.Click += new System.EventHandler(this.GBGameGenie_Click);
//
// GameboyDebuggerTool
//
this.GameboyDebuggerTool.Name = "GameboyDebuggerTool";
this.GameboyDebuggerTool.Size = new System.Drawing.Size(23, 4);
//
// ToolBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(213, 553);
this.ClientSize = new System.Drawing.Size(160, 449);
this.Controls.Add(this.toolStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.MinimumSize = new System.Drawing.Size(167, 68);
this.MinimumSize = new System.Drawing.Size(129, 62);
this.Name = "ToolBox";
this.Text = "Tool Box";
this.Load += new System.EventHandler(this.ToolBox_Load);
@ -264,7 +253,6 @@
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.ToolStripButton toolStripButton3;
private System.Windows.Forms.ToolStripButton toolStripButton4;
private System.Windows.Forms.ToolStripButton HexEditor;
private System.Windows.Forms.ToolStripButton toolStripButton5;
private System.Windows.Forms.ToolStripButton NESPPU;

View File

@ -99,12 +99,6 @@ namespace BizHawk.MultiClient
Global.MainForm.LoadRamSearch();
}
private void toolStripButton4_Click(object sender, EventArgs e)
{
RamPoke r = new RamPoke();
r.Show();
}
private void HexEditor_Click(object sender, EventArgs e)
{
Global.MainForm.LoadHexEditor();

View File

@ -124,7 +124,7 @@
<data name="GGGameGenie.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJTSURBVFhH7VQ9a1RBFB1YMIXY6uIPSAo7LbJpAhEhYKNg
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJTSURBVFhH7VQ9a1RBFB1YMIXY6uIPSAo7LbJpAhEhYKNg
OiHb5AsJCNbaiGgVCwnYpJAUKrHafokJhGhIJBKChDRaWaSKGwyBQK73zNszue+9eRujbPcuHO7MnXvP
ObPzWFdGGWVEQrqMwvANy6sbXQV1IGgjNEw8fJzC5erV/wJ57t0f98gYCREVr1arol3i9vqkty5RgbNw
ozaYMkBAM5FOovD2o5OPPEj2LzjLQFQcwDBv8l0kikYrAX4lN9MjrnnFr2EavMjggujIM4ma6GgA0K6o
@ -140,7 +140,7 @@
<data name="GBGameGenie.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEQSURBVFhH7ZXRDYMwDEQzC7OwArMwS2dhBXZKdQ4XOZAQ
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVFhH7ZXRDYMwDEQzC7OwArMwS2dhBXZKdQ4XOZAQ
UMDpR096KgTse1/U/Xr8BsJfs/hpmgRcz/NMGRMRvyxLFCCQsBKRIkj0EoklvURk8TAMsQSciWAmjD6T
KECuiGBuozlRwK0f4YqIvP+GwMevVRGeYzasaMtBgJREzARyIl0EyF/ARADJlYPXBQhjKrCXAIyZQE0E
1yYChEUafY7ZsKItSSG+87zX50TfY3b7Y2pKsjQnQEoCJKy7n6SgJgFKAiSsvZ5kMRboMg2fnwmElfeS

View File

@ -1,257 +0,0 @@
namespace BizHawk.MultiClient
{
partial class NewRamPoke
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewRamPoke));
this.label1 = new System.Windows.Forms.Label();
this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.OutputLabel = new System.Windows.Forms.Label();
this.ValeLabel = new System.Windows.Forms.Label();
this.ValueBox = new System.Windows.Forms.TextBox();
this.ValueHexLabel = new System.Windows.Forms.Label();
this.DisplayTypeLabel = new System.Windows.Forms.Label();
this.SizeLabel = new System.Windows.Forms.Label();
this.BigEndianLabel = new System.Windows.Forms.Label();
this.AddressBox = new BizHawk.HexTextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.DomainLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(20, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Address: 0x";
//
// OK
//
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, 169);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(65, 23);
this.OK.TabIndex = 35;
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(136, 169);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(65, 23);
this.Cancel.TabIndex = 40;
this.Cancel.Text = "&Close";
this.Cancel.UseVisualStyleBackColor = true;
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
//
// OutputLabel
//
this.OutputLabel.AutoSize = true;
this.OutputLabel.Location = new System.Drawing.Point(12, 7);
this.OutputLabel.Name = "OutputLabel";
this.OutputLabel.Size = new System.Drawing.Size(129, 13);
this.OutputLabel.TabIndex = 9;
this.OutputLabel.Text = "Enter an address to poke:";
//
// ValeLabel
//
this.ValeLabel.AutoSize = true;
this.ValeLabel.Location = new System.Drawing.Point(31, 59);
this.ValeLabel.Name = "ValeLabel";
this.ValeLabel.Size = new System.Drawing.Size(37, 13);
this.ValeLabel.TabIndex = 10;
this.ValeLabel.Text = "Value:";
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(82, 57);
this.ValueBox.MaxLength = 9;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Size = new System.Drawing.Size(116, 20);
this.ValueBox.TabIndex = 10;
this.ValueBox.Text = "0000";
this.ValueBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValueBox_KeyPress);
//
// ValueHexLabel
//
this.ValueHexLabel.AutoSize = true;
this.ValueHexLabel.Location = new System.Drawing.Point(64, 60);
this.ValueHexLabel.Name = "ValueHexLabel";
this.ValueHexLabel.Size = new System.Drawing.Size(18, 13);
this.ValueHexLabel.TabIndex = 11;
this.ValueHexLabel.Text = "0x";
//
// DisplayTypeLabel
//
this.DisplayTypeLabel.AutoSize = true;
this.DisplayTypeLabel.Location = new System.Drawing.Point(81, 118);
this.DisplayTypeLabel.Name = "DisplayTypeLabel";
this.DisplayTypeLabel.Size = new System.Drawing.Size(52, 13);
this.DisplayTypeLabel.TabIndex = 24;
this.DisplayTypeLabel.Text = "Unsigned";
//
// SizeLabel
//
this.SizeLabel.AutoSize = true;
this.SizeLabel.Location = new System.Drawing.Point(82, 101);
this.SizeLabel.Name = "SizeLabel";
this.SizeLabel.Size = new System.Drawing.Size(28, 13);
this.SizeLabel.TabIndex = 23;
this.SizeLabel.Text = "Byte";
//
// BigEndianLabel
//
this.BigEndianLabel.AutoSize = true;
this.BigEndianLabel.Location = new System.Drawing.Point(82, 135);
this.BigEndianLabel.Name = "BigEndianLabel";
this.BigEndianLabel.Size = new System.Drawing.Size(58, 13);
this.BigEndianLabel.TabIndex = 41;
this.BigEndianLabel.Text = "Big Endian";
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Enabled = false;
this.AddressBox.Location = new System.Drawing.Point(82, 30);
this.AddressBox.MaxLength = 8;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Size = new System.Drawing.Size(116, 20);
this.AddressBox.TabIndex = 5;
this.AddressBox.Text = "0000";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(39, 135);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 13);
this.label2.TabIndex = 44;
this.label2.Text = "Endian:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(11, 118);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(71, 13);
this.label3.TabIndex = 43;
this.label3.Text = "Display Type:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(52, 101);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(30, 13);
this.label4.TabIndex = 42;
this.label4.Text = "Size:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(36, 84);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(46, 13);
this.label5.TabIndex = 46;
this.label5.Text = "Domain:";
//
// DomainLabel
//
this.DomainLabel.AutoSize = true;
this.DomainLabel.Location = new System.Drawing.Point(82, 84);
this.DomainLabel.Name = "DomainLabel";
this.DomainLabel.Size = new System.Drawing.Size(70, 13);
this.DomainLabel.TabIndex = 45;
this.DomainLabel.Text = "Main Memory";
//
// NewRamPoke
//
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, 208);
this.Controls.Add(this.label5);
this.Controls.Add(this.DomainLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label4);
this.Controls.Add(this.BigEndianLabel);
this.Controls.Add(this.DisplayTypeLabel);
this.Controls.Add(this.SizeLabel);
this.Controls.Add(this.ValueHexLabel);
this.Controls.Add(this.ValueBox);
this.Controls.Add(this.ValeLabel);
this.Controls.Add(this.OutputLabel);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.OK);
this.Controls.Add(this.AddressBox);
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 = "NewRamPoke";
this.Text = "Ram Poke";
this.Load += new System.EventHandler(this.RamPoke_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private HexTextBox AddressBox;
private System.Windows.Forms.Button OK;
private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.Label OutputLabel;
private System.Windows.Forms.Label ValeLabel;
private System.Windows.Forms.TextBox ValueBox;
private System.Windows.Forms.Label ValueHexLabel;
private System.Windows.Forms.Label DisplayTypeLabel;
private System.Windows.Forms.Label SizeLabel;
private System.Windows.Forms.Label BigEndianLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label DomainLabel;
}
}

View File

@ -1,244 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace BizHawk.MultiClient
{
public partial class NewRamPoke : Form
{
//TODO: don't use textboxes as labels
private List<Watch> _watchList = new List<Watch>();
public Point InitialLocation = new Point(0, 0);
public NewRamPoke()
{
InitializeComponent();
}
public void SetWatch(List<Watch> watches)
{
_watchList = watches;
}
private void UnSupportedConfiguration()
{
MessageBox.Show("Ram Poke does not support mixed types", "Unsupported Options", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close();
}
private void RamPoke_Load(object sender, EventArgs e)
{
_watchList = _watchList.Where(x => !x.IsSeparator).ToList(); //Weed out separators just in case
if (_watchList.Count == 0)
{
ValueBox.Enabled = false;
return;
}
if (InitialLocation.X > 0 || InitialLocation.Y > 0)
{
Location = InitialLocation;
}
if (_watchList.Count > 1)
{
bool hasMixedSizes = _watchList.Select(x => x.Size).Distinct().Count() > 1;
bool hasMixedTypes = _watchList.Select(x => x.Type).Distinct().Count() > 1;
bool hasMixedEndian = _watchList.Select(x => x.BigEndian).Distinct().Count() > 1;
if (hasMixedSizes || hasMixedTypes || hasMixedEndian)
{
UnSupportedConfiguration();
}
}
AddressBox.Text = _watchList.Select(a => a.AddressString).Distinct().Aggregate((addrStr, nextStr) => addrStr + ("," + nextStr));
ValueHexLabel.Text = _watchList[0].Type == Watch.DisplayType.Hex ? "0x" : String.Empty;
ValueBox.Text = _watchList[0].ValueString.Replace(" ", "");
DomainLabel.Text = _watchList[0].Domain.Name;
SizeLabel.Text = _watchList[0].Size.ToString();
DisplayTypeLabel.Text = Watch.DisplayTypeToString(_watchList[0].Type);
BigEndianLabel.Text = _watchList[0].BigEndian ? "Big Endian" : "Little Endian";
SetTitle();
SetValueBoxProperties();
}
private void SetValueBoxProperties()
{
switch(_watchList[0].Type)
{
default:
ValueBox.MaxLength = 8;
break;
case Watch.DisplayType.Binary:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 8;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 16;
break;
}
break;
case Watch.DisplayType.Hex:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 2;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 4;
break;
case Watch.WatchSize.DWord:
ValueBox.MaxLength = 8;
break;
}
break;
case Watch.DisplayType.Signed:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 4;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 6;
break;
case Watch.WatchSize.DWord:
ValueBox.MaxLength = 11;
break;
}
break;
case Watch.DisplayType.Unsigned:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 3;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 5;
break;
case Watch.WatchSize.DWord:
ValueBox.MaxLength = 10;
break;
}
break;
case Watch.DisplayType.Float:
case Watch.DisplayType.FixedPoint_12_4:
case Watch.DisplayType.FixedPoint_20_12:
ValueBox.MaxLength = 32;
break;
}
}
private void SetTitle()
{
Text = "Ram Poke - " + _watchList[0].Domain.Name;
}
#region Events
private void Cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void OK_Click(object sender, EventArgs e)
{
bool success = true;
foreach (var watch in _watchList)
{
if (!watch.Poke(ValueBox.Text))
{
success = false;
}
}
if (success)
{
OutputLabel.Text = "Value successfully written.";
}
else
{
OutputLabel.Text = "An error occured when writing Value.";
}
}
private void ValueBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
{
return;
}
if (e.KeyChar == '.')
{
if (ValueBox.Text.Contains('.'))
{
e.Handled = true;
}
}
else if (e.KeyChar == '-')
{
if (ValueBox.Text.Contains('-'))
{
e.Handled = true;
}
}
switch(_watchList[0].Type)
{
case Watch.DisplayType.Signed:
if (!InputValidate.IsValidSignedNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch.DisplayType.Unsigned:
if (!InputValidate.IsValidUnsignedNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch.DisplayType.Hex:
if (!InputValidate.IsValidHexNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch.DisplayType.Binary:
if (!InputValidate.IsValidBinaryNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch.DisplayType.FixedPoint_12_4:
case Watch.DisplayType.FixedPoint_20_12:
if (!InputValidate.IsValidFixedPointNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch.DisplayType.Float:
if (!InputValidate.IsValidDecimalNumber(e.KeyChar))
{
e.Handled = true;
}
break;
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -30,182 +30,39 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RamPoke));
this.label1 = new System.Windows.Forms.Label();
this.AddressBox = new HexTextBox();
this.DataTypeGroupBox = new System.Windows.Forms.GroupBox();
this.HexRadio = new System.Windows.Forms.RadioButton();
this.UnsignedRadio = new System.Windows.Forms.RadioButton();
this.SignedRadio = new System.Windows.Forms.RadioButton();
this.DataSizeBox = new System.Windows.Forms.GroupBox();
this.Byte4Radio = new System.Windows.Forms.RadioButton();
this.Byte2Radio = new System.Windows.Forms.RadioButton();
this.Byte1Radio = new System.Windows.Forms.RadioButton();
this.EndianBox = new System.Windows.Forms.GroupBox();
this.LittleEndianRadio = new System.Windows.Forms.RadioButton();
this.BigEndianRadio = new System.Windows.Forms.RadioButton();
this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.OutputLabel = new System.Windows.Forms.Label();
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();
this.DisplayTypeLabel = new System.Windows.Forms.Label();
this.SizeLabel = new System.Windows.Forms.Label();
this.BigEndianLabel = new System.Windows.Forms.Label();
this.AddressBox = new BizHawk.HexTextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.DomainLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 33);
this.label1.Location = new System.Drawing.Point(20, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Address: 0x";
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(73, 30);
this.AddressBox.MaxLength = 8;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Size = new System.Drawing.Size(80, 20);
this.AddressBox.TabIndex = 2;
this.AddressBox.Text = "0000";
this.AddressBox.Leave += new System.EventHandler(this.AddressBox_Leave);
//
// DataTypeGroupBox
//
this.DataTypeGroupBox.Controls.Add(this.HexRadio);
this.DataTypeGroupBox.Controls.Add(this.UnsignedRadio);
this.DataTypeGroupBox.Controls.Add(this.SignedRadio);
this.DataTypeGroupBox.Location = new System.Drawing.Point(12, 98);
this.DataTypeGroupBox.Name = "DataTypeGroupBox";
this.DataTypeGroupBox.Size = new System.Drawing.Size(95, 79);
this.DataTypeGroupBox.TabIndex = 4;
this.DataTypeGroupBox.TabStop = false;
this.DataTypeGroupBox.Text = "Data Type";
//
// HexRadio
//
this.HexRadio.AutoSize = true;
this.HexRadio.Location = new System.Drawing.Point(4, 51);
this.HexRadio.Name = "HexRadio";
this.HexRadio.Size = new System.Drawing.Size(86, 17);
this.HexRadio.TabIndex = 2;
this.HexRadio.Text = "Hexadecimal";
this.HexRadio.UseVisualStyleBackColor = true;
this.HexRadio.Click += new System.EventHandler(this.HexRadio_Click);
//
// UnsignedRadio
//
this.UnsignedRadio.AutoSize = true;
this.UnsignedRadio.Checked = true;
this.UnsignedRadio.Location = new System.Drawing.Point(4, 34);
this.UnsignedRadio.Name = "UnsignedRadio";
this.UnsignedRadio.Size = new System.Drawing.Size(70, 17);
this.UnsignedRadio.TabIndex = 1;
this.UnsignedRadio.TabStop = true;
this.UnsignedRadio.Text = "Unsigned";
this.UnsignedRadio.UseVisualStyleBackColor = true;
this.UnsignedRadio.Click += new System.EventHandler(this.UnsignedRadio_Click);
//
// SignedRadio
//
this.SignedRadio.AutoSize = true;
this.SignedRadio.Location = new System.Drawing.Point(4, 17);
this.SignedRadio.Name = "SignedRadio";
this.SignedRadio.Size = new System.Drawing.Size(58, 17);
this.SignedRadio.TabIndex = 0;
this.SignedRadio.Text = "Signed";
this.SignedRadio.UseVisualStyleBackColor = true;
this.SignedRadio.Click += new System.EventHandler(this.SignedRadio_Click);
//
// DataSizeBox
//
this.DataSizeBox.Controls.Add(this.Byte4Radio);
this.DataSizeBox.Controls.Add(this.Byte2Radio);
this.DataSizeBox.Controls.Add(this.Byte1Radio);
this.DataSizeBox.Location = new System.Drawing.Point(115, 98);
this.DataSizeBox.Name = "DataSizeBox";
this.DataSizeBox.Size = new System.Drawing.Size(83, 79);
this.DataSizeBox.TabIndex = 5;
this.DataSizeBox.TabStop = false;
this.DataSizeBox.Text = "Data Size:";
//
// Byte4Radio
//
this.Byte4Radio.AutoSize = true;
this.Byte4Radio.Location = new System.Drawing.Point(5, 51);
this.Byte4Radio.Name = "Byte4Radio";
this.Byte4Radio.Size = new System.Drawing.Size(60, 17);
this.Byte4Radio.TabIndex = 2;
this.Byte4Radio.Text = "4 Bytes";
this.Byte4Radio.UseVisualStyleBackColor = true;
//
// Byte2Radio
//
this.Byte2Radio.AutoSize = true;
this.Byte2Radio.Location = new System.Drawing.Point(5, 34);
this.Byte2Radio.Name = "Byte2Radio";
this.Byte2Radio.Size = new System.Drawing.Size(60, 17);
this.Byte2Radio.TabIndex = 1;
this.Byte2Radio.Text = "2 Bytes";
this.Byte2Radio.UseVisualStyleBackColor = true;
//
// Byte1Radio
//
this.Byte1Radio.AutoSize = true;
this.Byte1Radio.Checked = true;
this.Byte1Radio.Location = new System.Drawing.Point(5, 17);
this.Byte1Radio.Name = "Byte1Radio";
this.Byte1Radio.Size = new System.Drawing.Size(55, 17);
this.Byte1Radio.TabIndex = 0;
this.Byte1Radio.TabStop = true;
this.Byte1Radio.Text = "1 Byte";
this.Byte1Radio.UseVisualStyleBackColor = true;
//
// EndianBox
//
this.EndianBox.Controls.Add(this.LittleEndianRadio);
this.EndianBox.Controls.Add(this.BigEndianRadio);
this.EndianBox.Location = new System.Drawing.Point(12, 183);
this.EndianBox.Name = "EndianBox";
this.EndianBox.Size = new System.Drawing.Size(117, 55);
this.EndianBox.TabIndex = 6;
this.EndianBox.TabStop = false;
this.EndianBox.Text = "Endian";
//
// LittleEndianRadio
//
this.LittleEndianRadio.AutoSize = true;
this.LittleEndianRadio.Location = new System.Drawing.Point(4, 35);
this.LittleEndianRadio.Name = "LittleEndianRadio";
this.LittleEndianRadio.Size = new System.Drawing.Size(83, 17);
this.LittleEndianRadio.TabIndex = 1;
this.LittleEndianRadio.Text = "Little Endian";
this.LittleEndianRadio.UseVisualStyleBackColor = true;
//
// BigEndianRadio
//
this.BigEndianRadio.AutoSize = true;
this.BigEndianRadio.Checked = true;
this.BigEndianRadio.Location = new System.Drawing.Point(4, 18);
this.BigEndianRadio.Name = "BigEndianRadio";
this.BigEndianRadio.Size = new System.Drawing.Size(76, 17);
this.BigEndianRadio.TabIndex = 0;
this.BigEndianRadio.TabStop = true;
this.BigEndianRadio.Text = "Big Endian";
this.BigEndianRadio.UseVisualStyleBackColor = true;
//
// OK
//
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.Location = new System.Drawing.Point(12, 169);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 8;
this.OK.Size = new System.Drawing.Size(65, 23);
this.OK.TabIndex = 35;
this.OK.Text = "&Poke";
this.OK.UseVisualStyleBackColor = true;
this.OK.Click += new System.EventHandler(this.OK_Click);
@ -214,10 +71,10 @@
//
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, 293);
this.Cancel.Location = new System.Drawing.Point(136, 169);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 9;
this.Cancel.Size = new System.Drawing.Size(65, 23);
this.Cancel.TabIndex = 40;
this.Cancel.Text = "&Close";
this.Cancel.UseVisualStyleBackColor = true;
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
@ -234,7 +91,7 @@
// ValeLabel
//
this.ValeLabel.AutoSize = true;
this.ValeLabel.Location = new System.Drawing.Point(11, 59);
this.ValeLabel.Location = new System.Drawing.Point(31, 59);
this.ValeLabel.Name = "ValeLabel";
this.ValeLabel.Size = new System.Drawing.Size(37, 13);
this.ValeLabel.TabIndex = 10;
@ -243,75 +100,136 @@
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(73, 57);
this.ValueBox.Location = new System.Drawing.Point(82, 57);
this.ValueBox.MaxLength = 9;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Size = new System.Drawing.Size(80, 20);
this.ValueBox.TabIndex = 1;
this.ValueBox.Size = new System.Drawing.Size(116, 20);
this.ValueBox.TabIndex = 10;
this.ValueBox.Text = "0000";
this.ValueBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValueBox_KeyPress);
this.ValueBox.Leave += new System.EventHandler(this.ValueBox_Leave);
//
// ValueHexLabel
//
this.ValueHexLabel.AutoSize = true;
this.ValueHexLabel.Location = new System.Drawing.Point(55, 60);
this.ValueHexLabel.Location = new System.Drawing.Point(64, 60);
this.ValueHexLabel.Name = "ValueHexLabel";
this.ValueHexLabel.Size = new System.Drawing.Size(18, 13);
this.ValueHexLabel.TabIndex = 11;
this.ValueHexLabel.Text = "0x";
//
// DomainComboBox
// DisplayTypeLabel
//
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);
this.DisplayTypeLabel.AutoSize = true;
this.DisplayTypeLabel.Location = new System.Drawing.Point(81, 118);
this.DisplayTypeLabel.Name = "DisplayTypeLabel";
this.DisplayTypeLabel.Size = new System.Drawing.Size(52, 13);
this.DisplayTypeLabel.TabIndex = 24;
this.DisplayTypeLabel.Text = "Unsigned";
//
// label6
// SizeLabel
//
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";
this.SizeLabel.AutoSize = true;
this.SizeLabel.Location = new System.Drawing.Point(82, 101);
this.SizeLabel.Name = "SizeLabel";
this.SizeLabel.Size = new System.Drawing.Size(28, 13);
this.SizeLabel.TabIndex = 23;
this.SizeLabel.Text = "Byte";
//
// RamPoke
// BigEndianLabel
//
this.BigEndianLabel.AutoSize = true;
this.BigEndianLabel.Location = new System.Drawing.Point(82, 135);
this.BigEndianLabel.Name = "BigEndianLabel";
this.BigEndianLabel.Size = new System.Drawing.Size(58, 13);
this.BigEndianLabel.TabIndex = 41;
this.BigEndianLabel.Text = "Big Endian";
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Enabled = false;
this.AddressBox.Location = new System.Drawing.Point(82, 30);
this.AddressBox.MaxLength = 8;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Size = new System.Drawing.Size(116, 20);
this.AddressBox.TabIndex = 5;
this.AddressBox.Text = "0000";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(39, 135);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 13);
this.label2.TabIndex = 44;
this.label2.Text = "Endian:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(11, 118);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(71, 13);
this.label3.TabIndex = 43;
this.label3.Text = "Display Type:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(52, 101);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(30, 13);
this.label4.TabIndex = 42;
this.label4.Text = "Size:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(36, 84);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(46, 13);
this.label5.TabIndex = 46;
this.label5.Text = "Domain:";
//
// DomainLabel
//
this.DomainLabel.AutoSize = true;
this.DomainLabel.Location = new System.Drawing.Point(82, 84);
this.DomainLabel.Name = "DomainLabel";
this.DomainLabel.Size = new System.Drawing.Size(70, 13);
this.DomainLabel.TabIndex = 45;
this.DomainLabel.Text = "Main Memory";
//
// NewRamPoke
//
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, 332);
this.Controls.Add(this.label6);
this.Controls.Add(this.DomainComboBox);
this.ClientSize = new System.Drawing.Size(213, 208);
this.Controls.Add(this.label5);
this.Controls.Add(this.DomainLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label4);
this.Controls.Add(this.BigEndianLabel);
this.Controls.Add(this.DisplayTypeLabel);
this.Controls.Add(this.SizeLabel);
this.Controls.Add(this.ValueHexLabel);
this.Controls.Add(this.ValueBox);
this.Controls.Add(this.ValeLabel);
this.Controls.Add(this.OutputLabel);
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.AddressBox);
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 = "RamPoke";
this.Name = "NewRamPoke";
this.Text = "Ram Poke";
this.Load += new System.EventHandler(this.RamPoke_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();
@ -321,24 +239,19 @@
private System.Windows.Forms.Label label1;
private HexTextBox AddressBox;
private System.Windows.Forms.GroupBox DataTypeGroupBox;
private System.Windows.Forms.RadioButton SignedRadio;
private System.Windows.Forms.RadioButton UnsignedRadio;
private System.Windows.Forms.RadioButton HexRadio;
private System.Windows.Forms.GroupBox DataSizeBox;
private System.Windows.Forms.RadioButton Byte1Radio;
private System.Windows.Forms.RadioButton Byte2Radio;
private System.Windows.Forms.RadioButton Byte4Radio;
private System.Windows.Forms.GroupBox EndianBox;
private System.Windows.Forms.RadioButton BigEndianRadio;
private System.Windows.Forms.RadioButton LittleEndianRadio;
private System.Windows.Forms.Button OK;
private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.Label OutputLabel;
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;
private System.Windows.Forms.Label DisplayTypeLabel;
private System.Windows.Forms.Label SizeLabel;
private System.Windows.Forms.Label BigEndianLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label DomainLabel;
}
}

View File

@ -1,479 +1,244 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Globalization;
namespace BizHawk.MultiClient
{
public partial class RamPoke : Form
{
public Watch_Legacy Watch = new Watch_Legacy();
public MemoryDomain Domain = Global.Emulator.MainMemory;
public Point NewLocation = new Point();
//TODO: don't use textboxes as labels
private List<Watch> _watchList = new List<Watch>();
public Point InitialLocation = new Point(0, 0);
public RamPoke()
{
InitializeComponent();
}
public void SetWatchObject(Watch_Legacy w)
public void SetWatch(List<Watch> watches)
{
PopulateMemoryDomainComboBox();
Watch = new Watch_Legacy(w);
Domain = w.Domain;
_watchList = watches;
}
private void UnSupportedConfiguration()
{
MessageBox.Show("Ram Poke does not support mixed types", "Unsupported Options", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close();
}
private void RamPoke_Load(object sender, EventArgs e)
{
if (Watch.Address == 0)
PopulateMemoryDomainComboBox();
SetTypeRadio(Watch.Type);
SetSignedRadio(Watch.Signed);
if (Watch.Signed == Watch_Legacy.DISPTYPE.HEX)
_watchList = _watchList.Where(x => !x.IsSeparator).ToList(); //Weed out separators just in case
if (_watchList.Count == 0)
{
ValueHexLabel.Text = "0x";
}
else
{
ValueHexLabel.Text = "";
ValueBox.Enabled = false;
return;
}
if (Watch.BigEndian)
if (InitialLocation.X > 0 || InitialLocation.Y > 0)
{
BigEndianRadio.Checked = true;
}
else
{
LittleEndianRadio.Checked = true;
Location = InitialLocation;
}
SetValueBox();
SetAddressBox();
AddressBox.MaxLength = GetNumDigits(Domain.Size);
ValueBox.MaxLength = GetValueNumDigits();
if (NewLocation.X > 0 && NewLocation.Y > 0)
if (_watchList.Count > 1)
{
Location = NewLocation;
bool hasMixedSizes = _watchList.Select(x => x.Size).Distinct().Count() > 1;
bool hasMixedTypes = _watchList.Select(x => x.Type).Distinct().Count() > 1;
bool hasMixedEndian = _watchList.Select(x => x.BigEndian).Distinct().Count() > 1;
if (hasMixedSizes || hasMixedTypes || hasMixedEndian)
{
UnSupportedConfiguration();
}
}
UpdateTitleText();
SetDomainSelection();
AddressBox.Text = _watchList.Select(a => a.AddressString).Distinct().Aggregate((addrStr, nextStr) => addrStr + ("," + nextStr));
ValueHexLabel.Text = _watchList[0].Type == Watch.DisplayType.Hex ? "0x" : String.Empty;
ValueBox.Text = _watchList[0].ValueString.Replace(" ", "");
DomainLabel.Text = _watchList[0].Domain.Name;
SizeLabel.Text = _watchList[0].Size.ToString();
DisplayTypeLabel.Text = Watch.DisplayTypeToString(_watchList[0].Type);
BigEndianLabel.Text = _watchList[0].BigEndian ? "Big Endian" : "Little Endian";
SetTitle();
SetValueBoxProperties();
}
private void SetValueBoxProperties()
{
switch (Watch.Signed)
switch(_watchList[0].Type)
{
case Watch_Legacy.DISPTYPE.SIGNED:
SignedRadio.Checked = true;
ValueHexLabel.Text = "";
default:
ValueBox.MaxLength = 8;
break;
case Watch_Legacy.DISPTYPE.UNSIGNED:
UnsignedRadio.Checked = true;
ValueHexLabel.Text = "";
case Watch.DisplayType.Binary:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 8;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 16;
break;
}
break;
case Watch_Legacy.DISPTYPE.HEX:
ValueHexLabel.Text = "0x";
HexRadio.Checked = true;
case Watch.DisplayType.Hex:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 2;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 4;
break;
case Watch.WatchSize.DWord:
ValueBox.MaxLength = 8;
break;
}
break;
}
ValueBox.MaxLength = GetValueNumDigits();
FormatValue();
}
private void HexRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "0x";
ValueBox.MaxLength = GetValueNumDigits();
Watch.Signed = Watch_Legacy.DISPTYPE.HEX;
FormatValue();
}
private void UnsignedRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "";
ValueBox.MaxLength = GetValueNumDigits();
Watch.Signed = Watch_Legacy.DISPTYPE.UNSIGNED;
FormatValue();
}
private void SignedRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "";
ValueBox.MaxLength = GetValueNumDigits();
Watch.Signed = Watch_Legacy.DISPTYPE.SIGNED;
FormatValue();
}
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;
}
private void SetTypeRadio(Watch_Legacy.TYPE a)
{
switch (a)
{
case Watch_Legacy.TYPE.BYTE:
Byte1Radio.Checked = true;
case Watch.DisplayType.Signed:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 4;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 6;
break;
case Watch.WatchSize.DWord:
ValueBox.MaxLength = 11;
break;
}
break;
case Watch_Legacy.TYPE.WORD:
Byte2Radio.Checked = true;
case Watch.DisplayType.Unsigned:
switch (_watchList[0].Size)
{
default:
case Watch.WatchSize.Byte:
ValueBox.MaxLength = 3;
break;
case Watch.WatchSize.Word:
ValueBox.MaxLength = 5;
break;
case Watch.WatchSize.DWord:
ValueBox.MaxLength = 10;
break;
}
break;
case Watch_Legacy.TYPE.DWORD:
Byte4Radio.Checked = true;
case Watch.DisplayType.Float:
case Watch.DisplayType.FixedPoint_12_4:
case Watch.DisplayType.FixedPoint_20_12:
ValueBox.MaxLength = 32;
break;
}
}
private void SetSignedRadio(Watch_Legacy.DISPTYPE a)
private void SetTitle()
{
switch (a)
{
case Watch_Legacy.DISPTYPE.SIGNED:
SignedRadio.Checked = true;
break;
case Watch_Legacy.DISPTYPE.UNSIGNED:
UnsignedRadio.Checked = true;
break;
case Watch_Legacy.DISPTYPE.HEX:
HexRadio.Checked = true;
break;
}
Text = "Ram Poke - " + _watchList[0].Domain.Name;
}
#region Events
private void Cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void OK_Click(object sender, EventArgs e)
{
//Put user settings in the watch file
if (InputValidate.IsValidHexNumber(AddressBox.Text))
Watch.Address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
else
bool success = true;
foreach (var watch in _watchList)
{
MessageBox.Show("Invalid Address, must be a valid hex number", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
AddressBox.Focus();
AddressBox.SelectAll();
return;
if (!watch.Poke(ValueBox.Text))
{
success = false;
}
}
if (SignedRadio.Checked)
if (success)
{
Watch.Signed = Watch_Legacy.DISPTYPE.SIGNED;
}
else if (UnsignedRadio.Checked)
{
Watch.Signed = Watch_Legacy.DISPTYPE.UNSIGNED;
}
else if (HexRadio.Checked)
{
Watch.Signed = Watch_Legacy.DISPTYPE.HEX;
}
if (Byte1Radio.Checked)
{
Watch.Type = Watch_Legacy.TYPE.BYTE;
}
else if (Byte2Radio.Checked)
{
Watch.Type = Watch_Legacy.TYPE.WORD;
}
else if (Byte4Radio.Checked)
{
Watch.Type = Watch_Legacy.TYPE.DWORD;
}
if (BigEndianRadio.Checked)
{
Watch.BigEndian = true;
}
else if (LittleEndianRadio.Checked)
{
Watch.BigEndian = false;
}
int? x = GetSpecificValue();
if (x == null)
{
MessageBox.Show("Missing or invalid value", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
ValueBox.Focus();
ValueBox.SelectAll();
return;
OutputLabel.Text = "Value successfully written.";
}
else
{
Watch.TrySetValue(ValueBox.Text);
}
Watch.Domain = Domain;
Watch.PokeAddress();
string value;
if (HexRadio.Checked)
value = "0x" + String.Format("{0:X" + GetValueNumDigits() + "}", Watch.Value);
else
value = Watch.Value.ToString();
string address = String.Format("{0:X" + GetNumDigits(Domain.Size).ToString()
+ "}", Watch.Address);
OutputLabel.Text = value + " written to " + address;
}
private void AddressBox_Leave(object sender, EventArgs e)
{
AddressBox.Text = AddressBox.Text.Replace(" ", "");
if (!InputValidate.IsValidHexNumber(AddressBox.Text))
{
AddressBox.Focus();
AddressBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid hexadecimal value", AddressBox, 5000);
}
}
private void ValueBox_Leave(object sender, EventArgs e)
{
ValueBox.Text = ValueBox.Text.Replace(" ", "");
switch (Watch.Signed)
{
case Watch_Legacy.DISPTYPE.UNSIGNED:
if (!InputValidate.IsValidUnsignedNumber(ValueBox.Text))
{
ValueBox.Focus();
ValueBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid unsigned decimal value", ValueBox, 5000);
}
break;
case Watch_Legacy.DISPTYPE.SIGNED:
if (!InputValidate.IsValidSignedNumber(ValueBox.Text))
{
ValueBox.Focus();
ValueBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid signed decimal value", ValueBox, 5000);
}
break;
case Watch_Legacy.DISPTYPE.HEX:
if (!InputValidate.IsValidHexNumber(ValueBox.Text))
{
ValueBox.Focus();
ValueBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid hexadecimal decimal value", ValueBox, 5000);
}
break;
}
}
private Watch_Legacy.DISPTYPE GetDataType()
{
if (SignedRadio.Checked)
{
return Watch_Legacy.DISPTYPE.SIGNED;
}
if (UnsignedRadio.Checked)
{
return Watch_Legacy.DISPTYPE.UNSIGNED;
}
if (HexRadio.Checked)
{
return Watch_Legacy.DISPTYPE.HEX;
}
else
{
return Watch_Legacy.DISPTYPE.UNSIGNED; //Just in case
OutputLabel.Text = "An error occured when writing Value.";
}
}
private void ValueBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\b') return;
switch (GetDataType())
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
{
case Watch_Legacy.DISPTYPE.UNSIGNED:
if (!InputValidate.IsValidUnsignedNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch_Legacy.DISPTYPE.SIGNED:
return;
}
if (e.KeyChar == '.')
{
if (ValueBox.Text.Contains('.'))
{
e.Handled = true;
}
}
else if (e.KeyChar == '-')
{
if (ValueBox.Text.Contains('-'))
{
e.Handled = true;
}
}
switch(_watchList[0].Type)
{
case Watch.DisplayType.Signed:
if (!InputValidate.IsValidSignedNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch_Legacy.DISPTYPE.HEX:
case Watch.DisplayType.Unsigned:
if (!InputValidate.IsValidUnsignedNumber(e.KeyChar))
{
e.Handled = true;
}
break;
case Watch.DisplayType.Hex:
if (!InputValidate.IsValidHexNumber(e.KeyChar))
{
e.Handled = true;
}
break;
}
}
private Watch_Legacy.TYPE GetDataSize()
{
if (Byte1Radio.Checked)
{
return Watch_Legacy.TYPE.BYTE;
}
else if (Byte2Radio.Checked)
{
return Watch_Legacy.TYPE.WORD;
}
else if (Byte4Radio.Checked)
{
return Watch_Legacy.TYPE.DWORD;
}
else
{
return Watch_Legacy.TYPE.BYTE;
}
}
private int? GetSpecificValue()
{
if (ValueBox.Text == "" || ValueBox.Text == "-") return 0;
bool i;
switch (GetDataType())
{
case Watch_Legacy.DISPTYPE.UNSIGNED:
i = InputValidate.IsValidUnsignedNumber(ValueBox.Text);
if (!i)
case Watch.DisplayType.Binary:
if (!InputValidate.IsValidBinaryNumber(e.KeyChar))
{
return null;
e.Handled = true;
}
else
break;
case Watch.DisplayType.FixedPoint_12_4:
case Watch.DisplayType.FixedPoint_20_12:
if (!InputValidate.IsValidFixedPointNumber(e.KeyChar))
{
return (int)Int64.Parse(ValueBox.Text); //Note: 64 to be safe
e.Handled = true;
}
case Watch_Legacy.DISPTYPE.SIGNED:
i = InputValidate.IsValidSignedNumber(ValueBox.Text);
if (!i)
break;
case Watch.DisplayType.Float:
if (!InputValidate.IsValidDecimalNumber(e.KeyChar))
{
return null;
e.Handled = true;
}
else
{
return (int)Int64.Parse(ValueBox.Text);
}
case Watch_Legacy.DISPTYPE.HEX:
i = InputValidate.IsValidHexNumber(ValueBox.Text);
if (!i)
{
return null;
}
else
{
return (int)Int64.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
}
return null;
}
private int GetValueNumDigits()
{
switch (GetDataSize())
{
default:
case Watch_Legacy.TYPE.BYTE:
if (HexRadio.Checked) return 2;
else if (UnsignedRadio.Checked) return 3;
else return 4;
case Watch_Legacy.TYPE.WORD:
if (HexRadio.Checked) return 4;
else if (UnsignedRadio.Checked) return 5;
else return 6;
case Watch_Legacy.TYPE.DWORD:
if (HexRadio.Checked) return 8;
else if (UnsignedRadio.Checked) return 10;
else return 11;
break;
}
}
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 PopulateMemoryDomainComboBox()
{
DomainComboBox.Items.Clear();
if (Global.Emulator.MemoryDomains.Count > 0)
{
foreach (MemoryDomain t in Global.Emulator.MemoryDomains)
{
DomainComboBox.Items.Add(t.ToString());
}
}
SetDomainSelection();
}
private void DomainComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
Domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
UpdateTitleText();
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;
}
}
private void FormatValue()
{
Watch.Signed = GetDataType();
Watch.TrySetValue(ValueBox.Text);
ValueBox.Text = Watch.ValueString;
}
#endregion
}
}

View File

@ -489,15 +489,16 @@ namespace BizHawk.MultiClient
{
ListView.SelectedIndexCollection indexes = SearchListView.SelectedIndices;
Global.Sound.StopSound();
RamPoke p = new RamPoke();
var poke = new RamPoke();
Global.Sound.StartSound();
if (indexes.Count > 0)
{
p.SetWatchObject(Searches[indexes[0]]);
var watch = Watch.ConvertLegacyWatch(Searches[indexes[0]]);
poke.SetWatch(new List<Watch> { watch });
}
p.NewLocation = GetPromptPoint();
p.ShowDialog();
poke.InitialLocation = GetPromptPoint();
poke.ShowDialog();
UpdateValues();
}

View File

@ -111,21 +111,7 @@ namespace BizHawk.MultiClient
/// <param name="watch"></param>
public void AddOldWatch(Watch_Legacy watch)
{
Watch w = Watch.GenerateWatch(
watch.Domain,
watch.Address,
Watch.SizeFromChar(watch.TypeChar),
!String.IsNullOrWhiteSpace(watch.Notes)
);
w.Type = Watch.DisplayTypeFromChar(watch.SignedChar);
if (!String.IsNullOrWhiteSpace(watch.Notes))
{
(w as IWatchDetails).Notes = watch.Notes;
}
Watches.Add(w);
Watches.Add(Watch.ConvertLegacyWatch(watch));
DisplayWatches();
UpdateValues();
UpdateWatchCount();
@ -591,7 +577,7 @@ namespace BizHawk.MultiClient
{
if (SelectedWatches.Any())
{
NewRamPoke poke = new NewRamPoke
RamPoke poke = new RamPoke
{
InitialLocation = GetPromptPoint()
};

View File

@ -267,6 +267,31 @@ namespace BizHawk.MultiClient
}
}
}
/// <summary>
/// Temparary support of the legacy watch object
/// </summary>
/// <param name="watch"></param>
/// <returns></returns>
public static Watch ConvertLegacyWatch(Watch_Legacy watch)
{
Watch w = Watch.GenerateWatch(
watch.Domain,
watch.Address,
Watch.SizeFromChar(watch.TypeChar),
!String.IsNullOrWhiteSpace(watch.Notes)
);
w.Type = Watch.DisplayTypeFromChar(watch.SignedChar);
if (!String.IsNullOrWhiteSpace(watch.Notes))
{
(w as IWatchDetails).Notes = watch.Notes;
}
return w;
}
}
public interface IWatchDetails