diff --git a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs index 3ef5da79d4..0cb771c5db 100644 --- a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs @@ -25,6 +25,11 @@ namespace BizHawk.Client.Common return _inputManager.AutofireStickyXorAdapter.ToDictionary(controller); } + public IDictionary GetWithMovie(int? controller = null) + { + return _inputManager.ControllerOutput.ToDictionary(controller); + } + public IDictionary GetImmediate(int? controller = null) { return _inputManager.ActiveController.ToDictionary(controller); diff --git a/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs b/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs index 279d2d1aa4..b8523afe54 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs @@ -5,6 +5,7 @@ namespace BizHawk.Client.Common public interface IJoypadApi : IExternalApi { IDictionary Get(int? controller = null); + IDictionary GetWithMovie(int? controller = null); IDictionary GetImmediate(int? controller = null); void SetFromMnemonicStr(string inputLogEntry); void Set(IDictionary buttons, int? controller = null); diff --git a/src/BizHawk.Client.Common/lua/CommonLibs/JoypadLuaLibrary.cs b/src/BizHawk.Client.Common/lua/CommonLibs/JoypadLuaLibrary.cs index 7a515effc0..32fff33b27 100644 --- a/src/BizHawk.Client.Common/lua/CommonLibs/JoypadLuaLibrary.cs +++ b/src/BizHawk.Client.Common/lua/CommonLibs/JoypadLuaLibrary.cs @@ -24,6 +24,17 @@ namespace BizHawk.Client.Common return table; } + [LuaMethodExample("local nljoyget = joypad.getwithmovie( 1 );")] + [LuaMethod("getwithmovie", "returns a lua table of the controller buttons pressed, including ones pressed by the current movie. If supplied, it will only return a table of buttons for the given controller")] + public LuaTable GetWithMovie(int? controller = null) + { + var table = _th.DictToTable(APIs.Joypad.GetWithMovie(controller)); + table["clear"] = null; + table["getluafunctionslist"] = null; + table["output"] = null; + return table; + } + [LuaMethodExample("local nljoyget = joypad.getimmediate( );")] [LuaMethod("getimmediate", "returns a lua table of any controller buttons currently pressed by the user")] public LuaTable GetImmediate(int? controller = null) => _th.DictToTable(APIs.Joypad.GetImmediate(controller));