Lua: Fixed a bug with analog controls not being cleared

This commit is contained in:
pjgat09 2014-12-07 07:39:01 +00:00
parent 556b7b0123
commit c2096d9a30
1 changed files with 14 additions and 13 deletions

View File

@ -172,23 +172,24 @@ namespace BizHawk.Client.Common
foreach (var name in controls.Keys)
{
var theValueStr = controls[name].ToString();
float? theValue = null;
if (!String.IsNullOrWhiteSpace(theValueStr))
{
try
{
var theValue = float.Parse(theValueStr);
if (controller == null)
{
Global.StickyXORAdapter.SetFloat(name.ToString(), theValue);
}
else
{
Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue);
}
}
catch { }
float f;
if (float.TryParse(theValueStr, out f))
theValue = f;
}
if (controller == null)
{
Global.StickyXORAdapter.SetFloat(name.ToString(), theValue);
}
else
{
Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue);
}
}
}
catch { /*Eat it*/ }