Fix regression from commit 8c7b0b5e. file.Thread not being null no longer means the file hadn't stopped.

This commit is contained in:
SuuperW 2023-10-03 00:51:54 -05:00
parent 4fa5203165
commit 39d37a389f
2 changed files with 9 additions and 4 deletions

View File

@ -72,7 +72,7 @@ namespace BizHawk.Client.Common
FrameWaiting = false;
break;
default:
State = RunState.Disabled;
Stop();
break;
}
}

View File

@ -1482,14 +1482,19 @@ namespace BizHawk.Client.EmuHawk
return;
}
file.Toggle();
if (file.Paused)
{
file.State = LuaFile.RunState.Running;
return;
}
if (file.Enabled && file.Thread is null)
file.Toggle();
if (file.Enabled)
{
LuaImp.RegisteredFunctions.RemoveForFile(file, Emulator); // First remove any existing registered functions for this file
EnableLuaFile(file);
}
else if (!file.Enabled && file.Thread is not null)
else if (!file.Enabled)
{
LuaImp.DisableLuaScript(file);
// there used to be a call here which did a redraw of the Gui/OSD, which included a call to `Tools.UpdateToolsAfter` --yoshi