Greatly improve performance of the virtualpad tool, most configurations will have no speed cost unless there is no movie, movie speeds are much improved.

This commit is contained in:
adelikat 2014-07-26 17:11:47 +00:00
parent 130f0418a9
commit 9210b4d9a1
7 changed files with 38 additions and 3 deletions

View File

@ -13,6 +13,11 @@ namespace BizHawk.Client.EmuHawk
private readonly PadSchema _schema;
private bool _readOnly;
public void UpdateValues()
{
PadControls.ForEach(c => c.UpdateValues());
}
private List<IVirtualPadControl> PadControls
{
get

View File

@ -195,7 +195,7 @@ namespace BizHawk.Client.EmuHawk
Pads.ForEach(pad => pad.Clear());
}
Pads.ForEach(pad => pad.Refresh());
Pads.ForEach(pad => pad.UpdateValues());
}
public void FastUpdate()

View File

@ -9,6 +9,8 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
void Clear();
void UpdateValues();
/// <summary>
/// Sets the state of the control based on the given controller state
/// </summary>

View File

@ -36,6 +36,14 @@ namespace BizHawk.Client.EmuHawk
#region IVirtualPadControl Implementation
public void UpdateValues()
{
if (AnalogTrackBar.Value != (int)Global.StickyXORAdapter.GetFloat(Name))
{
RefreshWidgets();
}
}
public void Clear()
{
Global.StickyXORAdapter.Unset(Name);
@ -168,7 +176,7 @@ namespace BizHawk.Client.EmuHawk
}
}
protected override void OnPaint(PaintEventArgs e)
private void RefreshWidgets()
{
if (!_isSet)
{
@ -177,7 +185,10 @@ namespace BizHawk.Client.EmuHawk
ValueLabel.Text = AnalogTrackBar.Value.ToString();
_programmaticallyChangingValue = false;
}
}
protected override void OnPaint(PaintEventArgs e)
{
RefreshWidgets();
base.OnPaint(e);
}
}

View File

@ -46,6 +46,12 @@ namespace BizHawk.Client.EmuHawk
#region IVirtualPadControl Implementation
public void UpdateValues()
{
// Nothing to do
// This tool already draws as necessary
}
public void Set(IController controller)
{
AnalogStick.Set(controller);

View File

@ -36,6 +36,12 @@ namespace BizHawk.Client.EmuHawk
}
}
public void UpdateValues()
{
// Nothing to do
// This tool already draws as necessary
}
public void Set(IController controller)
{
var newVal = controller.IsPressed(Name);

View File

@ -35,6 +35,11 @@ namespace BizHawk.Client.EmuHawk
#region IVirtualPadControl Implementation
public void UpdateValues()
{
TargetPanel.Refresh();
}
public void Clear()
{
Global.StickyXORAdapter.Unset(XName);