From a0f470b1bb46ad238fd1b4d0f57916b287a2f506 Mon Sep 17 00:00:00 2001 From: pjgat09 Date: Sun, 12 May 2013 02:43:33 +0000 Subject: [PATCH] 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. --- BizHawk.MultiClient/LuaImplementation.cs | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index 5a70352939..b0430b912e 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -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 //----------------------------------------------------