Fix off-by-one in edge cases for `tastudio.ongreenzoneinvalidated`

fixes ad07eb857
also updated the docs to match the actual behaviour
This commit is contained in:
James Groom 2024-05-17 08:36:09 +10:00 committed by GitHub
parent 1260ecd01a
commit 51b64f63f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ namespace BizHawk.Client.Common
if (this.IsRecording())
{
TasStateManager.InvalidateAfter(frame);
GreenzoneInvalidated(frame + 1);
GreenzoneInvalidated(frame);
}
if (frame != 0)

View File

@ -135,7 +135,7 @@ namespace BizHawk.Client.Common
{
var anyLagInvalidated = LagLog.RemoveFrom(frame);
var anyStateInvalidated = TasStateManager.InvalidateAfter(frame);
GreenzoneInvalidated(frame + 1);
GreenzoneInvalidated(frame);
if (anyLagInvalidated || anyStateInvalidated)
{
Changes = true;

View File

@ -543,7 +543,7 @@ namespace BizHawk.Client.EmuHawk
}
[LuaMethodExample("tastudio.ongreenzoneinvalidated( function( currentindex )\r\n\tconsole.log( \"Called whenever the greenzone is invalidated.\" );\r\nend );")]
[LuaMethod("ongreenzoneinvalidated", "Called whenever the greenzone is invalidated. Your callback can have 1 parameter, which will be the index of the first row that was invalidated.")]
[LuaMethod("ongreenzoneinvalidated", "Called whenever the greenzone is invalidated. Your callback can have 1 parameter, which will be the index of the last row before the invalidated ones.")]
public void OnGreenzoneInvalidated(LuaFunction luaf)
{
if (Engaged())