diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index b34bb5c941..6597c8923e 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -1109,19 +1109,11 @@ namespace BizHawk.MultiClient //---------------------------------------------------- public LuaTable input_get() { - LuaTable keys = new LuaTable(1, lua); - string[] keystrings = Global.MainForm.lastKeyboard.Split(' '); - - foreach (string keypress in keystrings) - { - if (keypress.Contains("Press:")) - { - string key = keypress.Replace("Press:", ""); - keys[key] = key; - } - } - - return keys; + LuaTable buttons = lua.NewTable(); + foreach (var kvp in Global.ControllerInputCoalescer.BoolButtons()) + if (kvp.Value) + buttons[kvp.Key] = true; + return buttons; } //---------------------------------------------------- @@ -1131,7 +1123,7 @@ namespace BizHawk.MultiClient //Currently sends all controllers, needs to control which ones it sends public LuaTable joypad_get() { - LuaTable buttons = new LuaTable(1, lua); + LuaTable buttons = lua.NewTable(); foreach (string button in Global.ControllerOutput.Source.Type.BoolButtons) buttons[button] = Global.ControllerOutput[button]; @@ -1145,7 +1137,7 @@ namespace BizHawk.MultiClient public LuaTable joypad_getimmediate() { - LuaTable buttons = new LuaTable(1, lua); + LuaTable buttons = lua.NewTable(); foreach (string button in Global.ActiveController.Type.BoolButtons) buttons[button] = Global.ActiveController[button]; return buttons; diff --git a/BizHawk.MultiClient/LuaInterface.dll b/BizHawk.MultiClient/LuaInterface.dll index 7b7f101159..e33a7208cf 100644 Binary files a/BizHawk.MultiClient/LuaInterface.dll and b/BizHawk.MultiClient/LuaInterface.dll differ diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 695d8702ca..36d2ca2f7b 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -376,6 +376,7 @@ namespace BizHawk.MultiClient LuaConsole1.ResumeScripts(false); #endif + Global.RenderPanel.ClearGUIText(); StepRunLoop_Core(); //if(!IsNullEmulator()) StepRunLoop_Throttle(); @@ -1678,7 +1679,6 @@ namespace BizHawk.MultiClient bool genSound = false; if (runFrame) { - Global.RenderPanel.ClearGUIText(); //client input-related duties #if WINDOWS diff --git a/BizHawk.MultiClient/lua51.dll b/BizHawk.MultiClient/lua51.dll index 2d1d374295..84cbcb597f 100644 Binary files a/BizHawk.MultiClient/lua51.dll and b/BizHawk.MultiClient/lua51.dll differ diff --git a/BizHawk.MultiClient/movie/InputAdapters.cs b/BizHawk.MultiClient/movie/InputAdapters.cs index d8aa3a5869..c5c9b702c4 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -82,6 +82,11 @@ namespace BizHawk.MultiClient public float GetFloat(string name) { return 0.0f; } //TODO public void UpdateControls(int frame) { } + public IEnumerable> BoolButtons() + { + foreach (var kvp in Buttons) yield return kvp; + } + public virtual void LatchFrom(IController source) { foreach (string button in source.Type.BoolButtons) diff --git a/LuaInterface/LuaInterface/Lua.cs b/LuaInterface/LuaInterface/Lua.cs index cbc23f0588..05441b361d 100644 --- a/LuaInterface/LuaInterface/Lua.cs +++ b/LuaInterface/LuaInterface/Lua.cs @@ -647,6 +647,14 @@ namespace LuaInterface translator.push(luaState,val); LuaDLL.lua_settable(luaState,-3); } + + //zero 24-mar-2012 added + public LuaTable NewTable() + { + NewTable("_TEMP_BIZHAWK_RULES_"); + return GetTable("_TEMP_BIZHAWK_RULES_"); + } + /* * Creates a new table as a global variable or as a field * inside an existing table diff --git a/LuaInterface/LuaInterface/LuaTable.cs b/LuaInterface/LuaInterface/LuaTable.cs index c83d56b0c5..4e5714a5dc 100644 --- a/LuaInterface/LuaInterface/LuaTable.cs +++ b/LuaInterface/LuaInterface/LuaTable.cs @@ -16,7 +16,7 @@ namespace LuaInterface { //internal int _Reference; //private Lua _Interpreter; - public LuaTable(int reference, Lua interpreter) + internal LuaTable(int reference, Lua interpreter) { _Reference = reference; _Interpreter = interpreter;