From 39d37a389f769f50871bda04378d9cc05e910e19 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Tue, 3 Oct 2023 00:51:54 -0500 Subject: [PATCH] Fix regression from commit 8c7b0b5e. file.Thread not being null no longer means the file hadn't stopped. --- src/BizHawk.Client.Common/lua/LuaFile.cs | 2 +- src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/BizHawk.Client.Common/lua/LuaFile.cs b/src/BizHawk.Client.Common/lua/LuaFile.cs index 869ac4a647..e392e4a872 100644 --- a/src/BizHawk.Client.Common/lua/LuaFile.cs +++ b/src/BizHawk.Client.Common/lua/LuaFile.cs @@ -72,7 +72,7 @@ namespace BizHawk.Client.Common FrameWaiting = false; break; default: - State = RunState.Disabled; + Stop(); break; } } diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index e163ad53c9..8506a42084 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -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