From 2a8578c74f0dfab359f8b462782b249555f5f833 Mon Sep 17 00:00:00 2001 From: feos Date: Sun, 4 Oct 2015 18:00:04 +0300 Subject: [PATCH] tastudio: keep the same identifier for updated branch. ban context menu when there's no selection. attempts to fix mysterious crashes in TasStateManager. --- BizHawk.Client.Common/movie/tasproj/TasMovie.cs | 1 + BizHawk.Client.Common/movie/tasproj/TasStateManager.cs | 4 ++-- BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index a57ab51cd4..85b22baa90 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -539,6 +539,7 @@ namespace BizHawk.Client.Common public void UpdateBranch(TasBranch old, TasBranch newBranch) { int index = Branches.IndexOf(old); + newBranch.UniqueIdentifier = old.UniqueIdentifier; Branches[index] = newBranch; TasStateManager.UpdateBranch(index); Changes = true; diff --git a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs index e40785fc73..1ad2ce7a0a 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs @@ -265,7 +265,7 @@ namespace BizHawk.Client.Common { if (BranchStates.Any()) { - var kvp = BranchStates.ElementAt(1); + var kvp = BranchStates.Count() > 1 ? BranchStates.ElementAt(1) : BranchStates.ElementAt(0); shouldRemove.X = kvp.Key; shouldRemove.Y = kvp.Value.Keys[0]; } @@ -356,7 +356,7 @@ namespace BizHawk.Client.Common { if (branch == -1) accessed.Remove(States[frame]); - else + else if (accessed.Contains(BranchStates[frame][branch])) accessed.Remove(BranchStates[frame][branch]); StateManagerState state; diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 81d249fda8..aef3c4b631 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -538,7 +538,7 @@ namespace BizHawk.Client.EmuHawk private void TasView_MouseUp(object sender, MouseEventArgs e) { - if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu) + if (e.Button == MouseButtons.Right && !TasView.IsPointingAtColumnHeader && !_supressContextMenu && TasView.SelectedRows.Any()) { if (Global.MovieSession.Movie.FrameCount < TasView.SelectedRows.Max()) {