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; FrameWaiting = false;
break; break;
default: default:
State = RunState.Disabled; Stop();
break; break;
} }
} }

View File

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