add SetPlayback to tastudio lua library. Can't be 100% sure it works, but it seems to be working OK. it may hang everything up if you seek through a really long redzone.....

This commit is contained in:
zeromus 2017-02-04 21:40:29 -06:00
parent a70e6e2fc4
commit 539cdc29f3
2 changed files with 29 additions and 0 deletions

View File

@ -282,6 +282,11 @@ namespace BizHawk.Client.Common
.FirstOrDefault();
}
public int FindIndex(string markerName)
{
return this.FindIndex(m => m.Message == markerName);
}
public bool IsMarker(int frame)
{
return this.Any(m => m == frame);

View File

@ -155,6 +155,30 @@ namespace BizHawk.Client.EmuHawk
return false;
}
[LuaMethodAttributes(
"setplayback",
"Seeks the given frame (a number) or marker (a string)"
)]
public void SetPlayback(object frame)
{
if (Engaged())
{
int f;
if (frame is double) f = (int)(double)frame;
else
{
//r marker = Tastudio.CurrentTasMovie.Markers.Get(frame);
f = Tastudio.CurrentTasMovie.Markers.FindIndex((string)frame);
if (f == -1) return;
f = Tastudio.CurrentTasMovie.Markers[f].Frame;
}
if (f < Tastudio.CurrentTasMovie.InputLogLength && f>=0)
{
Tastudio.GoToFrame(f);
}
}
}
[LuaMethodAttributes(
"onqueryitembg",
"called during the background draw event of the tastudio listview"