Debugger: Lua - Added missing definition for getInput API

This commit is contained in:
Sour 2020-05-16 12:02:10 -04:00
parent a402a2c569
commit c4389d63ba
2 changed files with 3 additions and 2 deletions

View file

@ -88,6 +88,7 @@ int LuaApi::GetLibrary(lua_State *lua)
{ "rewind", LuaApi::Rewind },
{ "takeScreenshot", LuaApi::TakeScreenshot },
{ "isKeyPressed", LuaApi::IsKeyPressed },
{ "getInput", LuaApi::GetInput },
{ "getAccessCounters", LuaApi::GetAccessCounters },
{ "resetAccessCounters", LuaApi::ResetAccessCounters },
{ "getState", LuaApi::GetState },
@ -587,7 +588,7 @@ int LuaApi::GetInput(lua_State *lua)
LuaCallHelper l(lua);
int port = l.ReadInteger();
checkparams();
errorCond(port < 0 || port > 3, "Invalid port number - must be between 0 to 3");
errorCond(port < 0 || port > 4, "Invalid port number - must be between 0 to 4");
shared_ptr<SnesController> controller = std::dynamic_pointer_cast<SnesController>(_console->GetControlManager()->GetControlDevice(port));
errorCond(controller == nullptr, "Input port must be connected to a standard controller");

View file

@ -546,7 +546,7 @@ namespace Mesen.GUI.Debugger
new List<string> {"func","emu.getSavestateData","emu.getSavestateData()","slotNumber - *Integer* The slot number to get the savestate data from (must be a slot number that was used in a preceding saveSavestateAsync call)","*String* A binary string containing the savestate","Returns the savestate stored in the specified savestate slot."},
new List<string> {"func","emu.clearSavestateData","emu.clearSavestateData()","slotNumber - *Integer* The slot number to get the savestate data from (must be a slot number that was used in a preceding saveSavestateAsync call)","","Clears the specified savestate slot (any savestate data in that slot will be removed from memory)."},
*/
new List<string> {"func","emu.getInput","emu.getInput(port)","port - *Integer* The port number to read (0 to 3)","*Table* A table containing the status of all 8 buttons.","Returns a table containing the status of all 8 buttons: { a, b, select, start, up, down, left, right }"},
new List<string> {"func","emu.getInput","emu.getInput(port)","port - *Integer* The port number to read (0 to 4)","*Table* A table containing the status of all 12 buttons.","Returns a table containing the status of all 12 buttons: { a, b, x, y, l, r, select, start, up, down, left, right }"},
//new List<string> {"func","emu.setInput","emu.setInput(port, input)","port - *Integer* The port number to apply the input to (0 to 3)\ninput - *Table* A table containing the state of some (or all) of the 8 buttons (same format as returned by getInput)","","Buttons enabled or disabled via setInput will keep their state until the next inputPolled event.\nIf a buttons value is not specified to either true or false in the input argument, then the player retains control of that button.\nFor example, setInput(0, { select = false, start = false}) will prevent the player 1 from using both the start and select buttons,\nbut all other buttons will still work as normal.To properly control the emulation, it is recommended to use this function\nwithin a callback for the inputPolled event.\nOtherwise, the inputs may not be applied before the ROM has the chance to read them."},
new List<string> {"func","emu.getMouseState","emu.getMouseState()","","*Table* The mouse's state","Returns a table containing the position and the state of all 3 buttons: { x, y, left, middle, right }"},
new List<string> {"func","emu.isKeyPressed","emu.isKeyPressed(keyName)","keyName - *String* The name of the key to check","*Boolean* The keys state (true = pressed)","Returns whether or not a specific key is pressed. The “keyName” must be the same as the string shown in the UI when the key is bound to a button."},