Lua - implement tastudio.loadbranch #fixes #1650

This commit is contained in:
adelikat 2019-11-24 13:55:46 -06:00
parent 74e1f97ebb
commit 4e9b780539
3 changed files with 20 additions and 1 deletions

View File

@ -428,6 +428,16 @@ namespace BizHawk.Client.EmuHawk
return table;
}
[LuaMethodExample("tastudio.loadbranch(0)")]
[LuaMethod("loadbranch", "Loads a branch at the given index, if a branch at that index exists.")]
public void LoadBranch(int index)
{
if (Engaged())
{
Tastudio.LoadBranchByIndex(index);
}
}
#endregion
#region Markers

View File

@ -191,7 +191,7 @@ namespace BizHawk.Client.EmuHawk
};
}
private void LoadBranch(TasBranch branch)
public void LoadBranch(TasBranch branch)
{
if (Tastudio.Settings.OldControlSchemeForBranches && !Tastudio.TasPlaybackBox.RecordingMode)
{

View File

@ -138,6 +138,15 @@ namespace BizHawk.Client.EmuHawk
LastPositionFrame = -1;
}
public void LoadBranchByIndex(int index)
{
if (index < CurrentTasMovie.BranchCount)
{
var branch = CurrentTasMovie.Branches[index];
BookMarkControl.LoadBranch(branch);
}
}
private void AutosaveTimerEventProcessor(object sender, EventArgs e)
{
if (CurrentTasMovie == null)