Lua: Added joypad.setanalog, with the same calling format as set but with float values instead of bools. Still not sure that the analog wiring is the best, but this works for now.

This commit is contained in:
pjgat09 2013-05-12 02:43:33 +00:00
parent 05a525d2c4
commit a0f470b1bb
1 changed files with 32 additions and 1 deletions

View File

@ -501,7 +501,8 @@ namespace BizHawk.MultiClient
{
"set",
"get",
"getimmediate"
"getimmediate",
"setanalog"
};
public static string[] MultiClientFunctions = new[]
@ -2225,6 +2226,36 @@ namespace BizHawk.MultiClient
catch { /*Eat it*/ }
}
public void joypad_setanalog(LuaTable controls, object controller = null)
{
try
{
foreach (var name in controls.Keys)
{
float theValue;
string theValueStr = controls[name].ToString();
if (!String.IsNullOrWhiteSpace(theValueStr))
{
try
{
theValue = float.Parse(theValueStr);
if (controller == null)
{
Global.StickyXORAdapter.SetFloat(name.ToString(), theValue);
}
else
{
Global.StickyXORAdapter.SetFloat("P" + controller + " " + name.ToString(), theValue);
}
}
catch { }
}
}
}
catch { /*Eat it*/ }
}
//----------------------------------------------------
//Client library
//----------------------------------------------------