Fix: Using tastudio.setplayback to seek to a non-existent marker would permanently suppress Lua.

Fix: Using tastudio.setplayback with a Lua number that happens to not currently be represented as an integer would throw.
This commit is contained in:
SuuperW 2025-06-14 22:02:46 -05:00
parent 2749b1b675
commit 88cf00d4b6
1 changed files with 9 additions and 9 deletions

View File

@ -143,30 +143,30 @@ namespace BizHawk.Client.EmuHawk
throw new InvalidOperationException("tastudio.setplayback() is not allowed during input/memory callbacks");
}
_luaLibsImpl.IsUpdateSupressed = true;
int f;
if (frame is long frameNumber)
{
f = (int)frameNumber;
}
else if (frame is double frameNumber2)
{
f = (int)frameNumber2;
}
else
{
f = Tastudio.CurrentTasMovie.Markers.FindIndex((string)frame);
if (f == -1)
{
return;
}
int markerIndex = Tastudio.CurrentTasMovie.Markers.FindIndex((string)frame);
if (markerIndex == -1) return;
f = Tastudio.CurrentTasMovie.Markers[f].Frame;
f = Tastudio.CurrentTasMovie.Markers[markerIndex].Frame;
}
if (f >= 0)
{
_luaLibsImpl.IsUpdateSupressed = true;
Tastudio.GoToFrame(f);
_luaLibsImpl.IsUpdateSupressed = false;
}
_luaLibsImpl.IsUpdateSupressed = false;
}
}