Lua - add a null check that maybe completely fixes input.set(), also add a null check when attempting to resolve the lua path that was breaking Lua Console when auto-loading a lua session

This commit is contained in:
adelikat 2013-03-09 20:31:04 +00:00
parent c8e678aea7
commit 5df510fb4f
2 changed files with 20 additions and 8 deletions

View File

@ -2106,14 +2106,24 @@ namespace BizHawk.MultiClient
public void joypad_set(LuaTable buttons, object controller = null)
{
foreach (var button in buttons.Keys)
try
{
if (Convert.ToBoolean(buttons[button]) == true)
if (controller == null)
Global.ClickyVirtualPadController.Click(button.ToString());
else
Global.ClickyVirtualPadController.Click("P" + controller.ToString() + " " + button.ToString());
foreach (var button in buttons.Keys)
{
if (Convert.ToBoolean(buttons[button]) == true)
{
if (controller == null)
{
Global.ClickyVirtualPadController.Click(button.ToString());
}
else
{
Global.ClickyVirtualPadController.Click("P" + controller.ToString() + " " + button.ToString());
}
}
}
}
catch { /*Eat it*/ }
}
//----------------------------------------------------

View File

@ -866,8 +866,10 @@ namespace BizHawk.MultiClient
if (!prohibit)
{
//restore this lua thread's preferred current directory
Environment.CurrentDirectory = lf.CurrentDirectory;
if (lf.CurrentDirectory != null)
{
Environment.CurrentDirectory = lf.CurrentDirectory;
}
var result = LuaImp.ResumeScript(lf.Thread);
if (result.Terminated) lf.Stop();
lf.FrameWaiting = result.WaitForFrame;