fix lua's reboot_core function... maybe
This commit is contained in:
parent
250bc38a56
commit
260ad45a88
|
@ -312,7 +312,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
)]
|
||||
public static void RebootCore()
|
||||
{
|
||||
//pretty hacky.. we dont want a lua script to be able to restart itself by rebooting the core
|
||||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).IsRebootingCore = true;
|
||||
GlobalWin.MainForm.RebootCore();
|
||||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).IsRebootingCore = false;
|
||||
}
|
||||
|
||||
[LuaMethodAttributes(
|
||||
|
|
|
@ -144,7 +144,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Lua SpawnCoroutine(string file)
|
||||
{
|
||||
var lua = _lua.NewThread();
|
||||
var main = lua.LoadString(File.ReadAllText(file), "main");
|
||||
var content = File.ReadAllText(file);
|
||||
var main = lua.LoadString(content, "main");
|
||||
lua.Push(main); // push main function on to stack for subsequent resuming
|
||||
return lua;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
private List<string> _consoleCommandHistory = new List<string>();
|
||||
private int _consoleCommandHistoryIndex = -1;
|
||||
|
||||
public bool IsRebootingCore;
|
||||
|
||||
public LuaConsole()
|
||||
{
|
||||
_sortReverse = false;
|
||||
|
|
|
@ -441,7 +441,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (ServiceInjector.IsAvailable(Global.Emulator.ServiceProvider, tool.GetType()))
|
||||
{
|
||||
ServiceInjector.UpdateServices(Global.Emulator.ServiceProvider, tool);
|
||||
bool restartTool = false;
|
||||
if ((tool.IsHandleCreated && !tool.IsDisposed) || tool is RamWatch) // Hack for Ram Watch - in display watches mode it wants to keep running even closed, it will handle disposed logic
|
||||
restartTool = true;
|
||||
if (tool is LuaConsole && ((LuaConsole)tool).IsRebootingCore)
|
||||
restartTool = false;
|
||||
if(restartTool)
|
||||
{
|
||||
tool.Restart();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue