From 321a45722eda08f7b744f5365f55b4128f55068c Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sat, 17 Sep 2011 15:35:39 +0000 Subject: [PATCH] Hex Editor - use Ram Poke dialog for the Poke address function. Ram Watch - Successfully stop/start sound on ram poke --- BizHawk.MultiClient/tools/HexEditor.cs | 36 ++++++++++++++++---------- BizHawk.MultiClient/tools/RamWatch.cs | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index 69853b2f53..945b060405 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -459,22 +459,32 @@ namespace BizHawk.MultiClient int p = GetHighlightedAddress(); if (p >= 0) { - Global.Sound.StopSound(); - InputPrompt i = new InputPrompt(); - Global.Sound.StartSound(); - i.Text = "Poke 0x" + String.Format(NumDigitsStr, p); - i.SetMessage("Enter a hexadecimal value"); - i.ShowDialog(); + Watch w = new Watch(); + w.address = p; + w.value = MakeValue(p); + w.bigendian = Global.Config.HexEditorBigEndian; + w.signed = asigned.HEX; - if (i.UserOK) + switch (Global.Config.HexEditorDataSize) { - if (InputValidate.IsValidHexNumber(i.UserText)) - { - int value = int.Parse(i.UserText, NumberStyles.HexNumber); - PokeHighlighted(value); - UpdateValues(); - } + default: + case 1: + w.type = atype.BYTE; + break; + case 2: + w.type = atype.WORD; + break; + case 4: + w.type = atype.DWORD; + break; } + + RamPoke poke = new RamPoke(); + poke.SetWatchObject(w, Domain); + poke.location = GetAddressCoordinates(p); + Global.Sound.StopSound(); + poke.ShowDialog(); + Global.Sound.StartSound(); } } diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index d43f2780b9..d335faab35 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -925,11 +925,11 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; Global.Sound.StopSound(); RamPoke p = new RamPoke(); - Global.Sound.StartSound(); if (indexes.Count > 0) p.SetWatchObject(watchList[indexes[0]], Domain); p.location = GetPromptPoint(); p.ShowDialog(); + Global.Sound.StartSound(); } private void pokeAddressToolStripMenuItem_Click(object sender, EventArgs e)