1) Autohold and Autohold Clear hotkeys, same functionality as in FCEUX and other emulators (hold the autohold hotkey then press the controller buttons you want held)

2) Ram Poke - fix poking of signed/hex values, set the signed value to the value of the address on load, other misc fixes regarding signed
3) Hex Editor - add Poke to menu/context menu and Ctrl+P hotkey
This commit is contained in:
andres.delikat 2012-09-14 21:31:00 +00:00
parent 4101efb92d
commit faed5ba5f7
11 changed files with 865 additions and 613 deletions

View File

@ -543,6 +543,8 @@ namespace BizHawk.MultiClient
public string ToggleMenuBinding = "";
public string IncreaseWindowSize = "Alt+UpArrow";
public string DecreaseWindowSize = "Alt+DownArrow";
public string AutoholdBinding = "";
public string AutoholdClear = "";
// NES Sound settings
public bool NESEnableSquare1 = true;

View File

@ -505,8 +505,8 @@ namespace BizHawk.MultiClient
{
float x = GetX(g, Global.Config.DispLagx, Global.Config.DispLaganchor, AlertFont, counter);
float y = GetY(g, Global.Config.DispLagy, Global.Config.DispLaganchor, AlertFont, counter);
g.DrawString(MakeLagCounter(), AlertFont, Color.Black, x + 1, y + 1);
g.DrawString(MakeLagCounter(), AlertFont, FixedAlertMessageColor,x, y);
g.DrawString(counter, AlertFont, Color.Black, x + 1, y + 1);
g.DrawString(counter, AlertFont, FixedAlertMessageColor, x, y);
}
else
{
@ -526,6 +526,18 @@ namespace BizHawk.MultiClient
g.DrawString(rerec, MessageFont, FixedMessagesColor, x, y);
}
if (Global.ClientControls["Autohold"])
{
StringBuilder disp = new StringBuilder("Held: ");
foreach (string s in Global.StickyXORAdapter.CurrentStickies)
{
disp.Append(s);
disp.Append(' ');
}
g.DrawString(disp.ToString(), MessageFont, Color.White, GetX(g, 0, 3, MessageFont, disp.ToString()), 0);
}
//TODO
//if (Global.MovieSession.Movie.IsPlaying)
//{

View File

@ -107,6 +107,23 @@ namespace BizHawk.MultiClient
return list;
}
public List<string> PressedButtons
{
get
{
List<string> list = new List<string>();
foreach (var button in buttons)
{
if (button.Value)
{
list.Add(button.Key);
}
}
return list;
}
}
}
public class AutofireController : IController
@ -226,5 +243,22 @@ namespace BizHawk.MultiClient
{
foreach (var key in buttonStarts.Keys.ToArray()) buttonStarts[key]++;
}
public List<string> PressedButtons
{
get
{
List<string> list = new List<string>();
foreach (var button in buttons)
{
if (button.Value)
{
list.Add(button.Key);
}
}
return list;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -99,6 +99,8 @@ namespace BizHawk.MultiClient.tools
IDW_IncSpeed.SetBindings(Global.Config.IncreaseSpeedBinding);
IDW_DecSpeed.SetBindings(Global.Config.DecreaseSpeedBinding);
IDW_ToggleBGInput.SetBindings(Global.Config.ToggleBackgroundInput);
IDW_Autohold.SetBindings(Global.Config.AutoholdBinding);
IDW_ClearAutohold.SetBindings(Global.Config.AutoholdClear);
}
private void button2_Click(object sender, EventArgs e)
{
@ -206,6 +208,10 @@ namespace BizHawk.MultiClient.tools
Global.Config.IncreaseSpeedBinding = IDW_IncSpeed.Text;
Global.Config.DecreaseSpeedBinding = IDW_DecSpeed.Text;
Global.Config.ToggleBackgroundInput = IDW_ToggleBGInput.Text;
Global.Config.AutoholdBinding = IDW_Autohold.Text;
Global.Config.AutoholdClear = IDW_ClearAutohold.Text;
this.DialogResult = DialogResult.OK;
this.Close();
}

View File

@ -124,6 +124,7 @@ namespace BizHawk.MultiClient
public IController Source;
public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } }
public bool Locked = false; //Pretty much a hack,
public bool IsPressed(string button) { return this[button]; }
public float GetFloat(string name) { return 0.0f; } //TODO
@ -153,6 +154,40 @@ namespace BizHawk.MultiClient
{
return stickySet.Contains(button);
}
public HashSet<string> CurrentStickies
{
get
{
return stickySet;
}
}
public void ClearStickies()
{
stickySet.Clear();
}
public void MassToggleStickyState(List<string> buttons)
{
foreach (string button in buttons)
{
if (!JustPressed.Contains(button))
{
if (stickySet.Contains(button))
{
stickySet.Remove(button);
}
else
{
stickySet.Add(button);
}
}
}
JustPressed = buttons;
}
private List<string> JustPressed = new List<string>();
}
public class MnemonicsGenerator

View File

@ -84,6 +84,8 @@
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
this.AddressesLabel = new System.Windows.Forms.Label();
this.Header = new System.Windows.Forms.Label();
this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pokeAddressToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.ViewerContextMenuStrip.SuspendLayout();
this.MemoryViewerBox.SuspendLayout();
@ -172,7 +174,7 @@
this.copyToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Duplicate;
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.copyToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.copyToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.copyToolStripMenuItem.Text = "&Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
@ -181,20 +183,20 @@
this.pasteToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Paste;
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.pasteToolStripMenuItem.Text = "&Paste";
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(143, 6);
this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6);
//
// findToolStripMenuItem1
//
this.findToolStripMenuItem1.Name = "findToolStripMenuItem1";
this.findToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
this.findToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
this.findToolStripMenuItem1.Text = "&Find...";
this.findToolStripMenuItem1.Click += new System.EventHandler(this.findToolStripMenuItem1_Click);
//
@ -202,7 +204,7 @@
//
this.findNextToolStripMenuItem.Name = "findNextToolStripMenuItem";
this.findNextToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3;
this.findNextToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.findNextToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.findNextToolStripMenuItem.Text = "Find Next";
this.findNextToolStripMenuItem.Click += new System.EventHandler(this.findNextToolStripMenuItem_Click);
//
@ -210,7 +212,7 @@
//
this.findPrevToolStripMenuItem.Name = "findPrevToolStripMenuItem";
this.findPrevToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2;
this.findPrevToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.findPrevToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.findPrevToolStripMenuItem.Text = "Find Prev";
this.findPrevToolStripMenuItem.Click += new System.EventHandler(this.findPrevToolStripMenuItem_Click);
//
@ -224,7 +226,8 @@
this.goToAddressToolStripMenuItem,
this.addToRamWatchToolStripMenuItem1,
this.freezeAddressToolStripMenuItem,
this.unfreezeAllToolStripMenuItem});
this.unfreezeAllToolStripMenuItem,
this.pokeAddressToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "&Options";
@ -409,13 +412,14 @@
this.freezeToolStripMenuItem,
this.addToRamWatchToolStripMenuItem,
this.unfreezeAllToolStripMenuItem1,
this.pokeAddressToolStripMenuItem1,
this.toolStripSeparator4,
this.incrementToolStripMenuItem,
this.decrementToolStripMenuItem,
this.toolStripSeparator5,
this.gotoAddressToolStripMenuItem1});
this.ViewerContextMenuStrip.Name = "ViewerContextMenuStrip";
this.ViewerContextMenuStrip.Size = new System.Drawing.Size(220, 192);
this.ViewerContextMenuStrip.Size = new System.Drawing.Size(220, 236);
this.ViewerContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.ViewerContextMenuStrip_Opening);
//
// copyToolStripMenuItem1
@ -560,6 +564,24 @@
this.Header.TabIndex = 2;
this.Header.Text = "label1";
//
// pokeAddressToolStripMenuItem
//
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(219, 22);
this.pokeAddressToolStripMenuItem.Text = "&Poke Address";
this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click);
//
// pokeAddressToolStripMenuItem1
//
this.pokeAddressToolStripMenuItem1.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
this.pokeAddressToolStripMenuItem1.Name = "pokeAddressToolStripMenuItem1";
this.pokeAddressToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+P";
this.pokeAddressToolStripMenuItem1.Size = new System.Drawing.Size(219, 22);
this.pokeAddressToolStripMenuItem1.Text = "&Poke Address";
this.pokeAddressToolStripMenuItem1.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem1_Click);
//
// HexEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -645,5 +667,7 @@
private System.Windows.Forms.ToolStripMenuItem findNextToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem findPrevToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pokeAddressToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pokeAddressToolStripMenuItem1;
}
}

View File

@ -686,6 +686,7 @@ namespace BizHawk.MultiClient
Global.Sound.StopSound();
poke.ShowDialog();
Global.Sound.StartSound();
UpdateValues();
}
}
@ -2239,5 +2240,15 @@ namespace BizHawk.MultiClient
saveAsBinaryToolStripMenuItem.Text = "Save as binary...";
}
}
private void pokeAddressToolStripMenuItem_Click(object sender, EventArgs e)
{
PokeAddress();
}
private void pokeAddressToolStripMenuItem1_Click(object sender, EventArgs e)
{
PokeAddress();
}
}
}

View File

@ -243,6 +243,7 @@
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(73, 57);
this.ValueBox.MaxLength = 9;
this.ValueBox.Name = "ValueBox";

View File

@ -63,6 +63,53 @@ namespace BizHawk.MultiClient
UpdateTitleText();
SetDomainSelection();
SetValueBoxProperties();
}
private void SetValueBoxProperties()
{
switch (watch.Signed)
{
case Watch.DISPTYPE.SIGNED:
SignedRadio.Checked = true;
ValueHexLabel.Text = "";
break;
case Watch.DISPTYPE.UNSIGNED:
UnsignedRadio.Checked = true;
ValueHexLabel.Text = "";
break;
case Watch.DISPTYPE.HEX:
ValueHexLabel.Text = "0x";
HexRadio.Checked = true;
break;
}
ValueBox.MaxLength = GetValueNumDigits();
FormatValue();
}
private void HexRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "0x";
ValueBox.MaxLength = GetValueNumDigits();
watch.Signed = Watch.DISPTYPE.HEX;
FormatValue();
}
private void UnsignedRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "";
ValueBox.MaxLength = GetValueNumDigits();
watch.Signed = Watch.DISPTYPE.UNSIGNED;
FormatValue();
}
private void SignedRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "";
ValueBox.MaxLength = GetValueNumDigits();
watch.Signed = Watch.DISPTYPE.SIGNED;
FormatValue();
}
@ -186,7 +233,7 @@ namespace BizHawk.MultiClient
}
else
{
watch.Value = int.Parse(ValueBox.Text);
watch.TrySetValue(ValueBox.Text);
}
watch.Domain = domain;
watch.PokeAddress();
@ -218,13 +265,38 @@ namespace BizHawk.MultiClient
private void ValueBox_Leave(object sender, EventArgs e)
{
ValueBox.Text = ValueBox.Text.Replace(" ", "");
if (!InputValidate.IsValidUnsignedNumber(ValueBox.Text))
switch (watch.Signed)
{
ValueBox.Focus();
ValueBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid unsigned decimal value", ValueBox, 5000);
case Watch.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.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.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.DISPTYPE GetDataType()
@ -342,30 +414,6 @@ namespace BizHawk.MultiClient
return null;
}
private void HexRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "0x";
ValueBox.MaxLength = GetValueNumDigits();
watch.Signed = Watch.DISPTYPE.HEX;
FormatValue();
}
private void UnsignedRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "";
ValueBox.MaxLength = GetValueNumDigits();
watch.Signed = Watch.DISPTYPE.UNSIGNED;
FormatValue();
}
private void SignedRadio_Click(object sender, EventArgs e)
{
ValueHexLabel.Text = "";
ValueBox.MaxLength = GetValueNumDigits();
watch.Signed = Watch.DISPTYPE.SIGNED;
FormatValue();
}
private int GetValueNumDigits()
{
switch (GetDataSize())
@ -439,6 +487,8 @@ namespace BizHawk.MultiClient
private void FormatValue()
{
watch.Signed = GetDataType();
watch.TrySetValue(ValueBox.Text);
ValueBox.Text = watch.ValueString;
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace BizHawk.MultiClient
{
@ -420,6 +421,34 @@ namespace BizHawk.MultiClient
return converted;
}
public void TrySetValue(string value)
{
switch (Signed)
{
case DISPTYPE.SIGNED:
try
{
Value = int.Parse(value);
}
catch { }
break;
case DISPTYPE.UNSIGNED:
try
{
Value = (int)uint.Parse(value);
}
catch { }
break;
case DISPTYPE.HEX:
try
{
Value = int.Parse(value, NumberStyles.HexNumber);
}
catch { }
break;
}
}
#endregion
#region Helpers