tastudio: Save State hotkeys (finally) control branches:
- save/load by slot number (select that branch if it exists) - save/load current slot (selected branch) - select branch by slot number - select next/previous branch - bind 2 default tastudio hotkeys keep selection when branch gets removed.
This commit is contained in:
parent
d0772a6b44
commit
abd118253f
|
@ -91,8 +91,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public TasBranch GetBranch(int index)
|
||||
{
|
||||
if (index >= Branches.Count)
|
||||
return null; // are we allowed?
|
||||
if (index >= Branches.Count || index < 0)
|
||||
return null;
|
||||
else
|
||||
return Branches[index];
|
||||
}
|
||||
|
|
|
@ -341,6 +341,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.RamSearch.NextOperator();
|
||||
break;
|
||||
|
||||
//TAStudio
|
||||
case "Add Branch":
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.AddBranchExternal();
|
||||
break;
|
||||
case "Delete Branch":
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.RemoveBranchExtrenal();
|
||||
break;
|
||||
|
||||
// SNES
|
||||
case "Toggle BG 1":
|
||||
SNES_ToggleBG1();
|
||||
|
|
|
@ -1569,6 +1569,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(num);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2194,6 +2195,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2221,6 +2223,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.SelectBranchExternal(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2698,6 +2701,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
});
|
||||
}
|
||||
|
||||
private int SlotToInt(string slot)
|
||||
{
|
||||
return int.Parse(slot.Substring(slot.Length - 1, 1));
|
||||
}
|
||||
|
||||
public void LoadState(string path, string userFriendlyStateName, bool fromLua = false, bool supressOSD = false) // Move to client.common
|
||||
{
|
||||
if (!Global.Emulator.HasSavestates())
|
||||
|
@ -2707,6 +2715,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.LoadBranchExternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2754,6 +2763,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.LoadBranchExternal(SlotToInt(quickSlotName));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2777,6 +2787,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.UpdateBranchExternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3717,6 +3728,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (GlobalWin.Tools.TAStudio != null)
|
||||
{
|
||||
GlobalWin.Tools.TAStudio.BookMarkControl.UpdateBranchExternal(SlotToInt(quickSlotName));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,8 +174,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void UpdateBranch(TasBranch branch)
|
||||
{
|
||||
Movie.UpdateBranch(branch, CreateBranch());
|
||||
BranchView.Refresh();
|
||||
Tastudio.RefreshDialog();
|
||||
//BranchView.Refresh();
|
||||
}
|
||||
|
||||
private void LoadSelectedBranch()
|
||||
|
@ -220,8 +220,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (SelectedBranch != null)
|
||||
{
|
||||
UpdateBranch(SelectedBranch);
|
||||
Movie.CurrentBranch = BranchView.SelectedRows.First();
|
||||
UpdateBranch(SelectedBranch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,16 +251,98 @@ namespace BizHawk.Client.EmuHawk
|
|||
Movie.RemoveBranch(SelectedBranch);
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
|
||||
if (index == BranchView.SelectedRows.FirstOrDefault())
|
||||
if (index == Movie.BranchCount)
|
||||
{
|
||||
BranchView.ClearSelectedRows();
|
||||
BranchView.SelectRow(Movie.BranchCount - 1, true);
|
||||
}
|
||||
|
||||
BranchView.Refresh();
|
||||
//BranchView.Refresh();
|
||||
Tastudio.RefreshDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddBranchExternal()
|
||||
{
|
||||
AddBranchToolStripMenuItem_Click(null, null);
|
||||
BranchView.SelectRow(Movie.CurrentBranch, true);
|
||||
BranchView.Refresh();
|
||||
}
|
||||
|
||||
public void LoadBranchExternal(int slot = -1)
|
||||
{
|
||||
if (slot != -1)
|
||||
{
|
||||
if (GetBranch(slot) != null)
|
||||
{
|
||||
BranchView.SelectRow(slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
LoadBranchToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void UpdateBranchExternal(int slot = -1)
|
||||
{
|
||||
if (slot != -1)
|
||||
{
|
||||
if (GetBranch(slot) != null)
|
||||
{
|
||||
BranchView.SelectRow(slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateBranchToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void RemoveBranchExtrenal()
|
||||
{
|
||||
RemoveBranchToolStripMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void SelectBranchExternal(int slot)
|
||||
{
|
||||
if (GetBranch(slot) != null)
|
||||
{
|
||||
BranchView.SelectRow(slot, true);
|
||||
BranchView.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectBranchExternal(bool next)
|
||||
{
|
||||
if (SelectedBranch == null)
|
||||
{
|
||||
BranchView.SelectRow(Movie.CurrentBranch, true);
|
||||
BranchView.Refresh();
|
||||
return;
|
||||
}
|
||||
int sel = BranchView.SelectedRows.First();
|
||||
if (next)
|
||||
{
|
||||
if (GetBranch(sel + 1) != null)
|
||||
{
|
||||
BranchView.SelectRow(sel, false);
|
||||
BranchView.SelectRow(sel + 1, true);
|
||||
}
|
||||
}
|
||||
else // previous
|
||||
{
|
||||
if (GetBranch(sel - 1) != null)
|
||||
{
|
||||
BranchView.SelectRow(sel, false);
|
||||
BranchView.SelectRow(sel - 1, true);
|
||||
}
|
||||
}
|
||||
BranchView.Refresh();
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
|
|
|
@ -1672,7 +1672,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private System.Windows.Forms.ToolStripMenuItem scrollToCenterToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem applyPatternToPaintedInputToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem onlyOnAutoFireColumnsToolStripMenuItem;
|
||||
private BookmarksBranchesBox BookMarkControl;
|
||||
public BookmarksBranchesBox BookMarkControl;
|
||||
private System.Windows.Forms.ToolStripMenuItem BranchContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator25;
|
||||
private System.Windows.Forms.ToolStripMenuItem wheelScrollSpeedToolStripMenuItem;
|
||||
|
|
Loading…
Reference in New Issue