Lua - joypad.setfrommnemonicstr() - catch errors and log to the lua console the error instead of killing the script
This commit is contained in:
parent
0c5fda5cb3
commit
e475edc3c6
|
@ -73,17 +73,24 @@ namespace BizHawk.Client.Common
|
||||||
)]
|
)]
|
||||||
public void SetFromMnemonicStr(string inputLogEntry)
|
public void SetFromMnemonicStr(string inputLogEntry)
|
||||||
{
|
{
|
||||||
var lg = Global.MovieSession.MovieControllerInstance();
|
try
|
||||||
lg.SetControllersAsMnemonic(inputLogEntry);
|
|
||||||
|
|
||||||
foreach (var button in lg.Type.BoolButtons)
|
|
||||||
{
|
{
|
||||||
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
var lg = Global.MovieSession.MovieControllerInstance();
|
||||||
|
lg.SetControllersAsMnemonic(inputLogEntry);
|
||||||
|
|
||||||
|
foreach (var button in lg.Type.BoolButtons)
|
||||||
|
{
|
||||||
|
Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var floatButton in lg.Type.FloatControls)
|
||||||
|
{
|
||||||
|
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
foreach (var floatButton in lg.Type.FloatControls)
|
|
||||||
{
|
{
|
||||||
Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton));
|
Log("invalid mnemonic string: " + inputLogEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue