add a Lua method to get inputs from the movie (#2526)
This commit is contained in:
parent
2b5d0b6219
commit
3d84812341
|
@ -25,6 +25,11 @@ namespace BizHawk.Client.Common
|
|||
return _inputManager.AutofireStickyXorAdapter.ToDictionary(controller);
|
||||
}
|
||||
|
||||
public IDictionary<string, object> GetWithMovie(int? controller = null)
|
||||
{
|
||||
return _inputManager.ControllerOutput.ToDictionary(controller);
|
||||
}
|
||||
|
||||
public IDictionary<string, object> GetImmediate(int? controller = null)
|
||||
{
|
||||
return _inputManager.ActiveController.ToDictionary(controller);
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace BizHawk.Client.Common
|
|||
public interface IJoypadApi : IExternalApi
|
||||
{
|
||||
IDictionary<string, object> Get(int? controller = null);
|
||||
IDictionary<string, object> GetWithMovie(int? controller = null);
|
||||
IDictionary<string, object> GetImmediate(int? controller = null);
|
||||
void SetFromMnemonicStr(string inputLogEntry);
|
||||
void Set(IDictionary<string, bool> buttons, int? controller = null);
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue