diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs index a75ff34f9d..9a3e927d3c 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs @@ -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 diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index cf5398c62e..2c49574ac1 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -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) { diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 6ea394212b..7b3807f193 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -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)